mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into refactorEmitter
Conflicts: src/compiler/emitter.ts src/compiler/parser.ts src/compiler/types.ts
This commit is contained in:
@@ -11,6 +11,7 @@ tests/cases/*/*/*.js.map
|
||||
tests/cases/*/*/*/*.js.map
|
||||
tests/cases/*/*/*/*/*.js.map
|
||||
tests/cases/rwc/*
|
||||
tests/cases/test262/*
|
||||
tests/cases/perf/*
|
||||
!tests/cases/webharness/compilerToString.js
|
||||
test-args.txt
|
||||
@@ -19,6 +20,7 @@ tests/baselines/local/*
|
||||
tests/services/baselines/local/*
|
||||
tests/baselines/prototyping/local/*
|
||||
tests/baselines/rwc/*
|
||||
tests/baselines/test262/*
|
||||
tests/services/baselines/prototyping/local/*
|
||||
tests/services/browser/typescriptServices.js
|
||||
scripts/processDiagnosticMessages.d.ts
|
||||
|
||||
@@ -78,6 +78,7 @@ var harnessSources = [
|
||||
"projectsRunner.ts",
|
||||
"loggedIO.ts",
|
||||
"rwcRunner.ts",
|
||||
"test262Runner.ts",
|
||||
"runner.ts"
|
||||
].map(function (f) {
|
||||
return path.join(harnessDirectory, f);
|
||||
@@ -91,10 +92,12 @@ var harnessSources = [
|
||||
|
||||
var librarySourceMap = [
|
||||
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
|
||||
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "dom.generated.d.ts"], },
|
||||
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "webworker.generated.d.ts"], },
|
||||
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts"], },
|
||||
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "webworker.generated.d.ts"], },
|
||||
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"]},
|
||||
];
|
||||
|
||||
var libraryTargets = librarySourceMap.map(function (f) {
|
||||
@@ -135,7 +138,6 @@ function concatenateFiles(destinationFile, sourceFiles) {
|
||||
}
|
||||
|
||||
var useDebugMode = true;
|
||||
var generateDeclarations = false;
|
||||
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
|
||||
var compilerFilename = "tsc.js";
|
||||
/* Compiles a file from a list of sources
|
||||
@@ -146,7 +148,7 @@ var compilerFilename = "tsc.js";
|
||||
* @param useBuiltCompiler: true to use the built compiler, false to use the LKG
|
||||
* @param noOutFile: true to compile without using --out
|
||||
*/
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile) {
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations) {
|
||||
file(outFile, prereqs, function() {
|
||||
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
|
||||
var options = "-removeComments --module commonjs -noImplicitAny ";
|
||||
@@ -157,7 +159,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
||||
if (useDebugMode) {
|
||||
options += "--preserveConstEnums ";
|
||||
}
|
||||
|
||||
|
||||
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
|
||||
cmd = cmd + sources.join(" ") + (!noOutFile ? " -out " + outFile : "");
|
||||
if (useDebugMode) {
|
||||
@@ -184,7 +186,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
||||
fs.unlinkSync(outFile);
|
||||
console.log("Compilation of " + outFile + " unsuccessful");
|
||||
});
|
||||
ex.run();
|
||||
ex.run();
|
||||
}, {async: true});
|
||||
}
|
||||
|
||||
@@ -239,7 +241,7 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
|
||||
ex.addListener("cmdEnd", function() {
|
||||
complete();
|
||||
});
|
||||
ex.run();
|
||||
ex.run();
|
||||
}, {async: true})
|
||||
|
||||
|
||||
@@ -252,7 +254,8 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
|
||||
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
|
||||
|
||||
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
|
||||
compileFile(servicesFile, servicesSources, [builtLocalDirectory, copyright].concat(servicesSources), [copyright], /*useBuiltCompiler:*/ true);
|
||||
var servicesDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
compileFile(servicesFile, servicesSources, [builtLocalDirectory, copyright].concat(servicesSources), [copyright], /*useBuiltCompiler:*/ true, /*noOutFile:*/ false, /*generateDeclarations:*/ true);
|
||||
|
||||
// Local target to build the compiler and services
|
||||
desc("Builds the full compiler and services");
|
||||
@@ -275,11 +278,6 @@ task("clean", function() {
|
||||
jake.rmRf(builtDirectory);
|
||||
});
|
||||
|
||||
// generate declarations for compiler and services
|
||||
desc("Generate declarations for compiler and services");
|
||||
task("declaration", function() {
|
||||
generateDeclarations = true;
|
||||
});
|
||||
|
||||
// Generate Markdown spec
|
||||
var word2mdJs = path.join(scriptsDirectory, "word2md.js");
|
||||
@@ -314,7 +312,7 @@ task("generate-spec", [specMd])
|
||||
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
|
||||
desc("Makes a new LKG out of the built js files");
|
||||
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
|
||||
var expectedFiles = [tscFile, servicesFile].concat(libraryTargets);
|
||||
var expectedFiles = [tscFile, servicesFile, servicesDefinitionsFile].concat(libraryTargets);
|
||||
var missingFiles = expectedFiles.filter(function (f) {
|
||||
return !fs.existsSync(f);
|
||||
});
|
||||
@@ -346,6 +344,9 @@ var refBaseline = "tests/baselines/reference/";
|
||||
var localRwcBaseline = "tests/baselines/rwc/local/";
|
||||
var refRwcBaseline = "tests/baselines/rwc/reference/";
|
||||
|
||||
var localTest262Baseline = "tests/baselines/test262/local/";
|
||||
var refTest262Baseline = "tests/baselines/test262/reference/";
|
||||
|
||||
desc("Builds the test infrastructure using the built compiler");
|
||||
task("tests", ["local", run].concat(libraryTargets));
|
||||
|
||||
@@ -514,6 +515,12 @@ task("baseline-accept-rwc", function() {
|
||||
fs.renameSync(localRwcBaseline, refRwcBaseline);
|
||||
});
|
||||
|
||||
desc("Makes the most recent test262 test results the new baseline, overwriting the old baseline");
|
||||
task("baseline-accept-test262", function() {
|
||||
jake.rmRf(refTest262Baseline);
|
||||
fs.renameSync(localTest262Baseline, refTest262Baseline);
|
||||
});
|
||||
|
||||
|
||||
// Webhost
|
||||
var webhostPath = "tests/webhost/webtsc.ts";
|
||||
@@ -547,7 +554,7 @@ file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function() {
|
||||
jake.rmRf(temp);
|
||||
complete();
|
||||
});
|
||||
ex.run();
|
||||
ex.run();
|
||||
}, {async: true});
|
||||
|
||||
var instrumenterPath = harnessDirectory + 'instrumenter.ts';
|
||||
|
||||
Vendored
+1
-1
@@ -1489,7 +1489,7 @@ interface Uint32Array extends ArrayBufferView {
|
||||
set(array: number[], offset?: number): void;
|
||||
|
||||
/**
|
||||
* Gets a new Int8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
|
||||
* Gets a new Uint32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
|
||||
+2132
-1776
File diff suppressed because it is too large
Load Diff
+2690
-2232
File diff suppressed because it is too large
Load Diff
+35
-17
@@ -53,12 +53,22 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if any of the following are true:
|
||||
* 1. declaration has no name
|
||||
* 2. declaration has a literal name (not computed)
|
||||
* 3. declaration has a computed property name that is a known symbol
|
||||
*/
|
||||
export function hasComputedNameButNotSymbol(declaration: Declaration): boolean {
|
||||
return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName;
|
||||
}
|
||||
|
||||
export function bindSourceFile(file: SourceFile) {
|
||||
|
||||
var parent: Node;
|
||||
var container: Declaration;
|
||||
var container: Node;
|
||||
var blockScopeContainer: Node;
|
||||
var lastContainer: Declaration;
|
||||
var lastContainer: Node;
|
||||
var symbolCount = 0;
|
||||
var Symbol = objectAllocator.getSymbolConstructor();
|
||||
|
||||
@@ -84,13 +94,14 @@ module ts {
|
||||
if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node;
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Implement getDeclarationName for property name
|
||||
// Should not be called on a declaration with a computed property name.
|
||||
function getDeclarationName(node: Declaration): string {
|
||||
if (node.name) {
|
||||
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
|
||||
return '"' + (<LiteralExpression>node.name).text + '"';
|
||||
}
|
||||
return (<Identifier>node.name).text;
|
||||
Debug.assert(!hasComputedNameButNotSymbol(node));
|
||||
return (<Identifier | LiteralExpression>node.name).text;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ConstructorType:
|
||||
@@ -111,6 +122,12 @@ module ts {
|
||||
}
|
||||
|
||||
function declareSymbol(symbols: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
|
||||
// Nodes with computed property names will not get symbols, because the type checker
|
||||
// does not make properties for them.
|
||||
if (hasComputedNameButNotSymbol(node)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var name = getDeclarationName(node);
|
||||
if (name !== undefined) {
|
||||
var symbol = hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name));
|
||||
@@ -118,6 +135,7 @@ module ts {
|
||||
if (node.name) {
|
||||
node.name.parent = node;
|
||||
}
|
||||
|
||||
// Report errors every position with duplicate declaration
|
||||
// Report errors on previous encountered declarations
|
||||
var message = symbol.flags & SymbolFlags.BlockScopedVariable
|
||||
@@ -205,7 +223,7 @@ module ts {
|
||||
|
||||
// All container nodes are kept on a linked list in declaration order. This list is used by the getLocalNameOfContainer function
|
||||
// in the type checker to validate that the local name used for a container is unique.
|
||||
function bindChildren(node: Declaration, symbolKind: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
function bindChildren(node: Node, symbolKind: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
if (symbolKind & SymbolFlags.HasLocals) {
|
||||
node.locals = {};
|
||||
}
|
||||
@@ -262,7 +280,7 @@ module ts {
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
@@ -324,14 +342,14 @@ module ts {
|
||||
typeLiteralSymbol.members[node.kind === SyntaxKind.FunctionType ? "__call" : "__new"] = symbol
|
||||
}
|
||||
|
||||
function bindAnonymousDeclaration(node: Node, symbolKind: SymbolFlags, name: string, isBlockScopeContainer: boolean) {
|
||||
function bindAnonymousDeclaration(node: Declaration, symbolKind: SymbolFlags, name: string, isBlockScopeContainer: boolean) {
|
||||
var symbol = createSymbol(symbolKind, name);
|
||||
addDeclarationToSymbol(symbol, node, symbolKind);
|
||||
bindChildren(node, symbolKind, isBlockScopeContainer);
|
||||
}
|
||||
|
||||
function bindCatchVariableDeclaration(node: CatchBlock) {
|
||||
var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.variable.text || "__missing");
|
||||
function bindCatchVariableDeclaration(node: CatchClause) {
|
||||
var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.name.text || "__missing");
|
||||
addDeclarationToSymbol(symbol, node, SymbolFlags.FunctionScopedVariable);
|
||||
var saveParent = parent;
|
||||
var savedBlockScopeContainer = blockScopeContainer;
|
||||
@@ -417,17 +435,17 @@ module ts {
|
||||
break;
|
||||
|
||||
case SyntaxKind.TypeLiteral:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.TypeLiteral, "__type", /*isBlockScopeContainer*/ false);
|
||||
bindAnonymousDeclaration(<TypeLiteralNode>node, SymbolFlags.TypeLiteral, "__type", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ObjectLiteral, "__object", /*isBlockScopeContainer*/ false);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
bindAnonymousDeclaration(<ObjectLiteralExpression>node, SymbolFlags.ObjectLiteral, "__object", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
|
||||
bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.CatchBlock:
|
||||
bindCatchVariableDeclaration(<CatchBlock>node);
|
||||
case SyntaxKind.CatchClause:
|
||||
bindCatchVariableDeclaration(<CatchClause>node);
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes, /*isBlockScopeContainer*/ false);
|
||||
@@ -454,13 +472,13 @@ module ts {
|
||||
break;
|
||||
case SyntaxKind.SourceFile:
|
||||
if (isExternalModule(<SourceFile>node)) {
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).filename) + '"', /*isBlockScopeContainer*/ true);
|
||||
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).filename) + '"', /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
}
|
||||
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
|
||||
+510
-370
File diff suppressed because it is too large
Load Diff
@@ -106,8 +106,7 @@ module ts {
|
||||
Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." },
|
||||
String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." },
|
||||
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." },
|
||||
catch_or_finally_expected: { code: 1143, category: DiagnosticCategory.Error, key: "'catch' or 'finally' expected." },
|
||||
Block_or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "Block or ';' expected." },
|
||||
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
|
||||
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
|
||||
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
|
||||
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
|
||||
@@ -120,12 +119,27 @@ module ts {
|
||||
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
|
||||
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
|
||||
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
|
||||
Invalid_template_literal_expected: { code: 1158, category: DiagnosticCategory.Error, key: "Invalid template literal; expected '}'" },
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
|
||||
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
|
||||
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
|
||||
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
|
||||
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
|
||||
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
|
||||
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
|
||||
Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." },
|
||||
Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." },
|
||||
A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." },
|
||||
extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." },
|
||||
extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." },
|
||||
Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." },
|
||||
implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen." },
|
||||
Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." },
|
||||
Binary_digit_expected: { code: 1177, category: DiagnosticCategory.Error, key: "Binary digit expected." },
|
||||
Octal_digit_expected: { code: 1178, category: DiagnosticCategory.Error, key: "Octal digit expected." },
|
||||
Unexpected_token_expected: { code: 1179, category: DiagnosticCategory.Error, key: "Unexpected token. '{' expected." },
|
||||
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." },
|
||||
@@ -414,5 +428,7 @@ module ts {
|
||||
_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: 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: 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." },
|
||||
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." },
|
||||
};
|
||||
}
|
||||
@@ -415,11 +415,7 @@
|
||||
"category": "Error",
|
||||
"code": 1142
|
||||
},
|
||||
"'catch' or 'finally' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1143
|
||||
},
|
||||
"Block or ';' expected.": {
|
||||
"'{' or ';' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1144
|
||||
},
|
||||
@@ -471,10 +467,6 @@
|
||||
"category": "Error",
|
||||
"code": 1157
|
||||
},
|
||||
"Invalid template literal; expected '}'": {
|
||||
"category": "Error",
|
||||
"code": 1158
|
||||
},
|
||||
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1159
|
||||
@@ -491,10 +483,75 @@
|
||||
"category": "Error",
|
||||
"code": 1162
|
||||
},
|
||||
"'yield' expression must be contained_within a generator declaration.": {
|
||||
"'yield' expression must be contained_within a generator declaration."
|
||||
: {
|
||||
"category": "Error",
|
||||
"code": 1163
|
||||
},
|
||||
"Computed property names are not allowed in enums.": {
|
||||
"category": "Error",
|
||||
"code": 1164
|
||||
},
|
||||
"Computed property names are not allowed in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1165
|
||||
},
|
||||
"Computed property names are not allowed in class property declarations.": {
|
||||
"category": "Error",
|
||||
"code": 1166
|
||||
},
|
||||
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1167
|
||||
},
|
||||
"Computed property names are not allowed in method overloads.": {
|
||||
"category": "Error",
|
||||
"code": 1168
|
||||
},
|
||||
"Computed property names are not allowed in interfaces.": {
|
||||
"category": "Error",
|
||||
"code": 1169
|
||||
},
|
||||
"Computed property names are not allowed in type literals.": {
|
||||
"category": "Error",
|
||||
"code": 1170
|
||||
},
|
||||
"A comma expression is not allowed in a computed property name.": {
|
||||
"category": "Error",
|
||||
"code": 1171
|
||||
},
|
||||
"'extends' clause already seen.": {
|
||||
"category": "Error",
|
||||
"code": 1172
|
||||
},
|
||||
"'extends' clause must precede 'implements' clause.": {
|
||||
"category": "Error",
|
||||
"code": 1173
|
||||
},
|
||||
"Classes can only extend a single class.": {
|
||||
"category": "Error",
|
||||
"code": 1174
|
||||
},
|
||||
"'implements' clause already seen.": {
|
||||
"category": "Error",
|
||||
"code": 1175
|
||||
},
|
||||
"Interface declaration cannot have 'implements' clause.": {
|
||||
"category": "Error",
|
||||
"code": 1176
|
||||
},
|
||||
"Binary digit expected.": {
|
||||
"category": "Error",
|
||||
"code": 1177
|
||||
},
|
||||
"Octal digit expected.": {
|
||||
"category": "Error",
|
||||
"code": 1178
|
||||
},
|
||||
"Unexpected token. '{' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1179
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
@@ -1654,5 +1711,13 @@
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
},
|
||||
"'yield' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9000
|
||||
},
|
||||
"'generators' are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001
|
||||
}
|
||||
}
|
||||
|
||||
+254
-162
@@ -277,24 +277,37 @@ module ts {
|
||||
var firstAccessor: AccessorDeclaration;
|
||||
var getAccessor: AccessorDeclaration;
|
||||
var setAccessor: AccessorDeclaration;
|
||||
forEach(node.members, (member: Declaration) => {
|
||||
// TODO(jfreeman): Handle computed names for accessor matching
|
||||
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) &&
|
||||
(<Identifier>member.name).text === (<Identifier>accessor.name).text &&
|
||||
(member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
|
||||
if (!firstAccessor) {
|
||||
firstAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
|
||||
getAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
|
||||
setAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
if (accessor.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
firstAccessor = accessor;
|
||||
if (accessor.kind === SyntaxKind.GetAccessor) {
|
||||
getAccessor = accessor;
|
||||
}
|
||||
});
|
||||
else if (accessor.kind === SyntaxKind.SetAccessor) {
|
||||
setAccessor = accessor;
|
||||
}
|
||||
else {
|
||||
Debug.fail("Accessor has wrong kind");
|
||||
}
|
||||
}
|
||||
else {
|
||||
forEach(node.members,(member: Declaration) => {
|
||||
if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) &&
|
||||
(<Identifier>member.name).text === (<Identifier>accessor.name).text &&
|
||||
(member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) {
|
||||
if (!firstAccessor) {
|
||||
firstAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
|
||||
getAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
|
||||
if (member.kind === SyntaxKind.SetAccessor && !setAccessor) {
|
||||
setAccessor = <AccessorDeclaration>member;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
firstAccessor,
|
||||
getAccessor,
|
||||
@@ -344,7 +357,7 @@ module ts {
|
||||
var currentSourceFile: SourceFile;
|
||||
var reportedDeclarationError = false;
|
||||
|
||||
var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Declaration) { } : writeJsDocComments;
|
||||
var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments;
|
||||
|
||||
var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = [];
|
||||
|
||||
@@ -427,7 +440,7 @@ module ts {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
}
|
||||
|
||||
function writeTypeAtLocation(location: Node, type: TypeNode, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableOrParameterDeclaration, type: TypeNode | StringLiteralExpression, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;
|
||||
write(": ");
|
||||
if (type) {
|
||||
@@ -435,7 +448,7 @@ module ts {
|
||||
emitType(type);
|
||||
}
|
||||
else {
|
||||
resolver.writeTypeAtLocation(location, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +485,7 @@ module ts {
|
||||
emitSeparatedList(nodes, ", ", eachNodeEmitFn);
|
||||
}
|
||||
|
||||
function writeJsDocComments(declaration: Declaration) {
|
||||
function writeJsDocComments(declaration: Node) {
|
||||
if (declaration) {
|
||||
var jsDocComments = getJsDocComments(declaration, currentSourceFile);
|
||||
emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments);
|
||||
@@ -481,12 +494,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeWithNewGetSymbolAccessibilityDiangostic(type: TypeNode, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;
|
||||
emitType(type);
|
||||
}
|
||||
|
||||
function emitType(type: TypeNode) {
|
||||
function emitType(type: TypeNode | StringLiteralExpression | Identifier | QualifiedName) {
|
||||
switch (type.kind) {
|
||||
case SyntaxKind.AnyKeyword:
|
||||
case SyntaxKind.StringKeyword:
|
||||
@@ -505,11 +518,11 @@ module ts {
|
||||
return emitTupleType(<TupleTypeNode>type);
|
||||
case SyntaxKind.UnionType:
|
||||
return emitUnionType(<UnionTypeNode>type);
|
||||
case SyntaxKind.ParenType:
|
||||
return emitParenType(<ParenTypeNode>type);
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return emitParenType(<ParenthesizedTypeNode>type);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
return emitSignatureDeclarationWithJsDocComments(<SignatureDeclaration>type);
|
||||
return emitSignatureDeclarationWithJsDocComments(<FunctionOrConstructorTypeNode>type);
|
||||
case SyntaxKind.TypeLiteral:
|
||||
return emitTypeLiteral(<TypeLiteralNode>type);
|
||||
case SyntaxKind.Identifier:
|
||||
@@ -570,7 +583,7 @@ module ts {
|
||||
emitSeparatedList(type.types, " | ", emitType);
|
||||
}
|
||||
|
||||
function emitParenType(type: ParenTypeNode) {
|
||||
function emitParenType(type: ParenthesizedTypeNode) {
|
||||
write("(");
|
||||
emitType(type.type);
|
||||
write(")");
|
||||
@@ -602,7 +615,7 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function emitModuleElementDeclarationFlags(node: Declaration) {
|
||||
function emitModuleElementDeclarationFlags(node: Node) {
|
||||
// If the node is parented in the current source file we need to emit export declare or just export
|
||||
if (node.parent === currentSourceFile) {
|
||||
// If the node is exported
|
||||
@@ -652,13 +665,13 @@ module ts {
|
||||
write("import ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
write(" = ");
|
||||
if (node.entityName) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiangostic(node.entityName, getImportEntityNameVisibilityError);
|
||||
if (isInternalModuleImportDeclaration(node)) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(<EntityName>node.moduleReference, getImportEntityNameVisibilityError);
|
||||
write(";");
|
||||
}
|
||||
else {
|
||||
write("require(");
|
||||
writeTextOfNode(currentSourceFile, node.externalModuleName);
|
||||
writeTextOfNode(currentSourceFile, getExternalModuleImportDeclarationExpression(node));
|
||||
write(");");
|
||||
}
|
||||
writer.writeLine();
|
||||
@@ -688,7 +701,7 @@ module ts {
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines((<Block>node.body).statements);
|
||||
emitLines((<ModuleBlock>node.body).statements);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
@@ -703,7 +716,7 @@ module ts {
|
||||
write("type ");
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
write(" = ");
|
||||
emitTypeWithNewGetSymbolAccessibilityDiangostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError);
|
||||
write(";");
|
||||
writeLine();
|
||||
}
|
||||
@@ -715,7 +728,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
@@ -767,7 +780,7 @@ module ts {
|
||||
emitType(node.constraint);
|
||||
}
|
||||
else {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiangostic(node.constraint, getTypeParameterConstraintVisibilityError);
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,17 +845,17 @@ module ts {
|
||||
emitCommaList(typeReferences, emitTypeOfTypeReference);
|
||||
}
|
||||
|
||||
function emitTypeOfTypeReference(node: Node) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiangostic(node, getHeritageClauseVisibilityError);
|
||||
function emitTypeOfTypeReference(node: TypeReferenceNode) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
|
||||
|
||||
function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
// Heritage clause is written by user so it can always be named
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
// Class or Interface implemented/extended is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
// interface is inaccessible
|
||||
@@ -852,7 +865,7 @@ module ts {
|
||||
return {
|
||||
diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: (<Declaration>node.parent).name
|
||||
typeName: (<Declaration>node.parent.parent).name
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -877,10 +890,11 @@ module ts {
|
||||
var prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
if (node.baseType) {
|
||||
emitHeritageClause([node.baseType], /*isImplementsList*/ false);
|
||||
var baseTypeNode = getClassBaseTypeNode(node);
|
||||
if (baseTypeNode) {
|
||||
emitHeritageClause([baseTypeNode], /*isImplementsList*/ false);
|
||||
}
|
||||
emitHeritageClause(node.implementedTypes, /*isImplementsList*/ true);
|
||||
emitHeritageClause(getClassImplementedTypeNodes(node), /*isImplementsList*/ true);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
@@ -902,7 +916,7 @@ module ts {
|
||||
var prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
emitHeritageClause(node.baseTypes, /*isImplementsList*/ false);
|
||||
emitHeritageClause(getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
@@ -914,7 +928,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitPropertyDeclaration(node: PropertyDeclaration) {
|
||||
function emitPropertyDeclaration(node: Declaration) {
|
||||
emitJsDocComments(node);
|
||||
emitClassMemberDeclarationFlags(node);
|
||||
emitVariableDeclaration(<VariableDeclaration>node);
|
||||
@@ -929,14 +943,14 @@ module ts {
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If optional property emit ?
|
||||
if (node.kind === SyntaxKind.Property && (node.flags & NodeFlags.QuestionMark)) {
|
||||
if (node.kind === SyntaxKind.Property && hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
if (node.kind === SyntaxKind.Property && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
emitTypeOfVariableDeclarationFromTypeLiteral(node);
|
||||
}
|
||||
else if (!(node.flags & NodeFlags.Private)) {
|
||||
writeTypeAtLocation(node, node.type, getVariableDeclarationTypeVisibilityError);
|
||||
writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -982,7 +996,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableDeclaration) {
|
||||
function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableOrParameterDeclaration) {
|
||||
// if this is property of type literal,
|
||||
// or is parameter of method/call/construct/index signature of type literal
|
||||
// emit only if type is specified
|
||||
@@ -1030,17 +1044,17 @@ module ts {
|
||||
accessorWithTypeAnnotation = anotherAccessor;
|
||||
}
|
||||
}
|
||||
writeTypeAtLocation(node, type, getAccessorDeclarationTypeVisibilityError);
|
||||
writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function getTypeAnnotationFromAccessor(accessor: AccessorDeclaration): TypeNode {
|
||||
function getTypeAnnotationFromAccessor(accessor: AccessorDeclaration): TypeNode | StringLiteralExpression {
|
||||
if (accessor) {
|
||||
return accessor.kind === SyntaxKind.GetAccessor ?
|
||||
accessor.type : // Getter - return type
|
||||
accessor.parameters[0].type; // Setter parameter type
|
||||
return accessor.kind === SyntaxKind.GetAccessor
|
||||
? accessor.type // Getter - return type
|
||||
: accessor.parameters[0].type; // Setter parameter type
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,7 +1124,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
if (node.flags & NodeFlags.QuestionMark) {
|
||||
if (hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
}
|
||||
@@ -1238,11 +1252,11 @@ module ts {
|
||||
function emitParameterDeclaration(node: ParameterDeclaration) {
|
||||
increaseIndent();
|
||||
emitJsDocComments(node);
|
||||
if (node.flags & NodeFlags.Rest) {
|
||||
if (node.dotDotDotToken) {
|
||||
write("...");
|
||||
}
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
if (node.initializer || (node.flags & NodeFlags.QuestionMark)) {
|
||||
if (node.initializer || hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
decreaseIndent();
|
||||
@@ -1253,7 +1267,7 @@ module ts {
|
||||
emitTypeOfVariableDeclarationFromTypeLiteral(node);
|
||||
}
|
||||
else if (!(node.parent.flags & NodeFlags.Private)) {
|
||||
writeTypeAtLocation(node, node.type, getParameterDeclarationTypeVisibilityError);
|
||||
writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError);
|
||||
}
|
||||
|
||||
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
@@ -1931,12 +1945,28 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isBinaryOrOctalIntegerLiteral(text: string): boolean {
|
||||
if (text.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text.charCodeAt(1) === CharacterCodes.B || text.charCodeAt(1) === CharacterCodes.b ||
|
||||
text.charCodeAt(1) === CharacterCodes.O || text.charCodeAt(1) === CharacterCodes.o) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitLiteral(node: LiteralExpression) {
|
||||
var text = getLiteralText();
|
||||
|
||||
if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
|
||||
writer.writeLiteral(text);
|
||||
}
|
||||
// For version below ES6, emit binary integer literal and octal integer literal in canonical form
|
||||
else if (compilerOptions.target < ScriptTarget.ES6 && node.kind === SyntaxKind.NumericLiteral && isBinaryOrOctalIntegerLiteral(text)) {
|
||||
write(node.text);
|
||||
}
|
||||
else {
|
||||
write(text);
|
||||
}
|
||||
@@ -1983,7 +2013,7 @@ module ts {
|
||||
// ("abc" + 1) << (2 + "")
|
||||
// rather than
|
||||
// "abc" + (1 << 2) + ""
|
||||
var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenExpression
|
||||
var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenthesizedExpression
|
||||
&& comparePrecedenceToBinaryPlus(templateSpan.expression) !== Comparison.GreaterThan;
|
||||
|
||||
write(" + ");
|
||||
@@ -2014,8 +2044,8 @@ module ts {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
return (<CallExpression>parent).func === template;
|
||||
case SyntaxKind.ParenExpression:
|
||||
return (<CallExpression>parent).expression === template;
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return false;
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6.");
|
||||
@@ -2069,6 +2099,9 @@ module ts {
|
||||
if (node.kind === SyntaxKind.StringLiteral) {
|
||||
emitLiteral(<LiteralExpression>node);
|
||||
}
|
||||
else if (node.kind === SyntaxKind.ComputedPropertyName) {
|
||||
emit((<ComputedPropertyName>node).expression);
|
||||
}
|
||||
else {
|
||||
write("\"");
|
||||
|
||||
@@ -2109,8 +2142,8 @@ module ts {
|
||||
return false;
|
||||
case SyntaxKind.LabeledStatement:
|
||||
return (<LabeledStatement>node.parent).label === node;
|
||||
case SyntaxKind.CatchBlock:
|
||||
return (<CatchBlock>node.parent).variable === node;
|
||||
case SyntaxKind.CatchClause:
|
||||
return (<CatchClause>node.parent).name === node;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2154,7 +2187,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitArrayLiteral(node: ArrayLiteral) {
|
||||
function emitArrayLiteral(node: ArrayLiteralExpression) {
|
||||
if (node.flags & NodeFlags.MultiLine) {
|
||||
write("[");
|
||||
increaseIndent();
|
||||
@@ -2170,7 +2203,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitObjectLiteral(node: ObjectLiteral) {
|
||||
function emitObjectLiteral(node: ObjectLiteralExpression) {
|
||||
if (!node.properties.length) {
|
||||
write("{}");
|
||||
}
|
||||
@@ -2189,6 +2222,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitComputedPropertyName(node: ComputedPropertyName) {
|
||||
write("[");
|
||||
emit(node.expression);
|
||||
write("]");
|
||||
}
|
||||
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
@@ -2229,48 +2268,54 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function tryEmitConstantValue(node: PropertyAccess | IndexedAccess): boolean {
|
||||
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
|
||||
var constantValue = resolver.getConstantValue(node);
|
||||
if (constantValue !== undefined) {
|
||||
var propertyName = node.kind === SyntaxKind.PropertyAccess ? declarationNameToString((<PropertyAccess>node).right) : getTextOfNode((<IndexedAccess>node).index);
|
||||
var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
|
||||
write(constantValue.toString() + " /* " + propertyName + " */");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitPropertyAccess(node: PropertyAccess) {
|
||||
function emitPropertyAccess(node: PropertyAccessExpression) {
|
||||
if (tryEmitConstantValue(node)) {
|
||||
return;
|
||||
}
|
||||
emit(node.expression);
|
||||
write(".");
|
||||
emit(node.name);
|
||||
}
|
||||
|
||||
function emitQualifiedName(node: QualifiedName) {
|
||||
emit(node.left);
|
||||
write(".");
|
||||
emit(node.right);
|
||||
}
|
||||
|
||||
function emitIndexedAccess(node: IndexedAccess) {
|
||||
function emitIndexedAccess(node: ElementAccessExpression) {
|
||||
if (tryEmitConstantValue(node)) {
|
||||
return;
|
||||
}
|
||||
emit(node.object);
|
||||
emit(node.expression);
|
||||
write("[");
|
||||
emit(node.index);
|
||||
emit(node.argumentExpression);
|
||||
write("]");
|
||||
}
|
||||
|
||||
function emitCallExpression(node: CallExpression) {
|
||||
var superCall = false;
|
||||
if (node.func.kind === SyntaxKind.SuperKeyword) {
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
write("_super");
|
||||
superCall = true;
|
||||
}
|
||||
else {
|
||||
emit(node.func);
|
||||
superCall = node.func.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.func).left.kind === SyntaxKind.SuperKeyword;
|
||||
emit(node.expression);
|
||||
superCall = node.expression.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.expression).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
if (superCall) {
|
||||
write(".call(");
|
||||
emitThis(node.func);
|
||||
emitThis(node.expression);
|
||||
if (node.arguments.length) {
|
||||
write(", ");
|
||||
emitCommaList(node.arguments, /*includeTrailingComma*/ false);
|
||||
@@ -2286,7 +2331,7 @@ module ts {
|
||||
|
||||
function emitNewExpression(node: NewExpression) {
|
||||
write("new ");
|
||||
emit(node.func);
|
||||
emit(node.expression);
|
||||
if (node.arguments) {
|
||||
write("(");
|
||||
emitCommaList(node.arguments, /*includeTrailingComma*/ false);
|
||||
@@ -2301,14 +2346,14 @@ module ts {
|
||||
emit(node.template);
|
||||
}
|
||||
|
||||
function emitParenExpression(node: ParenExpression) {
|
||||
if (node.expression.kind === SyntaxKind.TypeAssertion) {
|
||||
var operand = (<TypeAssertion>node.expression).operand;
|
||||
function emitParenExpression(node: ParenthesizedExpression) {
|
||||
if (node.expression.kind === SyntaxKind.TypeAssertionExpression) {
|
||||
var operand = (<TypeAssertion>node.expression).expression;
|
||||
|
||||
// Make sure we consider all nested cast expressions, e.g.:
|
||||
// (<any><number><any>-A).x;
|
||||
while (operand.kind == SyntaxKind.TypeAssertion) {
|
||||
operand = (<TypeAssertion>operand).operand;
|
||||
while (operand.kind == SyntaxKind.TypeAssertionExpression) {
|
||||
operand = (<TypeAssertion>operand).expression;
|
||||
}
|
||||
|
||||
// We have an expression of the form: (<Type>SubExpr)
|
||||
@@ -2319,7 +2364,12 @@ module ts {
|
||||
// (<any>typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString()
|
||||
// new (<any>A()) should be emitted as new (A()) and not new A()
|
||||
// (<any>function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} ()
|
||||
if (operand.kind !== SyntaxKind.PrefixOperator && operand.kind !== SyntaxKind.PostfixOperator && operand.kind !== SyntaxKind.NewExpression &&
|
||||
if (operand.kind !== SyntaxKind.PrefixUnaryExpression &&
|
||||
operand.kind !== SyntaxKind.VoidExpression &&
|
||||
operand.kind !== SyntaxKind.TypeOfExpression &&
|
||||
operand.kind !== SyntaxKind.DeleteExpression &&
|
||||
operand.kind !== SyntaxKind.PostfixUnaryExpression &&
|
||||
operand.kind !== SyntaxKind.NewExpression &&
|
||||
!(operand.kind === SyntaxKind.CallExpression && node.parent.kind === SyntaxKind.NewExpression) &&
|
||||
!(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression)) {
|
||||
emit(operand);
|
||||
@@ -2331,10 +2381,26 @@ module ts {
|
||||
write(")");
|
||||
}
|
||||
|
||||
function emitUnaryExpression(node: UnaryExpression) {
|
||||
if (node.kind === SyntaxKind.PrefixOperator) {
|
||||
write(tokenToString(node.operator));
|
||||
}
|
||||
function emitDeleteExpression(node: DeleteExpression) {
|
||||
write(tokenToString(SyntaxKind.DeleteKeyword));
|
||||
write(" ");
|
||||
emit(node.expression);
|
||||
}
|
||||
|
||||
function emitVoidExpression(node: VoidExpression) {
|
||||
write(tokenToString(SyntaxKind.VoidKeyword));
|
||||
write(" ");
|
||||
emit(node.expression);
|
||||
}
|
||||
|
||||
function emitTypeOfExpression(node: TypeOfExpression) {
|
||||
write(tokenToString(SyntaxKind.TypeOfKeyword));
|
||||
write(" ");
|
||||
emit(node.expression);
|
||||
}
|
||||
|
||||
function emitPrefixUnaryExpression(node: PrefixUnaryExpression) {
|
||||
write(tokenToString(node.operator));
|
||||
// In some cases, we need to emit a space between the operator and the operand. One obvious case
|
||||
// is when the operator is an identifier, like delete or typeof. We also need to do this for plus
|
||||
// and minus expressions in certain cases. Specifically, consider the following two cases (parens
|
||||
@@ -2347,11 +2413,8 @@ module ts {
|
||||
// the resulting expression a prefix increment operation. And in the second, it will make the resulting
|
||||
// expression a prefix increment whose operand is a plus expression - (++(+x))
|
||||
// The same is true of minus of course.
|
||||
if (node.operator >= SyntaxKind.Identifier) {
|
||||
write(" ");
|
||||
}
|
||||
else if (node.kind === SyntaxKind.PrefixOperator && node.operand.kind === SyntaxKind.PrefixOperator) {
|
||||
var operand = <UnaryExpression>node.operand;
|
||||
if (node.operand.kind === SyntaxKind.PrefixUnaryExpression) {
|
||||
var operand = <PrefixUnaryExpression>node.operand;
|
||||
if (node.operator === SyntaxKind.PlusToken && (operand.operator === SyntaxKind.PlusToken || operand.operator === SyntaxKind.PlusPlusToken)) {
|
||||
write(" ");
|
||||
}
|
||||
@@ -2360,11 +2423,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
emit(node.operand);
|
||||
if (node.kind === SyntaxKind.PostfixOperator) {
|
||||
write(tokenToString(node.operator));
|
||||
}
|
||||
}
|
||||
|
||||
function emitPostfixUnaryExpression(node: PostfixUnaryExpression) {
|
||||
emit(node.operand);
|
||||
write(tokenToString(node.operator));
|
||||
}
|
||||
|
||||
|
||||
function emitBinaryExpression(node: BinaryExpression) {
|
||||
emit(node.left);
|
||||
if (node.operator !== SyntaxKind.CommaToken) write(" ");
|
||||
@@ -2560,7 +2626,7 @@ module ts {
|
||||
function emitCaseOrDefaultClause(node: CaseOrDefaultClause) {
|
||||
if (node.kind === SyntaxKind.CaseClause) {
|
||||
write("case ");
|
||||
emit(node.expression);
|
||||
emit((<CaseClause>node).expression);
|
||||
write(":");
|
||||
}
|
||||
else {
|
||||
@@ -2586,7 +2652,7 @@ module ts {
|
||||
function emitTryStatement(node: TryStatement) {
|
||||
write("try ");
|
||||
emit(node.tryBlock);
|
||||
emit(node.catchBlock);
|
||||
emit(node.catchClause);
|
||||
if (node.finallyBlock) {
|
||||
writeLine();
|
||||
write("finally ");
|
||||
@@ -2594,15 +2660,15 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitCatchBlock(node: CatchBlock) {
|
||||
function emitCatchClause(node: CatchClause) {
|
||||
writeLine();
|
||||
var endPos = emitToken(SyntaxKind.CatchKeyword, node.pos);
|
||||
write(" ");
|
||||
emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
emit(node.variable);
|
||||
emitToken(SyntaxKind.CloseParenToken, node.variable.end);
|
||||
emit(node.name);
|
||||
emitToken(SyntaxKind.CloseParenToken, node.name.end);
|
||||
write(" ");
|
||||
emitBlock(node);
|
||||
emitBlock(node.block);
|
||||
}
|
||||
|
||||
function emitDebuggerStatement(node: Node) {
|
||||
@@ -2840,7 +2906,7 @@ module ts {
|
||||
if (statement && statement.kind === SyntaxKind.ExpressionStatement) {
|
||||
var expr = (<ExpressionStatement>statement).expression;
|
||||
if (expr && expr.kind === SyntaxKind.CallExpression) {
|
||||
var func = (<CallExpression>expr).func;
|
||||
var func = (<CallExpression>expr).expression;
|
||||
if (func && func.kind === SyntaxKind.SuperKeyword) {
|
||||
return <ExpressionStatement>statement;
|
||||
}
|
||||
@@ -2866,13 +2932,15 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO(jfreeman): Account for computed property name
|
||||
function emitMemberAccess(memberName: DeclarationName) {
|
||||
function emitMemberAccessForPropertyName(memberName: DeclarationName) {
|
||||
if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) {
|
||||
write("[");
|
||||
emitNode(memberName);
|
||||
write("]");
|
||||
}
|
||||
else if (memberName.kind === SyntaxKind.ComputedPropertyName) {
|
||||
emitComputedPropertyName(<ComputedPropertyName>memberName);
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
emitNode(memberName);
|
||||
@@ -2892,7 +2960,7 @@ module ts {
|
||||
else {
|
||||
write("this");
|
||||
}
|
||||
emitMemberAccess((<PropertyDeclaration>member).name);
|
||||
emitMemberAccessForPropertyName((<PropertyDeclaration>member).name);
|
||||
emitEnd((<PropertyDeclaration>member).name);
|
||||
write(" = ");
|
||||
emit((<PropertyDeclaration>member).initializer);
|
||||
@@ -2918,7 +2986,7 @@ module ts {
|
||||
if (!(member.flags & NodeFlags.Static)) {
|
||||
write(".prototype");
|
||||
}
|
||||
emitMemberAccess((<MethodDeclaration>member).name);
|
||||
emitMemberAccessForPropertyName((<MethodDeclaration>member).name);
|
||||
emitEnd((<MethodDeclaration>member).name);
|
||||
write(" = ");
|
||||
emitStart(member);
|
||||
@@ -2984,19 +3052,20 @@ module ts {
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
write(" = (function (");
|
||||
if (node.baseType) {
|
||||
var baseTypeNode = getClassBaseTypeNode(node);
|
||||
if (baseTypeNode) {
|
||||
write("_super");
|
||||
}
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
if (node.baseType) {
|
||||
if (baseTypeNode) {
|
||||
writeLine();
|
||||
emitStart(node.baseType);
|
||||
emitStart(baseTypeNode);
|
||||
write("__extends(");
|
||||
emit(node.name);
|
||||
write(", _super);");
|
||||
emitEnd(node.baseType);
|
||||
emitEnd(baseTypeNode);
|
||||
}
|
||||
writeLine();
|
||||
emitConstructorOfClass();
|
||||
@@ -3015,8 +3084,8 @@ module ts {
|
||||
scopeEmitEnd();
|
||||
emitStart(node);
|
||||
write(")(");
|
||||
if (node.baseType) {
|
||||
emit(node.baseType.typeName);
|
||||
if (baseTypeNode) {
|
||||
emit(baseTypeNode.typeName);
|
||||
}
|
||||
write(");");
|
||||
emitEnd(node);
|
||||
@@ -3057,7 +3126,7 @@ module ts {
|
||||
if (ctor) {
|
||||
emitDefaultValueAssignments(ctor);
|
||||
emitRestParameter(ctor);
|
||||
if (node.baseType) {
|
||||
if (baseTypeNode) {
|
||||
var superCall = findInitialSuperCall(ctor);
|
||||
if (superCall) {
|
||||
writeLine();
|
||||
@@ -3067,11 +3136,11 @@ module ts {
|
||||
emitParameterPropertyAssignments(ctor);
|
||||
}
|
||||
else {
|
||||
if (node.baseType) {
|
||||
if (baseTypeNode) {
|
||||
writeLine();
|
||||
emitStart(node.baseType);
|
||||
emitStart(baseTypeNode);
|
||||
write("_super.apply(this, arguments);");
|
||||
emitEnd(node.baseType);
|
||||
emitEnd(baseTypeNode);
|
||||
}
|
||||
}
|
||||
emitMemberAssignments(node, /*nonstatic*/0);
|
||||
@@ -3178,7 +3247,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (getModuleInstanceState(node) !== ModuleInstanceState.Instantiated) {
|
||||
var shouldEmit = getModuleInstanceState(node) === ModuleInstanceState.Instantiated ||
|
||||
(getModuleInstanceState(node) === ModuleInstanceState.ConstEnumOnly && compilerOptions.preserveConstEnums);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
@@ -3206,7 +3278,7 @@ module ts {
|
||||
emit(node.body);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
var moduleBlock = <Block>getInnerMostModuleDeclarationFromDottedModule(node).body;
|
||||
var moduleBlock = <ModuleBlock>getInnerMostModuleDeclarationFromDottedModule(node).body;
|
||||
emitToken(SyntaxKind.CloseBraceToken, moduleBlock.statements.end);
|
||||
scopeEmitEnd();
|
||||
}
|
||||
@@ -3234,7 +3306,7 @@ module ts {
|
||||
}
|
||||
|
||||
if (emitImportDeclaration) {
|
||||
if (node.externalModuleName && node.parent.kind === SyntaxKind.SourceFile && compilerOptions.module === ModuleKind.AMD) {
|
||||
if (isExternalModuleImportDeclaration(node) && node.parent.kind === SyntaxKind.SourceFile && compilerOptions.module === ModuleKind.AMD) {
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
writeLine();
|
||||
emitLeadingComments(node);
|
||||
@@ -3254,15 +3326,16 @@ module ts {
|
||||
if (!(node.flags & NodeFlags.Export)) write("var ");
|
||||
emitModuleMemberName(node);
|
||||
write(" = ");
|
||||
if (node.entityName) {
|
||||
emit(node.entityName);
|
||||
if (isInternalModuleImportDeclaration(node)) {
|
||||
emit(node.moduleReference);
|
||||
}
|
||||
else {
|
||||
var literal = <LiteralExpression>getExternalModuleImportDeclarationExpression(node);
|
||||
write("require(");
|
||||
emitStart(node.externalModuleName);
|
||||
emitLiteral(node.externalModuleName);
|
||||
emitEnd(node.externalModuleName);
|
||||
emitToken(SyntaxKind.CloseParenToken, node.externalModuleName.end);
|
||||
emitStart(literal);
|
||||
emitLiteral(literal);
|
||||
emitEnd(literal);
|
||||
emitToken(SyntaxKind.CloseParenToken, literal.end);
|
||||
}
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
@@ -3273,12 +3346,9 @@ module ts {
|
||||
|
||||
function getExternalImportDeclarations(node: SourceFile): ImportDeclaration[] {
|
||||
var result: ImportDeclaration[] = [];
|
||||
forEach(node.statements, stat => {
|
||||
if (stat.kind === SyntaxKind.ImportDeclaration
|
||||
&& (<ImportDeclaration>stat).externalModuleName
|
||||
&& resolver.isReferencedImportDeclaration(<ImportDeclaration>stat)) {
|
||||
|
||||
result.push(<ImportDeclaration>stat);
|
||||
forEach(node.statements, statement => {
|
||||
if (isExternalModuleImportDeclaration(statement) && resolver.isReferencedImportDeclaration(<ImportDeclaration>statement)) {
|
||||
result.push(<ImportDeclaration>statement);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
@@ -3302,7 +3372,7 @@ module ts {
|
||||
write("[\"require\", \"exports\"");
|
||||
forEach(imports, imp => {
|
||||
write(", ");
|
||||
emitLiteral(imp.externalModuleName);
|
||||
emitLiteral(<LiteralExpression>getExternalModuleImportDeclarationExpression(imp));
|
||||
});
|
||||
forEach(node.amdDependencies, amdDependency => {
|
||||
var text = "\"" + amdDependency + "\"";
|
||||
@@ -3352,7 +3422,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitDirectivePrologues(statements: Statement[], startWithNewLine: boolean): number {
|
||||
function emitDirectivePrologues(statements: Node[], startWithNewLine: boolean): number {
|
||||
for (var i = 0; i < statements.length; ++i) {
|
||||
if (isPrologueDirective(statements[i])) {
|
||||
if (startWithNewLine || i > 0) {
|
||||
@@ -3447,34 +3517,43 @@ module ts {
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return emitTemplateSpan(<TemplateSpan>node);
|
||||
case SyntaxKind.QualifiedName:
|
||||
return emitPropertyAccess(<QualifiedName>node);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return emitArrayLiteral(<ArrayLiteral>node);
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return emitObjectLiteral(<ObjectLiteral>node);
|
||||
return emitQualifiedName(<QualifiedName>node);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return emitArrayLiteral(<ArrayLiteralExpression>node);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return emitObjectLiteral(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return emitPropertyAssignment(<PropertyDeclaration>node);
|
||||
case SyntaxKind.PropertyAccess:
|
||||
return emitPropertyAccess(<PropertyAccess>node);
|
||||
case SyntaxKind.IndexedAccess:
|
||||
return emitIndexedAccess(<IndexedAccess>node);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return emitComputedPropertyName(<ComputedPropertyName>node);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return emitPropertyAccess(<PropertyAccessExpression>node);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return emitIndexedAccess(<ElementAccessExpression>node);
|
||||
case SyntaxKind.CallExpression:
|
||||
return emitCallExpression(<CallExpression>node);
|
||||
case SyntaxKind.NewExpression:
|
||||
return emitNewExpression(<NewExpression>node);
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
return emitTaggedTemplateExpression(<TaggedTemplateExpression>node);
|
||||
case SyntaxKind.TypeAssertion:
|
||||
return emit((<TypeAssertion>node).operand);
|
||||
case SyntaxKind.ParenExpression:
|
||||
return emitParenExpression(<ParenExpression>node);
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return emit((<TypeAssertion>node).expression);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return emitParenExpression(<ParenthesizedExpression>node);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return emitFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
case SyntaxKind.PrefixOperator:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
return emitUnaryExpression(<UnaryExpression>node);
|
||||
case SyntaxKind.DeleteExpression:
|
||||
return emitDeleteExpression(<DeleteExpression>node);
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
return emitTypeOfExpression(<TypeOfExpression>node);
|
||||
case SyntaxKind.VoidExpression:
|
||||
return emitVoidExpression(<VoidExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
return emitPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
return emitPostfixUnaryExpression(<PostfixUnaryExpression>node);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return emitBinaryExpression(<BinaryExpression>node);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
@@ -3521,8 +3600,8 @@ module ts {
|
||||
return emitThrowStatement(<ThrowStatement>node);
|
||||
case SyntaxKind.TryStatement:
|
||||
return emitTryStatement(<TryStatement>node);
|
||||
case SyntaxKind.CatchBlock:
|
||||
return emitCatchBlock(<CatchBlock>node);
|
||||
case SyntaxKind.CatchClause:
|
||||
return emitCatchClause(<CatchClause>node);
|
||||
case SyntaxKind.DebuggerStatement:
|
||||
return emitDebuggerStatement(node);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
@@ -3576,7 +3655,7 @@ module ts {
|
||||
return leadingComments;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
@@ -3730,20 +3809,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
var hasSemanticErrors = resolver.hasSemanticErrors();
|
||||
var isEmitBlocked = resolver.isEmitBlocked(targetSourceFile);
|
||||
|
||||
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
|
||||
if (!isEmitBlocked) {
|
||||
emitJavaScript(jsFilePath, sourceFile);
|
||||
if (!hasSemanticErrors && compilerOptions.declaration) {
|
||||
writeDeclarationFile(jsFilePath, sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
var hasSemanticErrors: boolean = false;
|
||||
var isEmitBlocked: boolean = false;
|
||||
|
||||
if (targetSourceFile === undefined) {
|
||||
// No targetSourceFile is specified (e.g. calling emitter from batch compiler)
|
||||
hasSemanticErrors = resolver.hasSemanticErrors();
|
||||
isEmitBlocked = resolver.isEmitBlocked();
|
||||
|
||||
forEach(program.getSourceFiles(), sourceFile => {
|
||||
if (shouldEmitToOwnFile(sourceFile, compilerOptions)) {
|
||||
var jsFilePath = getOwnEmitOutputFilePath(sourceFile, program, ".js");
|
||||
@@ -3759,16 +3832,35 @@ module ts {
|
||||
// targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service)
|
||||
if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) {
|
||||
// If shouldEmitToOwnFile returns true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file
|
||||
hasSemanticErrors = resolver.hasSemanticErrors(targetSourceFile);
|
||||
isEmitBlocked = resolver.isEmitBlocked(targetSourceFile);
|
||||
|
||||
var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, program, ".js");
|
||||
emitFile(jsFilePath, targetSourceFile);
|
||||
}
|
||||
else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) {
|
||||
// Otherwise, if --out is specified and targetSourceFile is not a declaration file,
|
||||
// Emit all, non-external-module file, into one single output file
|
||||
forEach(program.getSourceFiles(), sourceFile => {
|
||||
if (!shouldEmitToOwnFile(sourceFile, compilerOptions)) {
|
||||
hasSemanticErrors = hasSemanticErrors || resolver.hasSemanticErrors(sourceFile);
|
||||
isEmitBlocked = isEmitBlocked || resolver.isEmitBlocked(sourceFile);
|
||||
}
|
||||
});
|
||||
|
||||
emitFile(compilerOptions.out);
|
||||
}
|
||||
}
|
||||
|
||||
function emitFile(jsFilePath: string, sourceFile?: SourceFile) {
|
||||
if (!isEmitBlocked) {
|
||||
emitJavaScript(jsFilePath, sourceFile);
|
||||
if (!hasSemanticErrors && compilerOptions.declaration) {
|
||||
writeDeclarationFile(jsFilePath, sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort and make the unique list of diagnostics
|
||||
diagnostics.sort(compareDiagnostics);
|
||||
diagnostics = deduplicateSortedDiagnostics(diagnostics);
|
||||
|
||||
+1437
-803
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,7 @@ module ts {
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
isUnterminated(): boolean;
|
||||
reScanGreaterToken(): SyntaxKind;
|
||||
reScanSlashToken(): SyntaxKind;
|
||||
reScanTemplateToken(): SyntaxKind;
|
||||
@@ -470,6 +471,7 @@ module ts {
|
||||
var token: SyntaxKind;
|
||||
var tokenValue: string;
|
||||
var precedingLineBreak: boolean;
|
||||
var tokenIsUnterminated: boolean;
|
||||
|
||||
function error(message: DiagnosticMessage): void {
|
||||
if (onError) {
|
||||
@@ -553,6 +555,7 @@ module ts {
|
||||
while (true) {
|
||||
if (pos >= len) {
|
||||
result += text.substring(start, pos);
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_string_literal);
|
||||
break;
|
||||
}
|
||||
@@ -570,6 +573,7 @@ module ts {
|
||||
}
|
||||
if (isLineBreak(ch)) {
|
||||
result += text.substring(start, pos);
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_string_literal);
|
||||
break;
|
||||
}
|
||||
@@ -593,6 +597,7 @@ module ts {
|
||||
while (true) {
|
||||
if (pos >= len) {
|
||||
contents += text.substring(start, pos);
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_template_literal);
|
||||
resultingToken = startedWithBacktick ? SyntaxKind.NoSubstitutionTemplateLiteral : SyntaxKind.TemplateTail;
|
||||
break;
|
||||
@@ -753,9 +758,34 @@ module ts {
|
||||
return token = SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
function scanBinaryOrOctalDigits(base: number): number {
|
||||
Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8");
|
||||
|
||||
var value = 0;
|
||||
// For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b.
|
||||
// Similarly valid octalIntegerLiteral must have at least one octal digit following o or O.
|
||||
var numberOfDigits = 0;
|
||||
while (true) {
|
||||
var ch = text.charCodeAt(pos);
|
||||
var valueOfCh = ch - CharacterCodes._0;
|
||||
if (!isDigit(ch) || valueOfCh >= base) {
|
||||
break;
|
||||
}
|
||||
value = value * base + valueOfCh;
|
||||
pos++;
|
||||
numberOfDigits++;
|
||||
}
|
||||
// Invalid binaryIntegerLiteral or octalIntegerLiteral
|
||||
if (numberOfDigits === 0) {
|
||||
return -1;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function scan(): SyntaxKind {
|
||||
startPos = pos;
|
||||
precedingLineBreak = false;
|
||||
tokenIsUnterminated = false;
|
||||
while (true) {
|
||||
tokenPos = pos;
|
||||
if (pos >= len) {
|
||||
@@ -912,6 +942,7 @@ module ts {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
tokenIsUnterminated = !commentClosed;
|
||||
return token = SyntaxKind.MultiLineCommentTrivia;
|
||||
}
|
||||
}
|
||||
@@ -933,6 +964,26 @@ module ts {
|
||||
tokenValue = "" + value;
|
||||
return token = SyntaxKind.NumericLiteral;
|
||||
}
|
||||
else if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.B || text.charCodeAt(pos + 1) === CharacterCodes.b)) {
|
||||
pos += 2;
|
||||
var value = scanBinaryOrOctalDigits(/* base */ 2);
|
||||
if (value < 0) {
|
||||
error(Diagnostics.Binary_digit_expected);
|
||||
value = 0;
|
||||
}
|
||||
tokenValue = "" + value;
|
||||
return SyntaxKind.NumericLiteral;
|
||||
}
|
||||
else if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.O || text.charCodeAt(pos + 1) === CharacterCodes.o)) {
|
||||
pos += 2;
|
||||
var value = scanBinaryOrOctalDigits(/* base */ 8);
|
||||
if (value < 0) {
|
||||
error(Diagnostics.Octal_digit_expected);
|
||||
value = 0;
|
||||
}
|
||||
tokenValue = "" + value;
|
||||
return SyntaxKind.NumericLiteral;
|
||||
}
|
||||
// Try to parse as an octal
|
||||
if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) {
|
||||
tokenValue = "" + scanOctalDigits();
|
||||
@@ -1069,12 +1120,14 @@ module ts {
|
||||
// If we reach the end of a file, or hit a newline, then this is an unterminated
|
||||
// regex. Report error and return what we have so far.
|
||||
if (p >= len) {
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_regular_expression_literal)
|
||||
break;
|
||||
}
|
||||
|
||||
var ch = text.charCodeAt(p);
|
||||
if (isLineBreak(ch)) {
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_regular_expression_literal)
|
||||
break;
|
||||
}
|
||||
@@ -1167,6 +1220,7 @@ module ts {
|
||||
hasPrecedingLineBreak: () => precedingLineBreak,
|
||||
isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord,
|
||||
isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord,
|
||||
isUnterminated: () => tokenIsUnterminated,
|
||||
reScanGreaterToken,
|
||||
reScanSlashToken,
|
||||
reScanTemplateToken,
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ module ts {
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFilename: () => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), "lib.d.ts"),
|
||||
getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"),
|
||||
writeFile,
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
|
||||
+214
-98
@@ -137,10 +137,12 @@ module ts {
|
||||
SetKeyword,
|
||||
StringKeyword,
|
||||
TypeKeyword,
|
||||
|
||||
// Parse tree nodes
|
||||
Missing,
|
||||
|
||||
// Names
|
||||
QualifiedName,
|
||||
ComputedPropertyName,
|
||||
// Signature elements
|
||||
TypeParameter,
|
||||
Parameter,
|
||||
@@ -162,29 +164,31 @@ module ts {
|
||||
ArrayType,
|
||||
TupleType,
|
||||
UnionType,
|
||||
ParenType,
|
||||
ParenthesizedType,
|
||||
// Expression
|
||||
ArrayLiteral,
|
||||
ObjectLiteral,
|
||||
PropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
PropertyAccess,
|
||||
IndexedAccess,
|
||||
ArrayLiteralExpression,
|
||||
ObjectLiteralExpression,
|
||||
PropertyAccessExpression,
|
||||
ElementAccessExpression,
|
||||
CallExpression,
|
||||
NewExpression,
|
||||
TaggedTemplateExpression,
|
||||
TypeAssertion,
|
||||
ParenExpression,
|
||||
TypeAssertionExpression,
|
||||
ParenthesizedExpression,
|
||||
FunctionExpression,
|
||||
ArrowFunction,
|
||||
PrefixOperator,
|
||||
PostfixOperator,
|
||||
DeleteExpression,
|
||||
TypeOfExpression,
|
||||
VoidExpression,
|
||||
PrefixUnaryExpression,
|
||||
PostfixUnaryExpression,
|
||||
BinaryExpression,
|
||||
ConditionalExpression,
|
||||
TemplateExpression,
|
||||
TemplateSpan,
|
||||
YieldExpression,
|
||||
OmittedExpression,
|
||||
// Misc
|
||||
TemplateSpan,
|
||||
// Element
|
||||
Block,
|
||||
VariableStatement,
|
||||
@@ -200,13 +204,10 @@ module ts {
|
||||
ReturnStatement,
|
||||
WithStatement,
|
||||
SwitchStatement,
|
||||
CaseClause,
|
||||
DefaultClause,
|
||||
LabeledStatement,
|
||||
ThrowStatement,
|
||||
TryStatement,
|
||||
TryBlock,
|
||||
CatchBlock,
|
||||
FinallyBlock,
|
||||
DebuggerStatement,
|
||||
VariableDeclaration,
|
||||
@@ -220,11 +221,25 @@ module ts {
|
||||
ModuleBlock,
|
||||
ImportDeclaration,
|
||||
ExportAssignment,
|
||||
|
||||
// Module references
|
||||
ExternalModuleReference,
|
||||
|
||||
// Clauses
|
||||
CaseClause,
|
||||
DefaultClause,
|
||||
HeritageClause,
|
||||
CatchClause,
|
||||
|
||||
// Property assignments
|
||||
PropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
// Enum
|
||||
EnumMember,
|
||||
// Top-level nodes
|
||||
SourceFile,
|
||||
Program,
|
||||
|
||||
// Synthesized list
|
||||
SyntaxList,
|
||||
// Enum value count
|
||||
@@ -239,7 +254,7 @@ module ts {
|
||||
FirstFutureReservedWord = ImplementsKeyword,
|
||||
LastFutureReservedWord = YieldKeyword,
|
||||
FirstTypeNode = TypeReference,
|
||||
LastTypeNode = ParenType,
|
||||
LastTypeNode = ParenthesizedType,
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = EndOfFileToken,
|
||||
@@ -253,14 +268,13 @@ module ts {
|
||||
FirstOperator = SemicolonToken,
|
||||
LastOperator = CaretEqualsToken,
|
||||
FirstBinaryOperator = LessThanToken,
|
||||
LastBinaryOperator = CaretEqualsToken
|
||||
LastBinaryOperator = CaretEqualsToken,
|
||||
FirstNode = QualifiedName,
|
||||
}
|
||||
|
||||
export const enum NodeFlags {
|
||||
Export = 0x00000001, // Declarations
|
||||
Ambient = 0x00000002, // Declarations
|
||||
QuestionMark = 0x00000004, // Parameter/Property/Method
|
||||
Rest = 0x00000008, // Parameter
|
||||
Public = 0x00000010, // Property/Method
|
||||
Private = 0x00000020, // Property/Method
|
||||
Protected = 0x00000040, // Property/Method
|
||||
@@ -271,8 +285,6 @@ module ts {
|
||||
Let = 0x00000800, // Variable declaration
|
||||
Const = 0x00001000, // Variable declaration
|
||||
OctalLiteral = 0x00002000,
|
||||
Generator = 0x00004000,
|
||||
YieldStar = 0x00008000,
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
@@ -307,11 +319,11 @@ module ts {
|
||||
hasTrailingComma?: boolean;
|
||||
}
|
||||
|
||||
export interface ModifiersArray extends Array<Node> {
|
||||
export interface ModifiersArray extends NodeArray<Node> {
|
||||
flags: number;
|
||||
}
|
||||
|
||||
export interface Identifier extends Node {
|
||||
export interface Identifier extends PrimaryExpression {
|
||||
text: string; // Text of identifier (with escapes converted to characters)
|
||||
}
|
||||
|
||||
@@ -332,6 +344,7 @@ module ts {
|
||||
export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName;
|
||||
|
||||
export interface Declaration extends Node {
|
||||
_declarationBrand: any;
|
||||
name?: DeclarationName;
|
||||
}
|
||||
|
||||
@@ -347,7 +360,8 @@ module ts {
|
||||
expression?: Expression;
|
||||
}
|
||||
|
||||
export interface SignatureDeclaration extends Declaration, ParsedSignature { }
|
||||
export interface SignatureDeclaration extends Declaration, ParsedSignature {
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
@@ -355,49 +369,72 @@ module ts {
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export interface PropertyDeclaration extends Declaration {
|
||||
export interface ParameterDeclaration extends Declaration {
|
||||
dotDotDotToken?: Node;
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
type?: TypeNode | StringLiteralExpression;
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export interface PropertyDeclaration extends Declaration, ClassElement {
|
||||
questionToken?: Node;
|
||||
type?: TypeNode;
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export type VariableOrParameterDeclaration = VariableDeclaration | ParameterDeclaration;
|
||||
export type VariableOrParameterOrPropertyDeclaration = VariableOrParameterDeclaration | PropertyDeclaration;
|
||||
|
||||
export interface ShorthandPropertyDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
}
|
||||
|
||||
export interface ParameterDeclaration extends VariableDeclaration { }
|
||||
|
||||
/**
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
* Examples:
|
||||
* FunctionDeclaration
|
||||
* MethodDeclaration
|
||||
* ConstructorDeclaration
|
||||
* AccessorDeclaration
|
||||
* FunctionExpression
|
||||
*/
|
||||
export interface FunctionLikeDeclaration extends Declaration, ParsedSignature {
|
||||
export interface FunctionLikeDeclaration extends SignatureDeclaration {
|
||||
_functionLikeDeclarationBrand: any;
|
||||
|
||||
asteriskToken?: Node;
|
||||
questionToken?: Node;
|
||||
body?: Block | Expression;
|
||||
}
|
||||
|
||||
export interface FunctionDeclaration extends FunctionLikeDeclaration {
|
||||
export interface FunctionDeclaration extends FunctionLikeDeclaration, Statement {
|
||||
name: Identifier;
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface MethodDeclaration extends FunctionLikeDeclaration {
|
||||
export interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface ConstructorDeclaration extends FunctionLikeDeclaration {
|
||||
export interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration {
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface TypeNode extends Node { }
|
||||
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
|
||||
_indexSignatureDeclarationBrand: any;
|
||||
}
|
||||
|
||||
export interface TypeNode extends Node {
|
||||
_typeNodeBrand: any;
|
||||
}
|
||||
|
||||
export interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
|
||||
_functionOrConstructorTypeNodeBrand: any;
|
||||
}
|
||||
|
||||
export interface TypeReferenceNode extends TypeNode {
|
||||
typeName: EntityName;
|
||||
@@ -408,7 +445,8 @@ module ts {
|
||||
exprName: EntityName;
|
||||
}
|
||||
|
||||
export interface TypeLiteralNode extends TypeNode {
|
||||
// A TypeLiteral is the declaration node for an anonymous symbol.
|
||||
export interface TypeLiteralNode extends TypeNode, Declaration {
|
||||
members: NodeArray<Node>;
|
||||
}
|
||||
|
||||
@@ -424,24 +462,66 @@ module ts {
|
||||
types: NodeArray<TypeNode>;
|
||||
}
|
||||
|
||||
export interface ParenTypeNode extends TypeNode {
|
||||
export interface ParenthesizedTypeNode extends TypeNode {
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export interface StringLiteralTypeNode extends TypeNode {
|
||||
text: string;
|
||||
}
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
// Consider 'Expression'. Without the brand, 'Expression' is actually no different
|
||||
// (structurally) than 'Node'. Because of this you can pass any Node to a function that
|
||||
// takes an Expression without any error. By using the 'brands' we ensure that the type
|
||||
// checker actually thinks you have something of the right type. Note: the brands are
|
||||
// never actually given values. At runtime they have zero cost.
|
||||
|
||||
export interface Expression extends Node {
|
||||
_expressionBrand: any;
|
||||
contextualType?: Type; // Used to temporarily assign a contextual type during overload resolution
|
||||
}
|
||||
|
||||
export interface UnaryExpression extends Expression {
|
||||
_unaryExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface PrefixUnaryExpression extends UnaryExpression {
|
||||
operator: SyntaxKind;
|
||||
operand: Expression;
|
||||
operand: UnaryExpression;
|
||||
}
|
||||
|
||||
export interface PostfixUnaryExpression extends PostfixExpression {
|
||||
operand: LeftHandSideExpression;
|
||||
operator: SyntaxKind;
|
||||
}
|
||||
|
||||
export interface PostfixExpression extends UnaryExpression {
|
||||
_postfixExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface LeftHandSideExpression extends PostfixExpression {
|
||||
_leftHandSideExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface MemberExpression extends LeftHandSideExpression {
|
||||
_memberExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface PrimaryExpression extends MemberExpression {
|
||||
_primaryExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface DeleteExpression extends UnaryExpression {
|
||||
expression: UnaryExpression;
|
||||
}
|
||||
|
||||
export interface TypeOfExpression extends UnaryExpression {
|
||||
expression: UnaryExpression;
|
||||
}
|
||||
|
||||
export interface VoidExpression extends UnaryExpression {
|
||||
expression: UnaryExpression;
|
||||
}
|
||||
|
||||
export interface YieldExpression extends Expression {
|
||||
asteriskToken?: Node;
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
@@ -457,7 +537,7 @@ module ts {
|
||||
whenFalse: Expression;
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends Expression, FunctionLikeDeclaration {
|
||||
export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
|
||||
name?: Identifier;
|
||||
body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional
|
||||
}
|
||||
@@ -465,11 +545,16 @@ module ts {
|
||||
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
|
||||
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
|
||||
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
|
||||
export interface LiteralExpression extends Expression {
|
||||
export interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
}
|
||||
|
||||
export interface TemplateExpression extends Expression {
|
||||
export interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
}
|
||||
@@ -481,49 +566,52 @@ module ts {
|
||||
literal: LiteralExpression;
|
||||
}
|
||||
|
||||
export interface ParenExpression extends Expression {
|
||||
export interface ParenthesizedExpression extends PrimaryExpression {
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface ArrayLiteral extends Expression {
|
||||
export interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
elements: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
export interface ObjectLiteral extends Expression {
|
||||
properties: NodeArray<Node>;
|
||||
|
||||
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
|
||||
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
|
||||
properties: NodeArray<Declaration>;
|
||||
}
|
||||
|
||||
export interface PropertyAccess extends Expression {
|
||||
left: Expression;
|
||||
right: Identifier;
|
||||
export interface PropertyAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
name: Identifier;
|
||||
}
|
||||
|
||||
export interface IndexedAccess extends Expression {
|
||||
object: Expression;
|
||||
index: Expression;
|
||||
export interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
argumentExpression?: Expression;
|
||||
}
|
||||
|
||||
export interface CallExpression extends Expression {
|
||||
func: Expression;
|
||||
export interface CallExpression extends LeftHandSideExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
export interface NewExpression extends CallExpression { }
|
||||
export interface NewExpression extends CallExpression, PrimaryExpression { }
|
||||
|
||||
export interface TaggedTemplateExpression extends Expression {
|
||||
tag: Expression;
|
||||
export interface TaggedTemplateExpression extends MemberExpression {
|
||||
tag: LeftHandSideExpression;
|
||||
template: LiteralExpression | TemplateExpression;
|
||||
}
|
||||
|
||||
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
|
||||
|
||||
export interface TypeAssertion extends Expression {
|
||||
export interface TypeAssertion extends UnaryExpression {
|
||||
type: TypeNode;
|
||||
operand: Expression;
|
||||
expression: UnaryExpression;
|
||||
}
|
||||
|
||||
export interface Statement extends Node { }
|
||||
export interface Statement extends Node, ModuleElement {
|
||||
_statementBrand: any;
|
||||
}
|
||||
|
||||
export interface Block extends Statement {
|
||||
statements: NodeArray<Statement>;
|
||||
@@ -586,11 +674,17 @@ module ts {
|
||||
clauses: NodeArray<CaseOrDefaultClause>;
|
||||
}
|
||||
|
||||
export interface CaseOrDefaultClause extends Node {
|
||||
export interface CaseClause extends Node {
|
||||
expression?: Expression;
|
||||
statements: NodeArray<Statement>;
|
||||
}
|
||||
|
||||
export interface DefaultClause extends Node {
|
||||
statements: NodeArray<Statement>;
|
||||
}
|
||||
|
||||
export type CaseOrDefaultClause = CaseClause | DefaultClause;
|
||||
|
||||
export interface LabeledStatement extends Statement {
|
||||
label: Identifier;
|
||||
statement: Statement;
|
||||
@@ -602,57 +696,82 @@ module ts {
|
||||
|
||||
export interface TryStatement extends Statement {
|
||||
tryBlock: Block;
|
||||
catchBlock?: CatchBlock;
|
||||
catchClause?: CatchClause;
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
|
||||
export interface CatchBlock extends Block {
|
||||
variable: Identifier;
|
||||
export interface CatchClause extends Declaration {
|
||||
name: Identifier;
|
||||
type?: TypeNode;
|
||||
block: Block;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Declaration {
|
||||
export interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
baseType?: TypeReferenceNode;
|
||||
implementedTypes?: NodeArray<TypeReferenceNode>;
|
||||
members: NodeArray<Node>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
|
||||
export interface InterfaceDeclaration extends Declaration {
|
||||
export interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
export interface InterfaceDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
baseTypes?: NodeArray<TypeReferenceNode>;
|
||||
members: NodeArray<Node>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<Declaration>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration {
|
||||
export interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export interface EnumMember extends Declaration {
|
||||
name: Identifier | LiteralExpression;
|
||||
// This does include ComputedPropertyName, but the parser will give an error
|
||||
// if it parses a ComputedPropertyName in an EnumMember
|
||||
name: DeclarationName;
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export interface EnumDeclaration extends Declaration {
|
||||
export interface EnumDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
members: NodeArray<EnumMember>;
|
||||
}
|
||||
|
||||
export interface ModuleDeclaration extends Declaration {
|
||||
export interface ModuleDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier | LiteralExpression;
|
||||
body: Block | ModuleDeclaration;
|
||||
body: ModuleBlock | ModuleDeclaration;
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends Declaration {
|
||||
export interface ModuleBlock extends Node, ModuleElement {
|
||||
statements: NodeArray<ModuleElement>
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
entityName?: EntityName;
|
||||
externalModuleName?: LiteralExpression;
|
||||
|
||||
// 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external
|
||||
// module reference.
|
||||
moduleReference: EntityName | ExternalModuleReference;
|
||||
}
|
||||
|
||||
export interface ExportAssignment extends Statement {
|
||||
export interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
|
||||
export interface ExportAssignment extends Statement, ModuleElement {
|
||||
exportName: Identifier;
|
||||
}
|
||||
|
||||
@@ -664,7 +783,10 @@ module ts {
|
||||
hasTrailingNewLine?: boolean;
|
||||
}
|
||||
|
||||
export interface SourceFile extends Block {
|
||||
// Source files are declarations when they are external modules.
|
||||
export interface SourceFile extends Declaration {
|
||||
statements: NodeArray<ModuleElement>;
|
||||
|
||||
filename: string;
|
||||
text: string;
|
||||
getLineAndCharacterFromPosition(position: number): LineAndCharacter;
|
||||
@@ -752,7 +874,6 @@ module ts {
|
||||
getIdentifierCount(): number;
|
||||
getSymbolCount(): number;
|
||||
getTypeCount(): number;
|
||||
checkProgram(): void;
|
||||
emitFiles(targetSourceFile?: SourceFile): EmitResult;
|
||||
getParentOfSymbol(symbol: Symbol): Symbol;
|
||||
getNarrowedTypeOfSymbol(symbol: Symbol, node: Node): Type;
|
||||
@@ -781,7 +902,7 @@ module ts {
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a computed value.
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
}
|
||||
|
||||
@@ -864,15 +985,15 @@ module ts {
|
||||
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
hasSemanticErrors(): boolean;
|
||||
hasSemanticErrors(sourceFile?: SourceFile): boolean;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableOrParameterDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: PropertyAccess | IndexedAccess): number;
|
||||
getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
}
|
||||
|
||||
@@ -1182,12 +1303,6 @@ module ts {
|
||||
* Early error - any error (can be produced at parsing\binding\typechecking step) that blocks emit
|
||||
*/
|
||||
isEarly?: boolean;
|
||||
/**
|
||||
* Parse error - error produced by parser when it scanner returns a token
|
||||
* that parser does not understand in its current state
|
||||
* (as opposed to grammar error when parser can interpret the token but interpretation is not legal from the grammar perespective)
|
||||
*/
|
||||
isParseError?: boolean;
|
||||
}
|
||||
|
||||
export enum DiagnosticCategory {
|
||||
@@ -1221,6 +1336,7 @@ module ts {
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
preserveConstEnums?: boolean;
|
||||
allowNonTsExtensions?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
@@ -1255,7 +1371,7 @@ module ts {
|
||||
export interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
shortName?: string; // A short pneumonic for convenience - for instance, 'h' can be used in place of 'help'.
|
||||
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'.
|
||||
description?: DiagnosticMessage; // The message describing what the command line switch does
|
||||
paramName?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter.
|
||||
error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'.
|
||||
@@ -1402,7 +1518,7 @@ module ts {
|
||||
|
||||
export interface CompilerHost {
|
||||
getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getDefaultLibFilename(): string;
|
||||
getDefaultLibFilename(options: CompilerOptions): string;
|
||||
getCancellationToken? (): CancellationToken;
|
||||
writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
getCurrentDirectory(): string;
|
||||
|
||||
@@ -113,10 +113,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
for (var i = 0; i < tcSettings.length; ++i) {
|
||||
// noImplicitAny is passed to getCompiler, but target is just passed in the settings blob to setCompilerSettings
|
||||
if (!createNewInstance && (tcSettings[i].flag == "noimplicitany" || tcSettings[i].flag === 'target')) {
|
||||
harnessCompiler = Harness.Compiler.getCompiler({
|
||||
useExistingInstance: false,
|
||||
optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: tcSettings[i].flag === "noimplicitany" }
|
||||
});
|
||||
harnessCompiler = Harness.Compiler.getCompiler();
|
||||
harnessCompiler.setCompilerSettings(tcSettings);
|
||||
createNewInstance = true;
|
||||
}
|
||||
@@ -125,10 +122,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
afterEach(() => {
|
||||
if (createNewInstance) {
|
||||
harnessCompiler = Harness.Compiler.getCompiler({
|
||||
useExistingInstance: false,
|
||||
optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false }
|
||||
});
|
||||
harnessCompiler = Harness.Compiler.getCompiler();
|
||||
createNewInstance = false;
|
||||
}
|
||||
});
|
||||
@@ -323,10 +317,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
public initializeTests() {
|
||||
describe("Setup compiler for compiler baselines", () => {
|
||||
var harnessCompiler = Harness.Compiler.getCompiler({
|
||||
useExistingInstance: false,
|
||||
optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false }
|
||||
});
|
||||
var harnessCompiler = Harness.Compiler.getCompiler();
|
||||
this.parseOptions();
|
||||
});
|
||||
|
||||
@@ -343,10 +334,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
describe("Cleanup after compiler baselines", () => {
|
||||
var harnessCompiler = Harness.Compiler.getCompiler({
|
||||
useExistingInstance: false,
|
||||
optionsForFreshInstance: { useMinimalDefaultLib: true, noImplicitAny: false }
|
||||
});
|
||||
var harnessCompiler = Harness.Compiler.getCompiler();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2217,11 +2217,10 @@ module FourSlash {
|
||||
// TODO (drosen): We need to enforce checking on these tests.
|
||||
var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js", noResolve: true }, host);
|
||||
var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true);
|
||||
checker.checkProgram();
|
||||
|
||||
var errs = program.getDiagnostics().concat(checker.getDiagnostics());
|
||||
if (errs.length > 0) {
|
||||
throw new Error('Error compiling ' + fileName + ': ' + errs.map(e => e.messageText).join('\r\n'));
|
||||
var errors = program.getDiagnostics().concat(checker.getDiagnostics());
|
||||
if (errors.length > 0) {
|
||||
throw new Error('Error compiling ' + fileName + ': ' + errors.map(e => e.messageText).join('\r\n'));
|
||||
}
|
||||
checker.emitFiles();
|
||||
result = result || ''; // Might have an empty fourslash file
|
||||
|
||||
@@ -15,10 +15,6 @@ class FourslashRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
describe("fourslash tests", () => {
|
||||
before(() => {
|
||||
Harness.Compiler.getCompiler({ useExistingInstance: false });
|
||||
});
|
||||
|
||||
this.tests.forEach((fn: string) => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
var justName = fn.replace(/^.*[\\\/]/, '');
|
||||
@@ -33,10 +29,6 @@ class FourslashRunner extends RunnerBase {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
after(() => {
|
||||
Harness.Compiler.getCompiler({ useExistingInstance: false });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Generate Tao XML', () => {
|
||||
|
||||
+29
-17
@@ -1,3 +1,4 @@
|
||||
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
@@ -538,6 +539,8 @@ module Harness {
|
||||
|
||||
export var defaultLibFileName = 'lib.d.ts';
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*version:*/ "0");
|
||||
export var defaultES6LibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*version:*/ "0");
|
||||
|
||||
|
||||
// Cache these between executions so we don't have to re-parse them for every test
|
||||
export var fourslashFilename = 'fourslash.ts';
|
||||
@@ -580,15 +583,14 @@ module Harness {
|
||||
return fourslashSourceFile;
|
||||
}
|
||||
else {
|
||||
var lib = defaultLibFileName;
|
||||
if (fn === defaultLibFileName) {
|
||||
return defaultLibSourceFile;
|
||||
return languageVersion === ts.ScriptTarget.ES6 ? defaultES6LibSourceFile : defaultLibSourceFile;
|
||||
}
|
||||
// Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
getDefaultLibFilename: () => defaultLibFileName,
|
||||
getDefaultLibFilename: options => defaultLibFileName,
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
@@ -799,7 +801,6 @@ module Harness {
|
||||
useCaseSensitiveFileNames));
|
||||
|
||||
var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true);
|
||||
checker.checkProgram();
|
||||
|
||||
var isEmitBlocked = checker.isEmitBlocked();
|
||||
|
||||
@@ -1016,19 +1017,30 @@ module Harness {
|
||||
sys.newLine + sys.newLine + outputLines.join('\r\n');
|
||||
}
|
||||
|
||||
/* TODO: Delete?
|
||||
export function makeDefaultCompilerSettings(options?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; }) {
|
||||
var useMinimalDefaultLib = options ? options.useMinimalDefaultLib : true;
|
||||
var noImplicitAny = options ? options.noImplicitAny : false;
|
||||
var settings = new TypeScript.CompilationSettings();
|
||||
settings.codeGenTarget = TypeScript.LanguageVersion.EcmaScript5;
|
||||
settings.moduleGenTarget = TypeScript.ModuleGenTarget.Synchronous;
|
||||
settings.noLib = useMinimalDefaultLib;
|
||||
settings.noResolve = false;
|
||||
settings.noImplicitAny = noImplicitAny;
|
||||
return settings;
|
||||
export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[], clean?: (s: string) => string) {
|
||||
// Collect, test, and sort the filenames
|
||||
function cleanName(fn: string) {
|
||||
var lastSlash = ts.normalizeSlashes(fn).lastIndexOf('/');
|
||||
return fn.substr(lastSlash + 1).toLowerCase();
|
||||
}
|
||||
outputFiles.sort((a, b) => cleanName(a.fileName).localeCompare(cleanName(b.fileName)));
|
||||
|
||||
// Emit them
|
||||
var result = '';
|
||||
ts.forEach(outputFiles, outputFile => {
|
||||
// Some extra spacing if this isn't the first file
|
||||
if (result.length) result = result + '\r\n\r\n';
|
||||
|
||||
// Filename header + content
|
||||
result = result + '/*====== ' + outputFile.fileName + ' ======*/\r\n';
|
||||
if (clean) {
|
||||
result = result + clean(outputFile.code);
|
||||
} else {
|
||||
result = result + outputFile.code;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
/** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a test case (i.e., describe/it) */
|
||||
var harnessCompiler: HarnessCompiler;
|
||||
@@ -1036,7 +1048,7 @@ module Harness {
|
||||
/** Returns the singleton harness compiler instance for generating and running tests.
|
||||
If required a fresh compiler instance will be created, otherwise the existing singleton will be re-used.
|
||||
*/
|
||||
export function getCompiler(opts?: { useExistingInstance: boolean; optionsForFreshInstance?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; } }) {
|
||||
export function getCompiler() {
|
||||
return harnessCompiler = harnessCompiler || new HarnessCompiler();
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class ProjectRunner extends RunnerBase {
|
||||
function getSourceFile(filename: string, languageVersion: ts.ScriptTarget): ts.SourceFile {
|
||||
var sourceFile: ts.SourceFile = undefined;
|
||||
if (filename === Harness.Compiler.defaultLibFileName) {
|
||||
sourceFile = Harness.Compiler.defaultLibSourceFile;
|
||||
sourceFile = languageVersion === ts.ScriptTarget.ES6 ? Harness.Compiler.defaultES6LibSourceFile : Harness.Compiler.defaultLibSourceFile;
|
||||
}
|
||||
else {
|
||||
var text = getSourceFileText(filename);
|
||||
@@ -186,7 +186,7 @@ class ProjectRunner extends RunnerBase {
|
||||
function createCompilerHost(): ts.CompilerHost {
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFilename: () => "lib.d.ts",
|
||||
getDefaultLibFilename: options => options.target === ts.ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts",
|
||||
writeFile,
|
||||
getCurrentDirectory,
|
||||
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path='test262Runner.ts' />
|
||||
/// <reference path='compilerRunner.ts' />
|
||||
// TODO: re-enable
|
||||
// ///<reference path='fourslashRunner.ts' />
|
||||
/// <reference path='fourslashRunner.ts' />
|
||||
/// <reference path='projectsRunner.ts' />
|
||||
/// <reference path='rwcRunner.ts' />
|
||||
|
||||
@@ -69,6 +69,9 @@ if (testConfigFile !== '') {
|
||||
case 'rwc':
|
||||
runners.push(new RWCRunner());
|
||||
break;
|
||||
case 'test262':
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
case 'reverse':
|
||||
reverse = true;
|
||||
break;
|
||||
|
||||
@@ -20,31 +20,6 @@ module RWC {
|
||||
}
|
||||
}
|
||||
|
||||
function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[], clean?: (s: string) => string) {
|
||||
// Collect, test, and sort the filenames
|
||||
function cleanName(fn: string) {
|
||||
var lastSlash = ts.normalizeSlashes(fn).lastIndexOf('/');
|
||||
return fn.substr(lastSlash + 1).toLowerCase();
|
||||
}
|
||||
outputFiles.sort((a, b) => cleanName(a.fileName).localeCompare(cleanName(b.fileName)));
|
||||
|
||||
// Emit them
|
||||
var result = '';
|
||||
ts.forEach(outputFiles, outputFile => {
|
||||
// Some extra spacing if this isn't the first file
|
||||
if (result.length) result = result + '\r\n\r\n';
|
||||
|
||||
// Filename header + content
|
||||
result = result + '/*====== ' + outputFile.fileName + ' ======*/\r\n';
|
||||
if (clean) {
|
||||
result = result + clean(outputFile.code);
|
||||
} else {
|
||||
result = result + outputFile.code;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
export function runRWCTest(jsonPath: string) {
|
||||
describe("Testing a RWC project: " + jsonPath, () => {
|
||||
var inputFiles: { unitName: string; content: string; }[] = [];
|
||||
@@ -136,7 +111,7 @@ module RWC {
|
||||
|
||||
it('has the expected emitted code', () => {
|
||||
Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => {
|
||||
return collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s));
|
||||
return Harness.Compiler.collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s));
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
@@ -145,7 +120,7 @@ module RWC {
|
||||
if (compilerResult.errors.length || !compilerResult.declFilesCode.length) {
|
||||
return null;
|
||||
}
|
||||
return collateOutputs(compilerResult.declFilesCode);
|
||||
return Harness.Compiler.collateOutputs(compilerResult.declFilesCode);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
@@ -155,7 +130,7 @@ module RWC {
|
||||
return null;
|
||||
}
|
||||
|
||||
return collateOutputs(compilerResult.sourceMaps);
|
||||
return Harness.Compiler.collateOutputs(compilerResult.sourceMaps);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/// <reference path='harness.ts' />
|
||||
/// <reference path='runnerbase.ts' />
|
||||
/// <reference path='syntacticCleaner.ts' />
|
||||
|
||||
class Test262BaselineRunner extends RunnerBase {
|
||||
private static basePath = 'tests/cases/test262';
|
||||
private static helpersFilePath = 'tests/cases/test262-harness/helpers.d.ts';
|
||||
private static helperFile = {
|
||||
unitName: Test262BaselineRunner.helpersFilePath,
|
||||
content: Harness.IO.readFile(Test262BaselineRunner.helpersFilePath)
|
||||
};
|
||||
private static testFileExtensionRegex = /\.js$/;
|
||||
private static options: ts.CompilerOptions = {
|
||||
allowNonTsExtensions: true,
|
||||
target: ts.ScriptTarget.Latest,
|
||||
module: ts.ModuleKind.CommonJS
|
||||
};
|
||||
private static baselineOptions: Harness.Baseline.BaselineOptions = { Subfolder: 'test262' };
|
||||
|
||||
private static getTestFilePath(filename: string): string {
|
||||
return Test262BaselineRunner.basePath + "/" + filename;
|
||||
}
|
||||
|
||||
private static serializeSourceFile(file: ts.SourceFile): string {
|
||||
function getKindName(k: number): string {
|
||||
return (<any>ts).SyntaxKind[k]
|
||||
}
|
||||
|
||||
function serializeNode(n: ts.Node): any {
|
||||
var o = { kind: getKindName(n.kind) };
|
||||
ts.forEach(Object.getOwnPropertyNames(n), i => {
|
||||
switch (i) {
|
||||
case "parent":
|
||||
case "symbol":
|
||||
case "locals":
|
||||
case "localSymbol":
|
||||
case "kind":
|
||||
case "semanticDiagnostics":
|
||||
case "parseDiagnostics":
|
||||
case "grammarDiagnostics":
|
||||
return undefined;
|
||||
case "nextContainer":
|
||||
if (n.nextContainer) {
|
||||
(<any>o)[i] = { kind: getKindName(n.nextContainer.kind), pos: n.nextContainer.pos, end: n.nextContainer.end };
|
||||
return undefined;
|
||||
}
|
||||
case "text":
|
||||
if (n.kind === ts.SyntaxKind.SourceFile) return undefined;
|
||||
default:
|
||||
(<any>o)[i] = ((<any>n)[i]);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
return o;
|
||||
}
|
||||
|
||||
return JSON.stringify(file,(k, v) => {
|
||||
return (v && typeof v.pos === "number") ? serializeNode(v) : v;
|
||||
}, " ");
|
||||
}
|
||||
|
||||
private runTest(filePath: string) {
|
||||
describe('test262 test for ' + filePath, () => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Everything declared here should be cleared out in the "after" callback.
|
||||
var testState: {
|
||||
filename: string;
|
||||
compilerResult: Harness.Compiler.CompilerResult;
|
||||
inputFiles: { unitName: string; content: string }[];
|
||||
checker: ts.TypeChecker;
|
||||
};
|
||||
|
||||
before(() => {
|
||||
var content = Harness.IO.readFile(filePath);
|
||||
var testFilename = ts.removeFileExtension(filePath).replace(/\//g, '_') + ".test";
|
||||
var testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, testFilename);
|
||||
|
||||
var inputFiles = testCaseContent.testUnitData.map(unit => {
|
||||
return { unitName: Test262BaselineRunner.getTestFilePath(unit.name), content: unit.content };
|
||||
});
|
||||
|
||||
// Emit the results
|
||||
testState = {
|
||||
filename: testFilename,
|
||||
inputFiles: inputFiles,
|
||||
compilerResult: undefined,
|
||||
checker: undefined,
|
||||
};
|
||||
|
||||
Harness.Compiler.getCompiler().compileFiles([Test262BaselineRunner.helperFile].concat(inputFiles), /*otherFiles*/ [], (compilerResult, checker) => {
|
||||
testState.compilerResult = compilerResult;
|
||||
testState.checker = checker;
|
||||
}, /*settingsCallback*/ undefined, Test262BaselineRunner.options);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
testState = undefined;
|
||||
});
|
||||
|
||||
it('has the expected emitted code', () => {
|
||||
Harness.Baseline.runBaseline('has the expected emitted code', testState.filename + '.output.js', () => {
|
||||
var files = testState.compilerResult.files.filter(f=> f.fileName !== Test262BaselineRunner.helpersFilePath);
|
||||
return Harness.Compiler.collateOutputs(files, s => SyntacticCleaner.clean(s));
|
||||
}, false, Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
|
||||
it('has the expected errors', () => {
|
||||
Harness.Baseline.runBaseline('has the expected errors', testState.filename + '.errors.txt', () => {
|
||||
var errors = testState.compilerResult.errors;
|
||||
if (errors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Harness.Compiler.getErrorBaseline(testState.inputFiles, errors);
|
||||
}, false, Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
|
||||
it('has the expected AST',() => {
|
||||
Harness.Baseline.runBaseline('has the expected AST', testState.filename + '.AST.txt',() => {
|
||||
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
|
||||
return Test262BaselineRunner.serializeSourceFile(sourceFile);
|
||||
}, false, Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public initializeTests() {
|
||||
// this will set up a series of describe/it blocks to run between the setup and cleanup phases
|
||||
if (this.tests.length === 0) {
|
||||
var testFiles = this.enumerateFiles(Test262BaselineRunner.basePath, Test262BaselineRunner.testFileExtensionRegex, { recursive: true });
|
||||
testFiles.forEach(fn => {
|
||||
this.runTest(ts.normalizePath(fn));
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.tests.forEach(test => this.runTest(test));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,18 +29,21 @@ class TypeWriterWalker {
|
||||
// old typeWriter baselines, suppress tokens
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
case ts.SyntaxKind.SuperKeyword:
|
||||
case ts.SyntaxKind.ArrayLiteral:
|
||||
case ts.SyntaxKind.ObjectLiteral:
|
||||
case ts.SyntaxKind.PropertyAccess:
|
||||
case ts.SyntaxKind.IndexedAccess:
|
||||
case ts.SyntaxKind.ArrayLiteralExpression:
|
||||
case ts.SyntaxKind.ObjectLiteralExpression:
|
||||
case ts.SyntaxKind.PropertyAccessExpression:
|
||||
case ts.SyntaxKind.ElementAccessExpression:
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
case ts.SyntaxKind.NewExpression:
|
||||
case ts.SyntaxKind.TypeAssertion:
|
||||
case ts.SyntaxKind.ParenExpression:
|
||||
case ts.SyntaxKind.TypeAssertionExpression:
|
||||
case ts.SyntaxKind.ParenthesizedExpression:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
case ts.SyntaxKind.ArrowFunction:
|
||||
case ts.SyntaxKind.PrefixOperator:
|
||||
case ts.SyntaxKind.PostfixOperator:
|
||||
case ts.SyntaxKind.TypeOfExpression:
|
||||
case ts.SyntaxKind.VoidExpression:
|
||||
case ts.SyntaxKind.DeleteExpression:
|
||||
case ts.SyntaxKind.PrefixUnaryExpression:
|
||||
case ts.SyntaxKind.PostfixUnaryExpression:
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
case ts.SyntaxKind.ConditionalExpression:
|
||||
this.log(node, this.getTypeOfNode(node));
|
||||
|
||||
Vendored
+64
-23
@@ -109,10 +109,7 @@ interface Object {
|
||||
propertyIsEnumerable(v: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides functionality common to all JavaScript objects.
|
||||
*/
|
||||
declare var Object: {
|
||||
interface ObjectConstructor {
|
||||
new (value?: any): Object;
|
||||
(): any;
|
||||
(value: any): any;
|
||||
@@ -206,6 +203,11 @@ declare var Object: {
|
||||
keys(o: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides functionality common to all JavaScript objects.
|
||||
*/
|
||||
declare var Object: ObjectConstructor;
|
||||
|
||||
/**
|
||||
* Creates a new function.
|
||||
*/
|
||||
@@ -240,8 +242,8 @@ interface Function {
|
||||
caller: Function;
|
||||
}
|
||||
|
||||
declare var Function: {
|
||||
/**
|
||||
interface FunctionConstructor {
|
||||
/**
|
||||
* Creates a new function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
@@ -250,6 +252,8 @@ declare var Function: {
|
||||
prototype: Function;
|
||||
}
|
||||
|
||||
declare var Function: FunctionConstructor;
|
||||
|
||||
interface IArguments {
|
||||
[index: number]: any;
|
||||
length: number;
|
||||
@@ -409,24 +413,29 @@ interface String {
|
||||
[index: number]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
||||
*/
|
||||
declare var String: {
|
||||
interface StringConstructor {
|
||||
new (value?: any): String;
|
||||
(value?: any): string;
|
||||
prototype: String;
|
||||
fromCharCode(...codes: number[]): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
||||
*/
|
||||
declare var String: StringConstructor;
|
||||
|
||||
interface Boolean {
|
||||
}
|
||||
declare var Boolean: {
|
||||
|
||||
interface BooleanConstructor {
|
||||
new (value?: any): Boolean;
|
||||
(value?: any): boolean;
|
||||
prototype: Boolean;
|
||||
}
|
||||
|
||||
declare var Boolean: BooleanConstructor;
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Returns a string representation of an object.
|
||||
@@ -453,8 +462,7 @@ interface Number {
|
||||
toPrecision(precision?: number): string;
|
||||
}
|
||||
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare var Number: {
|
||||
interface NumberConstructor {
|
||||
new (value?: any): Number;
|
||||
(value?: any): number;
|
||||
prototype: Number;
|
||||
@@ -484,6 +492,9 @@ declare var Number: {
|
||||
POSITIVE_INFINITY: number;
|
||||
}
|
||||
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare var Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
raw: string[];
|
||||
}
|
||||
@@ -753,7 +764,7 @@ interface Date {
|
||||
toJSON(key?: any): string;
|
||||
}
|
||||
|
||||
declare var Date: {
|
||||
interface DateConstructor {
|
||||
new (): Date;
|
||||
new (value: number): Date;
|
||||
new (value: string): Date;
|
||||
@@ -779,6 +790,8 @@ declare var Date: {
|
||||
now(): number;
|
||||
}
|
||||
|
||||
declare var Date: DateConstructor;
|
||||
|
||||
interface RegExpMatchArray extends Array<string> {
|
||||
index?: number;
|
||||
input?: string;
|
||||
@@ -819,9 +832,11 @@ interface RegExp {
|
||||
// Non-standard extensions
|
||||
compile(): RegExp;
|
||||
}
|
||||
declare var RegExp: {
|
||||
|
||||
interface RegExpConstructor {
|
||||
new (pattern: string, flags?: string): RegExp;
|
||||
(pattern: string, flags?: string): RegExp;
|
||||
prototype: RegExp;
|
||||
|
||||
// Non-standard extensions
|
||||
$1: string;
|
||||
@@ -836,64 +851,87 @@ declare var RegExp: {
|
||||
lastMatch: string;
|
||||
}
|
||||
|
||||
declare var RegExp: RegExpConstructor;
|
||||
|
||||
interface Error {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
declare var Error: {
|
||||
|
||||
interface ErrorConstructor {
|
||||
new (message?: string): Error;
|
||||
(message?: string): Error;
|
||||
prototype: Error;
|
||||
}
|
||||
|
||||
declare var Error: ErrorConstructor;
|
||||
|
||||
interface EvalError extends Error {
|
||||
}
|
||||
declare var EvalError: {
|
||||
|
||||
interface EvalErrorConstructor {
|
||||
new (message?: string): EvalError;
|
||||
(message?: string): EvalError;
|
||||
prototype: EvalError;
|
||||
}
|
||||
|
||||
declare var EvalError: EvalErrorConstructor;
|
||||
|
||||
interface RangeError extends Error {
|
||||
}
|
||||
declare var RangeError: {
|
||||
|
||||
interface RangeErrorConstructor {
|
||||
new (message?: string): RangeError;
|
||||
(message?: string): RangeError;
|
||||
prototype: RangeError;
|
||||
}
|
||||
|
||||
declare var RangeError: RangeErrorConstructor;
|
||||
|
||||
interface ReferenceError extends Error {
|
||||
}
|
||||
declare var ReferenceError: {
|
||||
|
||||
interface ReferenceErrorConstructor {
|
||||
new (message?: string): ReferenceError;
|
||||
(message?: string): ReferenceError;
|
||||
prototype: ReferenceError;
|
||||
}
|
||||
|
||||
declare var ReferenceError: ReferenceErrorConstructor;
|
||||
|
||||
interface SyntaxError extends Error {
|
||||
}
|
||||
declare var SyntaxError: {
|
||||
|
||||
interface SyntaxErrorConstructor {
|
||||
new (message?: string): SyntaxError;
|
||||
(message?: string): SyntaxError;
|
||||
prototype: SyntaxError;
|
||||
}
|
||||
|
||||
declare var SyntaxError: SyntaxErrorConstructor;
|
||||
|
||||
interface TypeError extends Error {
|
||||
}
|
||||
declare var TypeError: {
|
||||
|
||||
interface TypeErrorConstructor {
|
||||
new (message?: string): TypeError;
|
||||
(message?: string): TypeError;
|
||||
prototype: TypeError;
|
||||
}
|
||||
|
||||
declare var TypeError: TypeErrorConstructor;
|
||||
|
||||
interface URIError extends Error {
|
||||
}
|
||||
declare var URIError: {
|
||||
|
||||
interface URIErrorConstructor {
|
||||
new (message?: string): URIError;
|
||||
(message?: string): URIError;
|
||||
prototype: URIError;
|
||||
}
|
||||
|
||||
declare var URIError: URIErrorConstructor;
|
||||
|
||||
interface JSON {
|
||||
/**
|
||||
* Converts a JavaScript Object Notation (JSON) string into an object.
|
||||
@@ -1096,7 +1134,8 @@ interface Array<T> {
|
||||
|
||||
[n: number]: T;
|
||||
}
|
||||
declare var Array: {
|
||||
|
||||
interface ArrayConstructor {
|
||||
new (arrayLength?: number): any[];
|
||||
new <T>(arrayLength: number): T[];
|
||||
new <T>(...items: T[]): T[];
|
||||
@@ -1106,3 +1145,5 @@ declare var Array: {
|
||||
isArray(arg: any): boolean;
|
||||
prototype: Array<any>;
|
||||
}
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
Vendored
+3637
File diff suppressed because it is too large
Load Diff
Vendored
+3
-166
@@ -631,6 +631,7 @@ interface Map<K, V> {
|
||||
}
|
||||
declare var Map: {
|
||||
new <K, V>(): Map<K, V>;
|
||||
prototype: Map<any, any>;
|
||||
}
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
@@ -642,6 +643,7 @@ interface WeakMap<K, V> {
|
||||
}
|
||||
declare var WeakMap: {
|
||||
new <K, V>(): WeakMap<K, V>;
|
||||
prototype: WeakMap<any, any>;
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
@@ -654,170 +656,5 @@ interface Set<T> {
|
||||
}
|
||||
declare var Set: {
|
||||
new <T>(): Set<T>;
|
||||
prototype: Set<any>;
|
||||
}
|
||||
|
||||
declare module Intl {
|
||||
|
||||
interface CollatorOptions {
|
||||
usage?: string;
|
||||
localeMatcher?: string;
|
||||
numeric?: boolean;
|
||||
caseFirst?: string;
|
||||
sensitivity?: string;
|
||||
ignorePunctuation?: boolean;
|
||||
}
|
||||
|
||||
interface ResolvedCollatorOptions {
|
||||
locale: string;
|
||||
usage: string;
|
||||
sensitivity: string;
|
||||
ignorePunctuation: boolean;
|
||||
collation: string;
|
||||
caseFirst: string;
|
||||
numeric: boolean;
|
||||
}
|
||||
|
||||
interface Collator {
|
||||
compare(x: string, y: string): number;
|
||||
resolvedOptions(): ResolvedCollatorOptions;
|
||||
}
|
||||
var Collator: {
|
||||
new (locales?: string[], options?: CollatorOptions): Collator;
|
||||
new (locale?: string, options?: CollatorOptions): Collator;
|
||||
(locales?: string[], options?: CollatorOptions): Collator;
|
||||
(locale?: string, options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
|
||||
}
|
||||
|
||||
interface NumberFormatOptions {
|
||||
localeMatcher?: string;
|
||||
style?: string;
|
||||
currency?: string;
|
||||
currencyDisplay?: string;
|
||||
useGrouping?: boolean;
|
||||
}
|
||||
|
||||
interface ResolvedNumberFormatOptions {
|
||||
locale: string;
|
||||
numberingSystem: string;
|
||||
style: string;
|
||||
currency?: string;
|
||||
currencyDisplay?: string;
|
||||
minimumintegerDigits: number;
|
||||
minimumFractionDigits: number;
|
||||
maximumFractionDigits: number;
|
||||
minimumSignificantDigits?: number;
|
||||
maximumSignificantDigits?: number;
|
||||
useGrouping: boolean;
|
||||
}
|
||||
|
||||
interface NumberFormat {
|
||||
format(value: number): string;
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
|
||||
interface DateTimeFormatOptions {
|
||||
localeMatcher?: string;
|
||||
weekday?: string;
|
||||
era?: string;
|
||||
year?: string;
|
||||
month?: string;
|
||||
day?: string;
|
||||
hour?: string;
|
||||
minute?: string;
|
||||
second?: string;
|
||||
timeZoneName?: string;
|
||||
formatMatcher?: string;
|
||||
hour12: boolean;
|
||||
}
|
||||
|
||||
interface ResolvedDateTimeFormatOptions {
|
||||
locale: string;
|
||||
calendar: string;
|
||||
numberingSystem: string;
|
||||
timeZone: string;
|
||||
hour12?: boolean;
|
||||
weekday?: string;
|
||||
era?: string;
|
||||
year?: string;
|
||||
month?: string;
|
||||
day?: string;
|
||||
hour?: string;
|
||||
minute?: string;
|
||||
second?: string;
|
||||
timeZoneName?: string;
|
||||
}
|
||||
|
||||
interface DateTimeFormat {
|
||||
format(date: number): string;
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
|
||||
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
|
||||
}
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+168
@@ -0,0 +1,168 @@
|
||||
/////////////////////////////
|
||||
/// ECMAScript Internationalization API
|
||||
/////////////////////////////
|
||||
|
||||
declare module Intl {
|
||||
interface CollatorOptions {
|
||||
usage?: string;
|
||||
localeMatcher?: string;
|
||||
numeric?: boolean;
|
||||
caseFirst?: string;
|
||||
sensitivity?: string;
|
||||
ignorePunctuation?: boolean;
|
||||
}
|
||||
|
||||
interface ResolvedCollatorOptions {
|
||||
locale: string;
|
||||
usage: string;
|
||||
sensitivity: string;
|
||||
ignorePunctuation: boolean;
|
||||
collation: string;
|
||||
caseFirst: string;
|
||||
numeric: boolean;
|
||||
}
|
||||
|
||||
interface Collator {
|
||||
compare(x: string, y: string): number;
|
||||
resolvedOptions(): ResolvedCollatorOptions;
|
||||
}
|
||||
var Collator: {
|
||||
new (locales?: string[], options?: CollatorOptions): Collator;
|
||||
new (locale?: string, options?: CollatorOptions): Collator;
|
||||
(locales?: string[], options?: CollatorOptions): Collator;
|
||||
(locale?: string, options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
|
||||
}
|
||||
|
||||
interface NumberFormatOptions {
|
||||
localeMatcher?: string;
|
||||
style?: string;
|
||||
currency?: string;
|
||||
currencyDisplay?: string;
|
||||
useGrouping?: boolean;
|
||||
}
|
||||
|
||||
interface ResolvedNumberFormatOptions {
|
||||
locale: string;
|
||||
numberingSystem: string;
|
||||
style: string;
|
||||
currency?: string;
|
||||
currencyDisplay?: string;
|
||||
minimumintegerDigits: number;
|
||||
minimumFractionDigits: number;
|
||||
maximumFractionDigits: number;
|
||||
minimumSignificantDigits?: number;
|
||||
maximumSignificantDigits?: number;
|
||||
useGrouping: boolean;
|
||||
}
|
||||
|
||||
interface NumberFormat {
|
||||
format(value: number): string;
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
|
||||
interface DateTimeFormatOptions {
|
||||
localeMatcher?: string;
|
||||
weekday?: string;
|
||||
era?: string;
|
||||
year?: string;
|
||||
month?: string;
|
||||
day?: string;
|
||||
hour?: string;
|
||||
minute?: string;
|
||||
second?: string;
|
||||
timeZoneName?: string;
|
||||
formatMatcher?: string;
|
||||
hour12: boolean;
|
||||
}
|
||||
|
||||
interface ResolvedDateTimeFormatOptions {
|
||||
locale: string;
|
||||
calendar: string;
|
||||
numberingSystem: string;
|
||||
timeZone: string;
|
||||
hour12?: boolean;
|
||||
weekday?: string;
|
||||
era?: string;
|
||||
year?: string;
|
||||
month?: string;
|
||||
day?: string;
|
||||
hour?: string;
|
||||
minute?: string;
|
||||
second?: string;
|
||||
timeZoneName?: string;
|
||||
}
|
||||
|
||||
interface DateTimeFormat {
|
||||
format(date: number): string;
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
|
||||
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
|
||||
}
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
@@ -106,11 +106,13 @@ module ts.BreakpointResolver {
|
||||
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return spanInBlock(<Block>node);
|
||||
|
||||
case SyntaxKind.CatchClause:
|
||||
return spanInBlock((<CatchClause>node).block);
|
||||
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
// span on the expression
|
||||
return textSpan((<ExpressionStatement>node).expression);
|
||||
@@ -174,7 +176,7 @@ module ts.BreakpointResolver {
|
||||
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
// import statement without including semicolon
|
||||
return textSpan(node, (<ImportDeclaration>node).entityName || (<ImportDeclaration>node).externalModuleName);
|
||||
return textSpan(node,(<ImportDeclaration>node).moduleReference);
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
// span on complete module if it is instantiated
|
||||
@@ -242,8 +244,8 @@ module ts.BreakpointResolver {
|
||||
}
|
||||
|
||||
// Breakpoint in type assertion goes to its operand
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertion && (<TypeAssertion>node.parent).type === node) {
|
||||
return spanInNode((<TypeAssertion>node.parent).operand);
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertionExpression && (<TypeAssertion>node.parent).type === node) {
|
||||
return spanInNode((<TypeAssertion>node.parent).expression);
|
||||
}
|
||||
|
||||
// return type of function go to previous token
|
||||
@@ -297,7 +299,7 @@ module ts.BreakpointResolver {
|
||||
|
||||
function canHaveSpanInParameterDeclaration(parameter: ParameterDeclaration): boolean {
|
||||
// Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier
|
||||
return !!parameter.initializer || !!(parameter.flags & NodeFlags.Rest) ||
|
||||
return !!parameter.initializer || parameter.dotDotDotToken !== undefined ||
|
||||
!!(parameter.flags & NodeFlags.Public) || !!(parameter.flags & NodeFlags.Private);
|
||||
}
|
||||
|
||||
@@ -420,7 +422,7 @@ module ts.BreakpointResolver {
|
||||
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
return spanInNode((<Block>node.parent).statements[(<Block>node.parent).statements.length - 1]);;
|
||||
|
||||
@@ -483,8 +485,8 @@ module ts.BreakpointResolver {
|
||||
}
|
||||
|
||||
function spanInGreaterThanOrLessThanToken(node: Node): TextSpan {
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertion) {
|
||||
return spanInNode((<TypeAssertion>node.parent).operand);
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertionExpression) {
|
||||
return spanInNode((<TypeAssertion>node.parent).expression);
|
||||
}
|
||||
|
||||
return spanInNode(node.parent);
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
/////<reference path='document.ts' />
|
||||
/////<reference path='flags.ts' />
|
||||
/////<reference path='hashTable.ts' />
|
||||
/////<reference path='ast.ts' />
|
||||
/////<reference path='astHelpers.ts' />
|
||||
/////<reference path='astWalker.ts' />
|
||||
/////<reference path='base64.ts' />
|
||||
/////<reference path='sourceMapping.ts' />
|
||||
/////<reference path='emitter.ts' />
|
||||
|
||||
+12
-14
@@ -155,10 +155,11 @@ module ts.formatting {
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return rangeContainsRange((<Block>parent).statements, node)
|
||||
return rangeContainsRange((<Block>parent).statements, node);
|
||||
case SyntaxKind.CatchClause:
|
||||
return rangeContainsRange((<CatchClause>parent).block.statements, node);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -192,7 +193,7 @@ module ts.formatting {
|
||||
|
||||
// pick only errors that fall in range
|
||||
var sorted = errors
|
||||
.filter(d => d.isParseError && rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length))
|
||||
.filter(d => rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length))
|
||||
.sort((e1, e2) => e1.start - e2.start);
|
||||
|
||||
if (!sorted.length) {
|
||||
@@ -252,7 +253,7 @@ module ts.formatting {
|
||||
rulesProvider: RulesProvider,
|
||||
requestKind: FormattingRequestKind): TextChange[] {
|
||||
|
||||
var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.getSyntacticDiagnostics(), originalRange);
|
||||
var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange);
|
||||
|
||||
// formatting context is used by rules provider
|
||||
var formattingContext = new FormattingContext(sourceFile, requestKind);
|
||||
@@ -483,8 +484,8 @@ module ts.formatting {
|
||||
if (!rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) {
|
||||
return inheritedIndentation;
|
||||
}
|
||||
|
||||
if (child.kind === SyntaxKind.Missing) {
|
||||
|
||||
if (child.getFullWidth() === 0) {
|
||||
return inheritedIndentation;
|
||||
}
|
||||
|
||||
@@ -505,7 +506,7 @@ module ts.formatting {
|
||||
|
||||
if (isToken(child)) {
|
||||
// if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules
|
||||
var tokenInfo = formattingScanner.readTokenInfo(node);
|
||||
var tokenInfo = formattingScanner.readTokenInfo(child);
|
||||
Debug.assert(tokenInfo.token.end === child.end);
|
||||
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
|
||||
return inheritedIndentation;
|
||||
@@ -701,25 +702,23 @@ module ts.formatting {
|
||||
applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
|
||||
|
||||
if (rule.Operation.Action & (RuleAction.Space | RuleAction.Delete) && currentStartLine !== previousStartLine) {
|
||||
lineAdded = false;
|
||||
// Handle the case where the next line is moved to be the end of this line.
|
||||
// In this case we don't indent the next line in the next pass.
|
||||
if (currentParent.getStart(sourceFile) === currentItem.pos) {
|
||||
lineAdded = false;
|
||||
dynamicIndentation.recomputeIndentation(/*lineAdded*/ false);
|
||||
}
|
||||
}
|
||||
else if (rule.Operation.Action & RuleAction.NewLine && currentStartLine === previousStartLine) {
|
||||
lineAdded = true;
|
||||
// Handle the case where token2 is moved to the new line.
|
||||
// In this case we indent token2 in the next pass but we set
|
||||
// sameLineIndent flag to notify the indenter that the indentation is within the line.
|
||||
if (currentParent.getStart(sourceFile) === currentItem.pos) {
|
||||
lineAdded = true;
|
||||
dynamicIndentation.recomputeIndentation(/*lineAdded*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
if (lineAdded !== undefined) {
|
||||
dynamicIndentation.recomputeIndentation(lineAdded);
|
||||
}
|
||||
|
||||
// We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line
|
||||
trimTrailingWhitespaces =
|
||||
(rule.Operation.Action & (RuleAction.NewLine | RuleAction.Space)) &&
|
||||
@@ -900,7 +899,6 @@ module ts.formatting {
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return true;
|
||||
|
||||
@@ -114,7 +114,8 @@ module ts.formatting {
|
||||
}
|
||||
|
||||
function shouldRescanTemplateToken(container: Node): boolean {
|
||||
return container.kind === SyntaxKind.TemplateSpan;
|
||||
return container.kind === SyntaxKind.TemplateMiddle ||
|
||||
container.kind === SyntaxKind.TemplateTail;
|
||||
}
|
||||
|
||||
function startsWithSlashToken(t: SyntaxKind): boolean {
|
||||
@@ -145,7 +146,11 @@ module ts.formatting {
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
// No need to re-scan text, return existing 'lastTokenInfo'
|
||||
return lastTokenInfo;
|
||||
// it is ok to call fixTokenKind here since it does not affect
|
||||
// what portion of text is consumed. In opposize rescanning can change it,
|
||||
// i.e. for '>=' when originally scanner eats just one character
|
||||
// and rescanning forces it to consume more.
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
|
||||
if (scanner.getStartPos() !== savedPos) {
|
||||
@@ -206,11 +211,13 @@ module ts.formatting {
|
||||
}
|
||||
}
|
||||
|
||||
return lastTokenInfo = {
|
||||
lastTokenInfo = {
|
||||
leadingTrivia: leadingTrivia,
|
||||
trailingTrivia: trailingTrivia,
|
||||
token: token
|
||||
}
|
||||
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
|
||||
function isOnToken(): boolean {
|
||||
@@ -218,5 +225,16 @@ module ts.formatting {
|
||||
var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos();
|
||||
return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current);
|
||||
}
|
||||
|
||||
// when containing node in the tree is token
|
||||
// but its kind differs from the kind that was returned by the scanner,
|
||||
// then kind needs to be fixed. This might happen in cases
|
||||
// when parser interprets token differently, i.e keyword treated as identifier
|
||||
function fixTokenKind(tokenInfo: TokenInfo, container: Node): TokenInfo {
|
||||
if (isToken(container) && tokenInfo.token.kind !== container.kind) {
|
||||
tokenInfo.token.kind = container.kind;
|
||||
}
|
||||
return tokenInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,9 +523,8 @@ module ts.formatting {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
@@ -581,7 +580,7 @@ module ts.formatting {
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
@@ -603,7 +602,7 @@ module ts.formatting {
|
||||
case SyntaxKind.WithStatement:
|
||||
// TODO
|
||||
// case SyntaxKind.ElseClause:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
return true;
|
||||
|
||||
@@ -613,7 +612,7 @@ module ts.formatting {
|
||||
}
|
||||
|
||||
static IsObjectContext(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.ObjectLiteral;
|
||||
return context.contextNode.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
}
|
||||
|
||||
static IsFunctionCallContext(context: FormattingContext): boolean {
|
||||
@@ -673,7 +672,7 @@ module ts.formatting {
|
||||
}
|
||||
|
||||
static IsVoidOpContext(context: FormattingContext): boolean {
|
||||
return context.currentTokenSpan.kind === SyntaxKind.VoidKeyword && context.currentTokenParent.kind === SyntaxKind.PrefixOperator;
|
||||
return context.currentTokenSpan.kind === SyntaxKind.VoidKeyword && context.currentTokenParent.kind === SyntaxKind.VoidExpression;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,9 +377,10 @@ module ts.NavigationBar {
|
||||
// Add the constructor parameters in as children of the class (for property parameters).
|
||||
// Note that *all* parameters will be added to the nodes array, but parameters that
|
||||
// are not properties will be filtered out later by createChildItem.
|
||||
var nodes: Node[] = constructor
|
||||
? node.members.concat(constructor.parameters)
|
||||
: node.members;
|
||||
var nodes: Node[] = removeComputedProperties(node);
|
||||
if (constructor) {
|
||||
nodes.push.apply(nodes, constructor.parameters);
|
||||
}
|
||||
|
||||
var childItems = getItemsWorker(sortNodes(nodes), createChildItem);
|
||||
}
|
||||
@@ -394,7 +395,7 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createEnumItem(node: EnumDeclaration): ts.NavigationBarItem {
|
||||
var childItems = getItemsWorker(sortNodes(node.members), createChildItem);
|
||||
var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem);
|
||||
return getNavigationBarItem(
|
||||
node.name.text,
|
||||
ts.ScriptElementKind.enumElement,
|
||||
@@ -405,7 +406,7 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem {
|
||||
var childItems = getItemsWorker(sortNodes(node.members), createChildItem);
|
||||
var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem);
|
||||
return getNavigationBarItem(
|
||||
node.name.text,
|
||||
ts.ScriptElementKind.interfaceElement,
|
||||
@@ -416,6 +417,10 @@ module ts.NavigationBar {
|
||||
}
|
||||
}
|
||||
|
||||
function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] {
|
||||
return filter<Declaration>(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName);
|
||||
}
|
||||
|
||||
function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration {
|
||||
while (node.body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
|
||||
@@ -79,7 +79,8 @@ module ts {
|
||||
parent.kind === SyntaxKind.ForStatement ||
|
||||
parent.kind === SyntaxKind.IfStatement ||
|
||||
parent.kind === SyntaxKind.WhileStatement ||
|
||||
parent.kind === SyntaxKind.WithStatement) {
|
||||
parent.kind === SyntaxKind.WithStatement ||
|
||||
parent.kind === SyntaxKind.CatchClause) {
|
||||
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
}
|
||||
@@ -100,7 +101,6 @@ module ts {
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
@@ -109,13 +109,13 @@ module ts {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
var openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile);
|
||||
var closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
|
||||
|
||||
@@ -20,7 +20,7 @@ module TypeScript {
|
||||
Parameter_cannot_have_question_mark_and_initializer: "Parameter cannot have question mark and initializer.",
|
||||
A_required_parameter_cannot_follow_an_optional_parameter: "A required parameter cannot follow an optional parameter.",
|
||||
Index_signatures_cannot_have_rest_parameters: "Index signatures cannot have rest parameters.",
|
||||
Index_signature_parameter_cannot_have_accessibility_modifiers: "Index signature parameter cannot have accessibility modifiers.",
|
||||
Index_signature_parameter_cannot_have_modifiers: "Index signature parameter cannot have modifiers.",
|
||||
Index_signature_parameter_cannot_have_a_question_mark: "Index signature parameter cannot have a question mark.",
|
||||
Index_signature_parameter_cannot_have_an_initializer: "Index signature parameter cannot have an initializer.",
|
||||
Index_signature_must_have_a_type_annotation: "Index signature must have a type annotation.",
|
||||
@@ -99,6 +99,11 @@ module TypeScript {
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: "'yield' expression must be contained within a generator declaration.",
|
||||
Unterminated_regular_expression_literal: "Unterminated regular expression literal.",
|
||||
Unterminated_template_literal: "Unterminated template literal.",
|
||||
await_expression_must_be_contained_within_an_async_declaration: "'await' expression must be contained within an async declaration.",
|
||||
async_arrow_function_parameters_must_be_parenthesized: "'async' arrow function parameters must be parenthesized.",
|
||||
A_generator_declaration_cannot_have_the_async_modifier: "A generator declaration cannot have the 'async' modifier.",
|
||||
async_modifier_cannot_appear_here: "'async' modifier cannot appear here.",
|
||||
comma_expression_cannot_appear_in_a_computed_property_name: "'comma' expression cannot appear in a computed property name.",
|
||||
Duplicate_identifier_0: "Duplicate identifier '{0}'.",
|
||||
The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.",
|
||||
The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.",
|
||||
|
||||
@@ -22,7 +22,7 @@ module TypeScript {
|
||||
"Parameter cannot have question mark and initializer.": { "code": 1015, "category": DiagnosticCategory.Error },
|
||||
"A required parameter cannot follow an optional parameter.": { "code": 1016, "category": DiagnosticCategory.Error },
|
||||
"Index signatures cannot have rest parameters.": { "code": 1017, "category": DiagnosticCategory.Error },
|
||||
"Index signature parameter cannot have accessibility modifiers.": { "code": 1018, "category": DiagnosticCategory.Error },
|
||||
"Index signature parameter cannot have modifiers.": { "code": 1018, "category": DiagnosticCategory.Error },
|
||||
"Index signature parameter cannot have a question mark.": { "code": 1019, "category": DiagnosticCategory.Error },
|
||||
"Index signature parameter cannot have an initializer.": { "code": 1020, "category": DiagnosticCategory.Error },
|
||||
"Index signature must have a type annotation.": { "code": 1021, "category": DiagnosticCategory.Error },
|
||||
@@ -101,6 +101,11 @@ module TypeScript {
|
||||
"'yield' expression must be contained within a generator declaration.": { "code": 1113, "category": DiagnosticCategory.Error },
|
||||
"Unterminated regular expression literal.": { "code": 1114, "category": DiagnosticCategory.Error },
|
||||
"Unterminated template literal.": { "code": 1115, "category": DiagnosticCategory.Error },
|
||||
"'await' expression must be contained within an 'async' declaration.": { "code": 1116, "category": DiagnosticCategory.Error },
|
||||
"'async' arrow function parameters must be parenthesized.": { "code": 1117, "category": DiagnosticCategory.Error },
|
||||
"A generator declaration cannot have the 'async' modifier.": { "code": 1118, "category": DiagnosticCategory.Error },
|
||||
"'async' modifier cannot appear here.": { "code": 1119, "category": DiagnosticCategory.Error },
|
||||
"'comma' expression cannot appear in a computed property name.": { "code": 1120, "category": DiagnosticCategory.Error },
|
||||
"Duplicate identifier '{0}'.": { "code": 2000, "category": DiagnosticCategory.Error },
|
||||
"The name '{0}' does not exist in the current scope.": { "code": 2001, "category": DiagnosticCategory.Error },
|
||||
"The name '{0}' does not refer to a value.": { "code": 2002, "category": DiagnosticCategory.Error },
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
"category": "Error",
|
||||
"code": 1017
|
||||
},
|
||||
"Index signature parameter cannot have accessibility modifiers.": {
|
||||
"Index signature parameter cannot have modifiers.": {
|
||||
"category": "Error",
|
||||
"code": 1018
|
||||
},
|
||||
@@ -391,6 +391,26 @@
|
||||
"category": "Error",
|
||||
"code": 1115
|
||||
},
|
||||
"'await' expression must be contained within an 'async' declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1116
|
||||
},
|
||||
"'async' arrow function parameters must be parenthesized.": {
|
||||
"category": "Error",
|
||||
"code": 1117
|
||||
},
|
||||
"A generator declaration cannot have the 'async' modifier.": {
|
||||
"category": "Error",
|
||||
"code": 1118
|
||||
},
|
||||
"'async' modifier cannot appear here.": {
|
||||
"category": "Error",
|
||||
"code": 1119
|
||||
},
|
||||
"'comma' expression cannot appear in a computed property name.": {
|
||||
"category": "Error",
|
||||
"code": 1120
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2000
|
||||
|
||||
+185
-136
@@ -218,7 +218,7 @@ module ts {
|
||||
}
|
||||
|
||||
private createChildren(sourceFile?: SourceFile) {
|
||||
if (this.kind > SyntaxKind.Missing) {
|
||||
if (this.kind >= SyntaxKind.FirstNode) {
|
||||
scanner.setText((sourceFile || this.getSourceFile()).text);
|
||||
var children: Node[] = [];
|
||||
var pos = this.pos;
|
||||
@@ -264,8 +264,11 @@ module ts {
|
||||
var children = this.getChildren();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if (child.kind < SyntaxKind.Missing) return child;
|
||||
if (child.kind > SyntaxKind.Missing) return child.getFirstToken(sourceFile);
|
||||
if (child.kind < SyntaxKind.FirstNode) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return child.getFirstToken(sourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,8 +276,11 @@ module ts {
|
||||
var children = this.getChildren(sourceFile);
|
||||
for (var i = children.length - 1; i >= 0; i--) {
|
||||
var child = children[i];
|
||||
if (child.kind < SyntaxKind.Missing) return child;
|
||||
if (child.kind > SyntaxKind.Missing) return child.getLastToken(sourceFile);
|
||||
if (child.kind < SyntaxKind.FirstNode) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return child.getLastToken(sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +355,7 @@ module ts {
|
||||
|
||||
// If this is dotted module name, get the doc comments from the parent
|
||||
while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) {
|
||||
declaration = declaration.parent;
|
||||
declaration = <ModuleDeclaration>declaration.parent;
|
||||
}
|
||||
|
||||
// Get the cleaned js doc comment text from the declaration
|
||||
@@ -712,6 +718,7 @@ module ts {
|
||||
}
|
||||
|
||||
class SourceFileObject extends NodeObject implements SourceFile {
|
||||
public _declarationBrand: any;
|
||||
public filename: string;
|
||||
public text: string;
|
||||
|
||||
@@ -757,7 +764,7 @@ module ts {
|
||||
case SyntaxKind.Method:
|
||||
var functionDeclaration = <FunctionLikeDeclaration>node;
|
||||
|
||||
if (functionDeclaration.name && functionDeclaration.name.kind !== SyntaxKind.Missing) {
|
||||
if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) {
|
||||
var lastDeclaration = namedDeclarations.length > 0 ?
|
||||
namedDeclarations[namedDeclarations.length - 1] :
|
||||
undefined;
|
||||
@@ -771,7 +778,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
namedDeclarations.push(node);
|
||||
namedDeclarations.push(functionDeclaration);
|
||||
}
|
||||
|
||||
forEachChild(node, visit);
|
||||
@@ -862,7 +869,7 @@ module ts {
|
||||
getLocalizedDiagnosticMessages(): any;
|
||||
getCancellationToken(): CancellationToken;
|
||||
getCurrentDirectory(): string;
|
||||
getDefaultLibFilename(): string;
|
||||
getDefaultLibFilename(options: CompilerOptions): string;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1927,21 +1934,21 @@ module ts {
|
||||
}
|
||||
|
||||
function isRightSideOfPropertyAccess(node: Node) {
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).right === node;
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node;
|
||||
}
|
||||
|
||||
function isCallExpressionTarget(node: Node): boolean {
|
||||
if (isRightSideOfPropertyAccess(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).func === node;
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).expression === node;
|
||||
}
|
||||
|
||||
function isNewExpressionTarget(node: Node): boolean {
|
||||
if (isRightSideOfPropertyAccess(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.NewExpression && (<CallExpression>node.parent).func === node;
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.NewExpression && (<CallExpression>node.parent).expression === node;
|
||||
}
|
||||
|
||||
function isNameOfModuleDeclaration(node: Node) {
|
||||
@@ -1970,8 +1977,8 @@ module ts {
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return (<Declaration>node.parent).name === node;
|
||||
case SyntaxKind.IndexedAccess:
|
||||
return (<IndexedAccess>node.parent).index === node;
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return (<ElementAccessExpression>node.parent).argumentExpression === node;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1979,9 +1986,12 @@ module ts {
|
||||
}
|
||||
|
||||
function isNameOfExternalModuleImportOrDeclaration(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.StringLiteral &&
|
||||
(isNameOfModuleDeclaration(node) ||
|
||||
(node.parent.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node.parent).externalModuleName === node));
|
||||
if (node.kind === SyntaxKind.StringLiteral) {
|
||||
return isNameOfModuleDeclaration(node) ||
|
||||
(isExternalModuleImportDeclaration(node.parent.parent) && getExternalModuleImportDeclarationExpression(node.parent.parent) === node);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns true if the position is within a comment */
|
||||
@@ -2097,8 +2107,8 @@ module ts {
|
||||
getCanonicalFileName: (filename) => useCaseSensitivefilenames ? filename : filename.toLowerCase(),
|
||||
useCaseSensitiveFileNames: () => useCaseSensitivefilenames,
|
||||
getNewLine: () => "\r\n",
|
||||
getDefaultLibFilename: (): string => {
|
||||
return host.getDefaultLibFilename();
|
||||
getDefaultLibFilename: (options): string => {
|
||||
return host.getDefaultLibFilename(options);
|
||||
},
|
||||
writeFile: (filename, data, writeByteOrderMark) => {
|
||||
writer(filename, data, writeByteOrderMark);
|
||||
@@ -2243,7 +2253,7 @@ module ts {
|
||||
|
||||
filename = normalizeSlashes(filename);
|
||||
|
||||
return program.getDiagnostics(getSourceFile(filename).getSourceFile());
|
||||
return program.getDiagnostics(getSourceFile(filename));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2373,9 +2383,12 @@ module ts {
|
||||
// other wise, it is a request for all visible symbols in the scope, and the node is the current location
|
||||
var node: Node;
|
||||
var isRightOfDot: boolean;
|
||||
if (previousToken && previousToken.kind === SyntaxKind.DotToken &&
|
||||
(previousToken.parent.kind === SyntaxKind.PropertyAccess || previousToken.parent.kind === SyntaxKind.QualifiedName)) {
|
||||
node = (<PropertyAccess>previousToken.parent).left;
|
||||
if (previousToken && previousToken.kind === SyntaxKind.DotToken && previousToken.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
node = (<PropertyAccessExpression>previousToken.parent).expression;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else if (previousToken && previousToken.kind === SyntaxKind.DotToken && previousToken.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = (<QualifiedName>previousToken.parent).left;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else {
|
||||
@@ -2401,7 +2414,7 @@ module ts {
|
||||
var symbols: Symbol[] = [];
|
||||
isMemberCompletion = true;
|
||||
|
||||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccess) {
|
||||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
var symbol = typeInfoResolver.getSymbolInfo(node);
|
||||
|
||||
// This is an alias, follow what it aliases
|
||||
@@ -2412,7 +2425,7 @@ module ts {
|
||||
if (symbol && symbol.flags & SymbolFlags.HasExports) {
|
||||
// Extract module or enum members
|
||||
forEachValue(symbol.exports, symbol => {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccess>(node.parent), symbol.name)) {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
});
|
||||
@@ -2423,7 +2436,7 @@ module ts {
|
||||
if (type) {
|
||||
// Filter private properties
|
||||
forEach(type.getApparentProperties(), symbol => {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccess>(node.parent), symbol.name)) {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
});
|
||||
@@ -2497,10 +2510,11 @@ module ts {
|
||||
}
|
||||
|
||||
function isInStringOrRegularExpressionOrTemplateLiteral(previousToken: Node): boolean {
|
||||
if (previousToken.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(previousToken.kind)) {
|
||||
if (previousToken.kind === SyntaxKind.StringLiteral
|
||||
|| previousToken.kind === SyntaxKind.RegularExpressionLiteral
|
||||
|| isTemplateLiteralKind(previousToken.kind)) {
|
||||
// The position has to be either: 1. entirely within the token text, or
|
||||
// 2. at the end position, and the string literal is not terminated
|
||||
|
||||
// 2. at the end position of an unterminated token.
|
||||
var start = previousToken.getStart();
|
||||
var end = previousToken.getEnd();
|
||||
|
||||
@@ -2508,41 +2522,14 @@ module ts {
|
||||
return true;
|
||||
}
|
||||
else if (position === end) {
|
||||
var width = end - start;
|
||||
var text = previousToken.getSourceFile().text;
|
||||
|
||||
// If the token is a single character, or its second-to-last charcter indicates an escape code,
|
||||
// then we can immediately say that we are in the middle of an unclosed string.
|
||||
if (width <= 1 || text.charCodeAt(end - 2) === CharacterCodes.backslash) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Now check if the last character is a closing character for the token.
|
||||
switch (previousToken.kind) {
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
return text.charCodeAt(start) !== text.charCodeAt(end - 1);
|
||||
|
||||
case SyntaxKind.TemplateHead:
|
||||
case SyntaxKind.TemplateMiddle:
|
||||
return text.charCodeAt(end - 1) !== CharacterCodes.openBrace
|
||||
|| text.charCodeAt(end - 2) !== CharacterCodes.$;
|
||||
|
||||
case SyntaxKind.TemplateTail:
|
||||
return text.charCodeAt(end - 1) !== CharacterCodes.backtick;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !!(<LiteralExpression>previousToken).isUnterminated;
|
||||
}
|
||||
}
|
||||
else if (previousToken.kind === SyntaxKind.RegularExpressionLiteral) {
|
||||
return previousToken.getStart() < position && position < previousToken.getEnd();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getContainingObjectLiteralApplicableForCompletion(previousToken: Node): ObjectLiteral {
|
||||
function getContainingObjectLiteralApplicableForCompletion(previousToken: Node): ObjectLiteralExpression {
|
||||
// The locations in an object literal expression that are applicable for completion are property name definition locations.
|
||||
|
||||
if (previousToken) {
|
||||
@@ -2551,8 +2538,8 @@ module ts {
|
||||
switch (previousToken.kind) {
|
||||
case SyntaxKind.OpenBraceToken: // var x = { |
|
||||
case SyntaxKind.CommaToken: // var x = { a: 0, |
|
||||
if (parent && parent.kind === SyntaxKind.ObjectLiteral) {
|
||||
return <ObjectLiteral>parent;
|
||||
if (parent && parent.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
return <ObjectLiteralExpression>parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2589,7 +2576,7 @@ module ts {
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CatchBlock ||
|
||||
return containingNodeKind === SyntaxKind.CatchClause ||
|
||||
isFunction(containingNodeKind);
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
@@ -2878,10 +2865,10 @@ module ts {
|
||||
|
||||
var type = typeResolver.getNarrowedTypeOfSymbol(symbol, location);
|
||||
if (type) {
|
||||
if (location.parent && location.parent.kind === SyntaxKind.PropertyAccess) {
|
||||
var right = (<PropertyAccess>location.parent).right;
|
||||
if (location.parent && location.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
var right = (<PropertyAccessExpression>location.parent).name;
|
||||
// Either the location is on the right of a property access, or on the left and the right is missing
|
||||
if (right === location || (right && right.kind === SyntaxKind.Missing)){
|
||||
if (right === location || (right && right.getFullWidth() === 0)){
|
||||
location = location.parent;
|
||||
}
|
||||
}
|
||||
@@ -2903,7 +2890,7 @@ module ts {
|
||||
signature = candidateSignatures[0];
|
||||
}
|
||||
|
||||
var useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.func.kind === SyntaxKind.SuperKeyword;
|
||||
var useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.expression.kind === SyntaxKind.SuperKeyword;
|
||||
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
|
||||
|
||||
if (!contains(allSignatures, signature.target || signature)) {
|
||||
@@ -3076,17 +3063,17 @@ module ts {
|
||||
ts.forEach(symbol.declarations, declaration => {
|
||||
if (declaration.kind === SyntaxKind.ImportDeclaration) {
|
||||
var importDeclaration = <ImportDeclaration>declaration;
|
||||
if (importDeclaration.externalModuleName) {
|
||||
if (isExternalModuleImportDeclaration(importDeclaration)) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(keywordPart(SyntaxKind.RequireKeyword));
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(displayPart(getTextOfNode(importDeclaration.externalModuleName), SymbolDisplayPartKind.stringLiteral));
|
||||
displayParts.push(displayPart(getTextOfNode(getExternalModuleImportDeclarationExpression(importDeclaration)), SymbolDisplayPartKind.stringLiteral));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
}
|
||||
else {
|
||||
var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.entityName);
|
||||
var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.moduleReference);
|
||||
if (internalAliasSymbol) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
@@ -3201,7 +3188,7 @@ module ts {
|
||||
// Try getting just type at this position and show
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
@@ -3446,6 +3433,11 @@ module ts {
|
||||
if (hasKind(node.parent, SyntaxKind.GetAccessor) || hasKind(node.parent, SyntaxKind.SetAccessor)) {
|
||||
return getGetAndSetOccurrences(<AccessorDeclaration>node.parent);
|
||||
}
|
||||
default:
|
||||
if (isModifier(node.kind) && node.parent &&
|
||||
(isDeclaration(node.parent) || node.parent.kind === SyntaxKind.VariableStatement)) {
|
||||
return getModifierOccurrences(node.kind, node.parent);
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -3575,8 +3567,8 @@ module ts {
|
||||
else if (node.kind === SyntaxKind.TryStatement) {
|
||||
var tryStatement = <TryStatement>node;
|
||||
|
||||
if (tryStatement.catchBlock) {
|
||||
aggregate(tryStatement.catchBlock);
|
||||
if (tryStatement.catchClause) {
|
||||
aggregate(tryStatement.catchClause);
|
||||
}
|
||||
else {
|
||||
// Exceptions thrown within a try block lacking a catch clause
|
||||
@@ -3615,7 +3607,7 @@ module ts {
|
||||
if (parent.kind === SyntaxKind.TryStatement) {
|
||||
var tryStatement = <TryStatement>parent;
|
||||
|
||||
if (tryStatement.tryBlock === child && tryStatement.catchBlock) {
|
||||
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
@@ -3631,8 +3623,8 @@ module ts {
|
||||
|
||||
pushKeywordIf(keywords, tryStatement.getFirstToken(), SyntaxKind.TryKeyword);
|
||||
|
||||
if (tryStatement.catchBlock) {
|
||||
pushKeywordIf(keywords, tryStatement.catchBlock.getFirstToken(), SyntaxKind.CatchKeyword);
|
||||
if (tryStatement.catchClause) {
|
||||
pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), SyntaxKind.CatchKeyword);
|
||||
}
|
||||
|
||||
if (tryStatement.finallyBlock) {
|
||||
@@ -3716,7 +3708,7 @@ module ts {
|
||||
|
||||
function aggregate(node: Node): void {
|
||||
if (node.kind === SyntaxKind.BreakStatement || node.kind === SyntaxKind.ContinueStatement) {
|
||||
statementAccumulator.push(node);
|
||||
statementAccumulator.push(<BreakOrContinueStatement>node);
|
||||
}
|
||||
// Do not cross function boundaries.
|
||||
else if (!isAnyFunction(node)) {
|
||||
@@ -3790,6 +3782,87 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getModifierOccurrences(modifier: SyntaxKind, declaration: Node) {
|
||||
var container = declaration.parent;
|
||||
|
||||
// Make sure we only highlight the keyword when it makes sense to do so.
|
||||
if (declaration.flags & NodeFlags.AccessibilityModifier) {
|
||||
if (!(container.kind === SyntaxKind.ClassDeclaration ||
|
||||
(declaration.kind === SyntaxKind.Parameter && hasKind(container, SyntaxKind.Constructor)))) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (declaration.flags & NodeFlags.Static) {
|
||||
if (container.kind !== SyntaxKind.ClassDeclaration) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (declaration.flags & (NodeFlags.Export | NodeFlags.Ambient)) {
|
||||
if (!(container.kind === SyntaxKind.ModuleBlock || container.kind === SyntaxKind.SourceFile)) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
var keywords: Node[] = [];
|
||||
var modifierFlag: NodeFlags = getFlagFromModifier(modifier);
|
||||
|
||||
var nodes: Node[];
|
||||
switch (container.kind) {
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SourceFile:
|
||||
nodes = (<Block>container).statements;
|
||||
break;
|
||||
case SyntaxKind.Constructor:
|
||||
nodes = (<Node[]>(<ConstructorDeclaration>container).parameters).concat(
|
||||
(<ClassDeclaration>container.parent).members);
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
nodes = (<ClassDeclaration>container).members;
|
||||
|
||||
// If we're an accessibility modifier, we're in an instance member and should search
|
||||
// the constructor's parameter list for instance members as well.
|
||||
if (modifierFlag & NodeFlags.AccessibilityModifier) {
|
||||
var constructor = forEach((<ClassDeclaration>container).members, member => {
|
||||
return member.kind === SyntaxKind.Constructor && <ConstructorDeclaration>member;
|
||||
});
|
||||
|
||||
if (constructor) {
|
||||
nodes = nodes.concat(constructor.parameters);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.fail("Invalid container kind.")
|
||||
}
|
||||
|
||||
forEach(nodes, node => {
|
||||
if (node.modifiers && node.flags & modifierFlag) {
|
||||
forEach(node.modifiers, child => pushKeywordIf(keywords, child, modifier));
|
||||
}
|
||||
});
|
||||
|
||||
return map(keywords, getReferenceEntryFromNode);
|
||||
|
||||
function getFlagFromModifier(modifier: SyntaxKind) {
|
||||
switch (modifier) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
return NodeFlags.Public;
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
return NodeFlags.Private;
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
return NodeFlags.Protected;
|
||||
case SyntaxKind.StaticKeyword:
|
||||
return NodeFlags.Static;
|
||||
case SyntaxKind.ExportKeyword:
|
||||
return NodeFlags.Export;
|
||||
case SyntaxKind.DeclareKeyword:
|
||||
return NodeFlags.Ambient;
|
||||
default:
|
||||
Debug.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if 'node' is defined and has a matching 'kind'.
|
||||
function hasKind(node: Node, kind: SyntaxKind) {
|
||||
return node !== undefined && node.kind === kind;
|
||||
@@ -4338,11 +4411,11 @@ module ts {
|
||||
if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
forEach(symbol.getDeclarations(), declaration => {
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration) {
|
||||
getPropertySymbolFromTypeReference((<ClassDeclaration>declaration).baseType);
|
||||
forEach((<ClassDeclaration>declaration).implementedTypes, getPropertySymbolFromTypeReference);
|
||||
getPropertySymbolFromTypeReference(getClassBaseTypeNode(<ClassDeclaration>declaration));
|
||||
forEach(getClassImplementedTypeNodes(<ClassDeclaration>declaration), getPropertySymbolFromTypeReference);
|
||||
}
|
||||
else if (declaration.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
forEach((<InterfaceDeclaration>declaration).baseTypes, getPropertySymbolFromTypeReference);
|
||||
forEach(getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration), getPropertySymbolFromTypeReference);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -4488,7 +4561,7 @@ module ts {
|
||||
|
||||
var parent = node.parent;
|
||||
if (parent) {
|
||||
if (parent.kind === SyntaxKind.PostfixOperator || parent.kind === SyntaxKind.PrefixOperator) {
|
||||
if (parent.kind === SyntaxKind.PostfixUnaryExpression || parent.kind === SyntaxKind.PrefixUnaryExpression) {
|
||||
return true;
|
||||
}
|
||||
else if (parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).left === node) {
|
||||
@@ -4592,18 +4665,14 @@ module ts {
|
||||
|
||||
function getEmitOutput(filename: string): EmitOutput {
|
||||
synchronizeHostData();
|
||||
|
||||
filename = normalizeSlashes(filename);
|
||||
var compilerOptions = program.getCompilerOptions();
|
||||
var targetSourceFile = program.getSourceFile(filename); // Current selected file to be output
|
||||
// If --out flag is not specified, shouldEmitToOwnFile is true. Otherwise shouldEmitToOwnFile is false.
|
||||
var shouldEmitToOwnFile = ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions);
|
||||
var emitOutput: EmitOutput = {
|
||||
outputFiles: [],
|
||||
emitOutputStatus: undefined,
|
||||
};
|
||||
var sourceFile = getSourceFile(filename);
|
||||
|
||||
var outputFiles: OutputFile[] = [];
|
||||
|
||||
function getEmitOutputWriter(filename: string, data: string, writeByteOrderMark: boolean) {
|
||||
emitOutput.outputFiles.push({
|
||||
outputFiles.push({
|
||||
name: filename,
|
||||
writeByteOrderMark: writeByteOrderMark,
|
||||
text: data
|
||||
@@ -4613,44 +4682,18 @@ module ts {
|
||||
// Initialize writer for CompilerHost.writeFile
|
||||
writer = getEmitOutputWriter;
|
||||
|
||||
var containSyntacticErrors = false;
|
||||
|
||||
if (shouldEmitToOwnFile) {
|
||||
// Check only the file we want to emit
|
||||
containSyntacticErrors = containErrors(program.getDiagnostics(targetSourceFile));
|
||||
} else {
|
||||
// Check the syntactic of only sourceFiles that will get emitted into single output
|
||||
// Terminate the process immediately if we encounter a syntax error from one of the sourceFiles
|
||||
containSyntacticErrors = forEach(program.getSourceFiles(), sourceFile => {
|
||||
if (!isExternalModuleOrDeclarationFile(sourceFile)) {
|
||||
// If emit to a single file then we will check all files that do not have external module
|
||||
return containErrors(program.getDiagnostics(sourceFile));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (containSyntacticErrors) {
|
||||
// If there is a syntax error, terminate the process and report outputStatus
|
||||
emitOutput.emitOutputStatus = EmitReturnStatus.AllOutputGenerationSkipped;
|
||||
// Reset writer back to undefined to make sure that we produce an error message
|
||||
// if CompilerHost.writeFile is called when we are not in getEmitOutput
|
||||
writer = undefined;
|
||||
return emitOutput;
|
||||
}
|
||||
|
||||
// Perform semantic and force a type check before emit to ensure that all symbols are updated
|
||||
// EmitFiles will report if there is an error from TypeChecker and Emitter
|
||||
// Depend whether we will have to emit into a single file or not either emit only selected file in the project, emit all files into a single file
|
||||
var emitFilesResult = getFullTypeCheckChecker().emitFiles(targetSourceFile);
|
||||
emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus;
|
||||
var emitOutput = getFullTypeCheckChecker().emitFiles(sourceFile);
|
||||
|
||||
// Reset writer back to undefined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in getEmitOutput
|
||||
writer = undefined;
|
||||
return emitOutput;
|
||||
|
||||
return {
|
||||
outputFiles,
|
||||
emitOutputStatus: emitOutput.emitResultStatus
|
||||
};
|
||||
}
|
||||
|
||||
function getMeaningFromDeclaration(node: Declaration): SemanticMeaning {
|
||||
function getMeaningFromDeclaration(node: Node): SemanticMeaning {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
@@ -4665,7 +4708,7 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
return SemanticMeaning.Value;
|
||||
|
||||
case SyntaxKind.TypeParameter:
|
||||
@@ -4724,7 +4767,7 @@ module ts {
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node.parent.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node.parent).entityName === node;
|
||||
return isInternalModuleImportDeclaration(node.parent) && (<ImportDeclaration>node.parent).moduleReference === node;
|
||||
}
|
||||
|
||||
function getMeaningFromRightHandSideOfImport(node: Node) {
|
||||
@@ -4793,7 +4836,7 @@ module ts {
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
@@ -4977,8 +5020,8 @@ module ts {
|
||||
// the '=' in a variable declaration is special cased here.
|
||||
if (token.parent.kind === SyntaxKind.BinaryExpression ||
|
||||
token.parent.kind === SyntaxKind.VariableDeclaration ||
|
||||
token.parent.kind === SyntaxKind.PrefixOperator ||
|
||||
token.parent.kind === SyntaxKind.PostfixOperator ||
|
||||
token.parent.kind === SyntaxKind.PrefixUnaryExpression ||
|
||||
token.parent.kind === SyntaxKind.PostfixUnaryExpression ||
|
||||
token.parent.kind === SyntaxKind.ConditionalExpression) {
|
||||
return ClassificationTypeNames.operator;
|
||||
}
|
||||
@@ -5575,23 +5618,29 @@ module ts {
|
||||
addResult(end - start, classFromKind(token));
|
||||
|
||||
if (end >= text.length) {
|
||||
// We're at the end.
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
// Check to see if we finished up on a multiline string literal.
|
||||
var tokenText = scanner.getTokenText();
|
||||
if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.backslash) {
|
||||
var quoteChar = tokenText.charCodeAt(0);
|
||||
result.finalLexState = quoteChar === CharacterCodes.doubleQuote
|
||||
? EndOfLineState.InDoubleQuoteStringLiteral
|
||||
: EndOfLineState.InSingleQuoteStringLiteral;
|
||||
if (scanner.isUnterminated()) {
|
||||
var lastCharIndex = tokenText.length - 1;
|
||||
|
||||
var numBackslashes = 0;
|
||||
while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === CharacterCodes.backslash) {
|
||||
numBackslashes++;
|
||||
}
|
||||
|
||||
// If we have an odd number of backslashes, then the multiline string is unclosed
|
||||
if (numBackslashes & 1) {
|
||||
var quoteChar = tokenText.charCodeAt(0);
|
||||
result.finalLexState = quoteChar === CharacterCodes.doubleQuote
|
||||
? EndOfLineState.InDoubleQuoteStringLiteral
|
||||
: EndOfLineState.InSingleQuoteStringLiteral;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (token === SyntaxKind.MultiLineCommentTrivia) {
|
||||
// Check to see if the multiline comment was unclosed.
|
||||
var tokenText = scanner.getTokenText()
|
||||
if (!(tokenText.length > 3 && // need to avoid catching '/*/'
|
||||
tokenText.charCodeAt(tokenText.length - 2) === CharacterCodes.asterisk &&
|
||||
tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.slash)) {
|
||||
if (scanner.isUnterminated()) {
|
||||
result.finalLexState = EndOfLineState.InMultiLineCommentTrivia;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ module ts {
|
||||
getLocalizedDiagnosticMessages(): string;
|
||||
getCancellationToken(): CancellationToken;
|
||||
getCurrentDirectory(): string;
|
||||
getDefaultLibFilename(): string;
|
||||
getDefaultLibFilename(options: string): string;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -388,8 +388,8 @@ module ts {
|
||||
return this.shimHost.getCancellationToken();
|
||||
}
|
||||
|
||||
public getDefaultLibFilename(): string {
|
||||
return this.shimHost.getDefaultLibFilename();
|
||||
public getDefaultLibFilename(options: CompilerOptions): string {
|
||||
return this.shimHost.getDefaultLibFilename(JSON.stringify(options));
|
||||
}
|
||||
|
||||
public getCurrentDirectory(): string {
|
||||
|
||||
@@ -296,7 +296,7 @@ module ts.SignatureHelp {
|
||||
Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression);
|
||||
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !isUnterminatedTemplateEnd(<LiteralExpression>node)) {
|
||||
if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !(<LiteralExpression>node).isUnterminated) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ module ts.SignatureHelp {
|
||||
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
|
||||
if (template.kind === SyntaxKind.TemplateExpression) {
|
||||
var lastSpan = lastOrUndefined((<TemplateExpression>template).templateSpans);
|
||||
if (lastSpan.literal.kind === SyntaxKind.Missing) {
|
||||
if (lastSpan.literal.getFullWidth() === 0) {
|
||||
applicableSpanEnd = skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
|
||||
}
|
||||
}
|
||||
@@ -524,7 +524,7 @@ module ts.SignatureHelp {
|
||||
var displayParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
|
||||
|
||||
var isOptional = !!(parameter.valueDeclaration.flags & NodeFlags.QuestionMark);
|
||||
var isOptional = hasQuestionToken(parameter.valueDeclaration);
|
||||
|
||||
return {
|
||||
name: parameter.name,
|
||||
|
||||
@@ -227,10 +227,10 @@ module ts.formatting {
|
||||
return (<TypeReferenceNode>node.parent).typeArguments;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return (<ObjectLiteral>node.parent).properties;
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return (<ArrayLiteral>node.parent).elements;
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return (<ObjectLiteralExpression>node.parent).properties;
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return (<ArrayLiteralExpression>node.parent).elements;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -253,7 +253,8 @@ module ts.formatting {
|
||||
rangeContainsStartEnd((<CallExpression>node.parent).typeArguments, start, node.getEnd())) {
|
||||
return (<CallExpression>node.parent).typeArguments;
|
||||
}
|
||||
if (rangeContainsStartEnd((<CallExpression>node.parent).arguments, start, node.getEnd())) {
|
||||
if ((<CallExpression>node.parent).arguments &&
|
||||
rangeContainsStartEnd((<CallExpression>node.parent).arguments, start, node.getEnd())) {
|
||||
return (<CallExpression>node.parent).arguments;
|
||||
}
|
||||
break;
|
||||
@@ -323,19 +324,18 @@ module ts.formatting {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.DefaultClause:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.VariableStatement:
|
||||
@@ -393,19 +393,24 @@ module ts.formatting {
|
||||
* This function is always called when position of the cursor is located after the node
|
||||
*/
|
||||
function isCompletedNode(n: Node, sourceFile: SourceFile): boolean {
|
||||
if (n.getFullWidth() === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.CatchClause:
|
||||
return isCompletedNode((<CatchClause>n).block, sourceFile);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
@@ -424,10 +429,8 @@ module ts.formatting {
|
||||
return isCompletedNode((<IfStatement>n).thenStatement, sourceFile);
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
return isCompletedNode((<ExpressionStatement>n).expression, sourceFile);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
case SyntaxKind.Missing:
|
||||
return false;
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
// there is no such thing as terminator token for CaseClause\DefaultClause so for simplicitly always consider them non-completed
|
||||
|
||||
@@ -472,179 +472,182 @@ var TypeScript;
|
||||
SyntaxKind[SyntaxKind["StaticKeyword"] = 60] = "StaticKeyword";
|
||||
SyntaxKind[SyntaxKind["YieldKeyword"] = 61] = "YieldKeyword";
|
||||
SyntaxKind[SyntaxKind["AnyKeyword"] = 62] = "AnyKeyword";
|
||||
SyntaxKind[SyntaxKind["BooleanKeyword"] = 63] = "BooleanKeyword";
|
||||
SyntaxKind[SyntaxKind["ConstructorKeyword"] = 64] = "ConstructorKeyword";
|
||||
SyntaxKind[SyntaxKind["DeclareKeyword"] = 65] = "DeclareKeyword";
|
||||
SyntaxKind[SyntaxKind["GetKeyword"] = 66] = "GetKeyword";
|
||||
SyntaxKind[SyntaxKind["ModuleKeyword"] = 67] = "ModuleKeyword";
|
||||
SyntaxKind[SyntaxKind["RequireKeyword"] = 68] = "RequireKeyword";
|
||||
SyntaxKind[SyntaxKind["NumberKeyword"] = 69] = "NumberKeyword";
|
||||
SyntaxKind[SyntaxKind["SetKeyword"] = 70] = "SetKeyword";
|
||||
SyntaxKind[SyntaxKind["StringKeyword"] = 71] = "StringKeyword";
|
||||
SyntaxKind[SyntaxKind["OpenBraceToken"] = 72] = "OpenBraceToken";
|
||||
SyntaxKind[SyntaxKind["CloseBraceToken"] = 73] = "CloseBraceToken";
|
||||
SyntaxKind[SyntaxKind["OpenParenToken"] = 74] = "OpenParenToken";
|
||||
SyntaxKind[SyntaxKind["CloseParenToken"] = 75] = "CloseParenToken";
|
||||
SyntaxKind[SyntaxKind["OpenBracketToken"] = 76] = "OpenBracketToken";
|
||||
SyntaxKind[SyntaxKind["CloseBracketToken"] = 77] = "CloseBracketToken";
|
||||
SyntaxKind[SyntaxKind["DotToken"] = 78] = "DotToken";
|
||||
SyntaxKind[SyntaxKind["DotDotDotToken"] = 79] = "DotDotDotToken";
|
||||
SyntaxKind[SyntaxKind["SemicolonToken"] = 80] = "SemicolonToken";
|
||||
SyntaxKind[SyntaxKind["CommaToken"] = 81] = "CommaToken";
|
||||
SyntaxKind[SyntaxKind["LessThanToken"] = 82] = "LessThanToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanToken"] = 83] = "GreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 84] = "LessThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 85] = "GreaterThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 86] = "EqualsEqualsToken";
|
||||
SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 87] = "EqualsGreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 88] = "ExclamationEqualsToken";
|
||||
SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 89] = "EqualsEqualsEqualsToken";
|
||||
SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 90] = "ExclamationEqualsEqualsToken";
|
||||
SyntaxKind[SyntaxKind["PlusToken"] = 91] = "PlusToken";
|
||||
SyntaxKind[SyntaxKind["MinusToken"] = 92] = "MinusToken";
|
||||
SyntaxKind[SyntaxKind["AsteriskToken"] = 93] = "AsteriskToken";
|
||||
SyntaxKind[SyntaxKind["PercentToken"] = 94] = "PercentToken";
|
||||
SyntaxKind[SyntaxKind["PlusPlusToken"] = 95] = "PlusPlusToken";
|
||||
SyntaxKind[SyntaxKind["MinusMinusToken"] = 96] = "MinusMinusToken";
|
||||
SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 97] = "LessThanLessThanToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 98] = "GreaterThanGreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 99] = "GreaterThanGreaterThanGreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["AmpersandToken"] = 100] = "AmpersandToken";
|
||||
SyntaxKind[SyntaxKind["BarToken"] = 101] = "BarToken";
|
||||
SyntaxKind[SyntaxKind["CaretToken"] = 102] = "CaretToken";
|
||||
SyntaxKind[SyntaxKind["ExclamationToken"] = 103] = "ExclamationToken";
|
||||
SyntaxKind[SyntaxKind["TildeToken"] = 104] = "TildeToken";
|
||||
SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 105] = "AmpersandAmpersandToken";
|
||||
SyntaxKind[SyntaxKind["BarBarToken"] = 106] = "BarBarToken";
|
||||
SyntaxKind[SyntaxKind["QuestionToken"] = 107] = "QuestionToken";
|
||||
SyntaxKind[SyntaxKind["ColonToken"] = 108] = "ColonToken";
|
||||
SyntaxKind[SyntaxKind["EqualsToken"] = 109] = "EqualsToken";
|
||||
SyntaxKind[SyntaxKind["PlusEqualsToken"] = 110] = "PlusEqualsToken";
|
||||
SyntaxKind[SyntaxKind["MinusEqualsToken"] = 111] = "MinusEqualsToken";
|
||||
SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 112] = "AsteriskEqualsToken";
|
||||
SyntaxKind[SyntaxKind["PercentEqualsToken"] = 113] = "PercentEqualsToken";
|
||||
SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 114] = "LessThanLessThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 115] = "GreaterThanGreaterThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 116] = "GreaterThanGreaterThanGreaterThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 117] = "AmpersandEqualsToken";
|
||||
SyntaxKind[SyntaxKind["BarEqualsToken"] = 118] = "BarEqualsToken";
|
||||
SyntaxKind[SyntaxKind["CaretEqualsToken"] = 119] = "CaretEqualsToken";
|
||||
SyntaxKind[SyntaxKind["SlashToken"] = 120] = "SlashToken";
|
||||
SyntaxKind[SyntaxKind["SlashEqualsToken"] = 121] = "SlashEqualsToken";
|
||||
SyntaxKind[SyntaxKind["SourceUnit"] = 122] = "SourceUnit";
|
||||
SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName";
|
||||
SyntaxKind[SyntaxKind["ObjectType"] = 124] = "ObjectType";
|
||||
SyntaxKind[SyntaxKind["FunctionType"] = 125] = "FunctionType";
|
||||
SyntaxKind[SyntaxKind["ArrayType"] = 126] = "ArrayType";
|
||||
SyntaxKind[SyntaxKind["ConstructorType"] = 127] = "ConstructorType";
|
||||
SyntaxKind[SyntaxKind["GenericType"] = 128] = "GenericType";
|
||||
SyntaxKind[SyntaxKind["TypeQuery"] = 129] = "TypeQuery";
|
||||
SyntaxKind[SyntaxKind["TupleType"] = 130] = "TupleType";
|
||||
SyntaxKind[SyntaxKind["UnionType"] = 131] = "UnionType";
|
||||
SyntaxKind[SyntaxKind["ParenthesizedType"] = 132] = "ParenthesizedType";
|
||||
SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 133] = "InterfaceDeclaration";
|
||||
SyntaxKind[SyntaxKind["FunctionDeclaration"] = 134] = "FunctionDeclaration";
|
||||
SyntaxKind[SyntaxKind["ModuleDeclaration"] = 135] = "ModuleDeclaration";
|
||||
SyntaxKind[SyntaxKind["ClassDeclaration"] = 136] = "ClassDeclaration";
|
||||
SyntaxKind[SyntaxKind["EnumDeclaration"] = 137] = "EnumDeclaration";
|
||||
SyntaxKind[SyntaxKind["ImportDeclaration"] = 138] = "ImportDeclaration";
|
||||
SyntaxKind[SyntaxKind["ExportAssignment"] = 139] = "ExportAssignment";
|
||||
SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 140] = "MemberFunctionDeclaration";
|
||||
SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 141] = "MemberVariableDeclaration";
|
||||
SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 142] = "ConstructorDeclaration";
|
||||
SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 143] = "IndexMemberDeclaration";
|
||||
SyntaxKind[SyntaxKind["GetAccessor"] = 144] = "GetAccessor";
|
||||
SyntaxKind[SyntaxKind["SetAccessor"] = 145] = "SetAccessor";
|
||||
SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature";
|
||||
SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature";
|
||||
SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature";
|
||||
SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature";
|
||||
SyntaxKind[SyntaxKind["MethodSignature"] = 150] = "MethodSignature";
|
||||
SyntaxKind[SyntaxKind["Block"] = 151] = "Block";
|
||||
SyntaxKind[SyntaxKind["IfStatement"] = 152] = "IfStatement";
|
||||
SyntaxKind[SyntaxKind["VariableStatement"] = 153] = "VariableStatement";
|
||||
SyntaxKind[SyntaxKind["ExpressionStatement"] = 154] = "ExpressionStatement";
|
||||
SyntaxKind[SyntaxKind["ReturnStatement"] = 155] = "ReturnStatement";
|
||||
SyntaxKind[SyntaxKind["SwitchStatement"] = 156] = "SwitchStatement";
|
||||
SyntaxKind[SyntaxKind["BreakStatement"] = 157] = "BreakStatement";
|
||||
SyntaxKind[SyntaxKind["ContinueStatement"] = 158] = "ContinueStatement";
|
||||
SyntaxKind[SyntaxKind["ForStatement"] = 159] = "ForStatement";
|
||||
SyntaxKind[SyntaxKind["ForInStatement"] = 160] = "ForInStatement";
|
||||
SyntaxKind[SyntaxKind["EmptyStatement"] = 161] = "EmptyStatement";
|
||||
SyntaxKind[SyntaxKind["ThrowStatement"] = 162] = "ThrowStatement";
|
||||
SyntaxKind[SyntaxKind["WhileStatement"] = 163] = "WhileStatement";
|
||||
SyntaxKind[SyntaxKind["TryStatement"] = 164] = "TryStatement";
|
||||
SyntaxKind[SyntaxKind["LabeledStatement"] = 165] = "LabeledStatement";
|
||||
SyntaxKind[SyntaxKind["DoStatement"] = 166] = "DoStatement";
|
||||
SyntaxKind[SyntaxKind["DebuggerStatement"] = 167] = "DebuggerStatement";
|
||||
SyntaxKind[SyntaxKind["WithStatement"] = 168] = "WithStatement";
|
||||
SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 169] = "PrefixUnaryExpression";
|
||||
SyntaxKind[SyntaxKind["DeleteExpression"] = 170] = "DeleteExpression";
|
||||
SyntaxKind[SyntaxKind["TypeOfExpression"] = 171] = "TypeOfExpression";
|
||||
SyntaxKind[SyntaxKind["VoidExpression"] = 172] = "VoidExpression";
|
||||
SyntaxKind[SyntaxKind["ConditionalExpression"] = 173] = "ConditionalExpression";
|
||||
SyntaxKind[SyntaxKind["BinaryExpression"] = 174] = "BinaryExpression";
|
||||
SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 175] = "PostfixUnaryExpression";
|
||||
SyntaxKind[SyntaxKind["MemberAccessExpression"] = 176] = "MemberAccessExpression";
|
||||
SyntaxKind[SyntaxKind["InvocationExpression"] = 177] = "InvocationExpression";
|
||||
SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 178] = "ArrayLiteralExpression";
|
||||
SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 179] = "ObjectLiteralExpression";
|
||||
SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 180] = "ObjectCreationExpression";
|
||||
SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 181] = "ParenthesizedExpression";
|
||||
SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 182] = "ParenthesizedArrowFunctionExpression";
|
||||
SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 183] = "SimpleArrowFunctionExpression";
|
||||
SyntaxKind[SyntaxKind["CastExpression"] = 184] = "CastExpression";
|
||||
SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression";
|
||||
SyntaxKind[SyntaxKind["FunctionExpression"] = 186] = "FunctionExpression";
|
||||
SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression";
|
||||
SyntaxKind[SyntaxKind["TemplateExpression"] = 188] = "TemplateExpression";
|
||||
SyntaxKind[SyntaxKind["TemplateAccessExpression"] = 189] = "TemplateAccessExpression";
|
||||
SyntaxKind[SyntaxKind["YieldExpression"] = 190] = "YieldExpression";
|
||||
SyntaxKind[SyntaxKind["VariableDeclaration"] = 191] = "VariableDeclaration";
|
||||
SyntaxKind[SyntaxKind["VariableDeclarator"] = 192] = "VariableDeclarator";
|
||||
SyntaxKind[SyntaxKind["ArgumentList"] = 193] = "ArgumentList";
|
||||
SyntaxKind[SyntaxKind["ParameterList"] = 194] = "ParameterList";
|
||||
SyntaxKind[SyntaxKind["TypeArgumentList"] = 195] = "TypeArgumentList";
|
||||
SyntaxKind[SyntaxKind["TypeParameterList"] = 196] = "TypeParameterList";
|
||||
SyntaxKind[SyntaxKind["HeritageClause"] = 197] = "HeritageClause";
|
||||
SyntaxKind[SyntaxKind["EqualsValueClause"] = 198] = "EqualsValueClause";
|
||||
SyntaxKind[SyntaxKind["CaseSwitchClause"] = 199] = "CaseSwitchClause";
|
||||
SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 200] = "DefaultSwitchClause";
|
||||
SyntaxKind[SyntaxKind["ElseClause"] = 201] = "ElseClause";
|
||||
SyntaxKind[SyntaxKind["CatchClause"] = 202] = "CatchClause";
|
||||
SyntaxKind[SyntaxKind["FinallyClause"] = 203] = "FinallyClause";
|
||||
SyntaxKind[SyntaxKind["TemplateClause"] = 204] = "TemplateClause";
|
||||
SyntaxKind[SyntaxKind["TypeParameter"] = 205] = "TypeParameter";
|
||||
SyntaxKind[SyntaxKind["Constraint"] = 206] = "Constraint";
|
||||
SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 207] = "SimplePropertyAssignment";
|
||||
SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 208] = "FunctionPropertyAssignment";
|
||||
SyntaxKind[SyntaxKind["Parameter"] = 209] = "Parameter";
|
||||
SyntaxKind[SyntaxKind["EnumElement"] = 210] = "EnumElement";
|
||||
SyntaxKind[SyntaxKind["TypeAnnotation"] = 211] = "TypeAnnotation";
|
||||
SyntaxKind[SyntaxKind["ExpressionBody"] = 212] = "ExpressionBody";
|
||||
SyntaxKind[SyntaxKind["ComputedPropertyName"] = 213] = "ComputedPropertyName";
|
||||
SyntaxKind[SyntaxKind["ExternalModuleReference"] = 214] = "ExternalModuleReference";
|
||||
SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 215] = "ModuleNameModuleReference";
|
||||
SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword";
|
||||
SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword";
|
||||
SyntaxKind[SyntaxKind["LastFutureReservedKeyword"] = SyntaxKind.SuperKeyword] = "LastFutureReservedKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstFutureReservedStrictKeyword"] = SyntaxKind.ImplementsKeyword] = "FirstFutureReservedStrictKeyword";
|
||||
SyntaxKind[SyntaxKind["LastFutureReservedStrictKeyword"] = SyntaxKind.YieldKeyword] = "LastFutureReservedStrictKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstTypeScriptKeyword"] = SyntaxKind.AnyKeyword] = "FirstTypeScriptKeyword";
|
||||
SyntaxKind[SyntaxKind["LastTypeScriptKeyword"] = SyntaxKind.StringKeyword] = "LastTypeScriptKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstKeyword"] = SyntaxKind.FirstStandardKeyword] = "FirstKeyword";
|
||||
SyntaxKind[SyntaxKind["LastKeyword"] = SyntaxKind.LastTypeScriptKeyword] = "LastKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstToken"] = SyntaxKind.ErrorToken] = "FirstToken";
|
||||
SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.SlashEqualsToken] = "LastToken";
|
||||
SyntaxKind[SyntaxKind["FirstPunctuation"] = SyntaxKind.OpenBraceToken] = "FirstPunctuation";
|
||||
SyntaxKind[SyntaxKind["LastPunctuation"] = SyntaxKind.SlashEqualsToken] = "LastPunctuation";
|
||||
SyntaxKind[SyntaxKind["FirstFixedWidth"] = SyntaxKind.FirstKeyword] = "FirstFixedWidth";
|
||||
SyntaxKind[SyntaxKind["LastFixedWidth"] = SyntaxKind.LastPunctuation] = "LastFixedWidth";
|
||||
SyntaxKind[SyntaxKind["FirstTrivia"] = SyntaxKind.WhitespaceTrivia] = "FirstTrivia";
|
||||
SyntaxKind[SyntaxKind["LastTrivia"] = SyntaxKind.SkippedTokenTrivia] = "LastTrivia";
|
||||
SyntaxKind[SyntaxKind["FirstNode"] = SyntaxKind.SourceUnit] = "FirstNode";
|
||||
SyntaxKind[SyntaxKind["LastNode"] = SyntaxKind.ModuleNameModuleReference] = "LastNode";
|
||||
SyntaxKind[SyntaxKind["AsyncKeyword"] = 63] = "AsyncKeyword";
|
||||
SyntaxKind[SyntaxKind["AwaitKeyword"] = 64] = "AwaitKeyword";
|
||||
SyntaxKind[SyntaxKind["BooleanKeyword"] = 65] = "BooleanKeyword";
|
||||
SyntaxKind[SyntaxKind["ConstructorKeyword"] = 66] = "ConstructorKeyword";
|
||||
SyntaxKind[SyntaxKind["DeclareKeyword"] = 67] = "DeclareKeyword";
|
||||
SyntaxKind[SyntaxKind["GetKeyword"] = 68] = "GetKeyword";
|
||||
SyntaxKind[SyntaxKind["ModuleKeyword"] = 69] = "ModuleKeyword";
|
||||
SyntaxKind[SyntaxKind["RequireKeyword"] = 70] = "RequireKeyword";
|
||||
SyntaxKind[SyntaxKind["NumberKeyword"] = 71] = "NumberKeyword";
|
||||
SyntaxKind[SyntaxKind["SetKeyword"] = 72] = "SetKeyword";
|
||||
SyntaxKind[SyntaxKind["TypeKeyword"] = 73] = "TypeKeyword";
|
||||
SyntaxKind[SyntaxKind["StringKeyword"] = 74] = "StringKeyword";
|
||||
SyntaxKind[SyntaxKind["OpenBraceToken"] = 75] = "OpenBraceToken";
|
||||
SyntaxKind[SyntaxKind["CloseBraceToken"] = 76] = "CloseBraceToken";
|
||||
SyntaxKind[SyntaxKind["OpenParenToken"] = 77] = "OpenParenToken";
|
||||
SyntaxKind[SyntaxKind["CloseParenToken"] = 78] = "CloseParenToken";
|
||||
SyntaxKind[SyntaxKind["OpenBracketToken"] = 79] = "OpenBracketToken";
|
||||
SyntaxKind[SyntaxKind["CloseBracketToken"] = 80] = "CloseBracketToken";
|
||||
SyntaxKind[SyntaxKind["DotToken"] = 81] = "DotToken";
|
||||
SyntaxKind[SyntaxKind["DotDotDotToken"] = 82] = "DotDotDotToken";
|
||||
SyntaxKind[SyntaxKind["SemicolonToken"] = 83] = "SemicolonToken";
|
||||
SyntaxKind[SyntaxKind["CommaToken"] = 84] = "CommaToken";
|
||||
SyntaxKind[SyntaxKind["LessThanToken"] = 85] = "LessThanToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanToken"] = 86] = "GreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 87] = "LessThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 88] = "GreaterThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 89] = "EqualsEqualsToken";
|
||||
SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 90] = "EqualsGreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 91] = "ExclamationEqualsToken";
|
||||
SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 92] = "EqualsEqualsEqualsToken";
|
||||
SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 93] = "ExclamationEqualsEqualsToken";
|
||||
SyntaxKind[SyntaxKind["PlusToken"] = 94] = "PlusToken";
|
||||
SyntaxKind[SyntaxKind["MinusToken"] = 95] = "MinusToken";
|
||||
SyntaxKind[SyntaxKind["AsteriskToken"] = 96] = "AsteriskToken";
|
||||
SyntaxKind[SyntaxKind["PercentToken"] = 97] = "PercentToken";
|
||||
SyntaxKind[SyntaxKind["PlusPlusToken"] = 98] = "PlusPlusToken";
|
||||
SyntaxKind[SyntaxKind["MinusMinusToken"] = 99] = "MinusMinusToken";
|
||||
SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 100] = "LessThanLessThanToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 101] = "GreaterThanGreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 102] = "GreaterThanGreaterThanGreaterThanToken";
|
||||
SyntaxKind[SyntaxKind["AmpersandToken"] = 103] = "AmpersandToken";
|
||||
SyntaxKind[SyntaxKind["BarToken"] = 104] = "BarToken";
|
||||
SyntaxKind[SyntaxKind["CaretToken"] = 105] = "CaretToken";
|
||||
SyntaxKind[SyntaxKind["ExclamationToken"] = 106] = "ExclamationToken";
|
||||
SyntaxKind[SyntaxKind["TildeToken"] = 107] = "TildeToken";
|
||||
SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 108] = "AmpersandAmpersandToken";
|
||||
SyntaxKind[SyntaxKind["BarBarToken"] = 109] = "BarBarToken";
|
||||
SyntaxKind[SyntaxKind["QuestionToken"] = 110] = "QuestionToken";
|
||||
SyntaxKind[SyntaxKind["ColonToken"] = 111] = "ColonToken";
|
||||
SyntaxKind[SyntaxKind["EqualsToken"] = 112] = "EqualsToken";
|
||||
SyntaxKind[SyntaxKind["PlusEqualsToken"] = 113] = "PlusEqualsToken";
|
||||
SyntaxKind[SyntaxKind["MinusEqualsToken"] = 114] = "MinusEqualsToken";
|
||||
SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 115] = "AsteriskEqualsToken";
|
||||
SyntaxKind[SyntaxKind["PercentEqualsToken"] = 116] = "PercentEqualsToken";
|
||||
SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 117] = "LessThanLessThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 118] = "GreaterThanGreaterThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 119] = "GreaterThanGreaterThanGreaterThanEqualsToken";
|
||||
SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 120] = "AmpersandEqualsToken";
|
||||
SyntaxKind[SyntaxKind["BarEqualsToken"] = 121] = "BarEqualsToken";
|
||||
SyntaxKind[SyntaxKind["CaretEqualsToken"] = 122] = "CaretEqualsToken";
|
||||
SyntaxKind[SyntaxKind["SlashToken"] = 123] = "SlashToken";
|
||||
SyntaxKind[SyntaxKind["SlashEqualsToken"] = 124] = "SlashEqualsToken";
|
||||
SyntaxKind[SyntaxKind["SourceUnit"] = 125] = "SourceUnit";
|
||||
SyntaxKind[SyntaxKind["QualifiedName"] = 126] = "QualifiedName";
|
||||
SyntaxKind[SyntaxKind["ObjectType"] = 127] = "ObjectType";
|
||||
SyntaxKind[SyntaxKind["FunctionType"] = 128] = "FunctionType";
|
||||
SyntaxKind[SyntaxKind["ArrayType"] = 129] = "ArrayType";
|
||||
SyntaxKind[SyntaxKind["ConstructorType"] = 130] = "ConstructorType";
|
||||
SyntaxKind[SyntaxKind["GenericType"] = 131] = "GenericType";
|
||||
SyntaxKind[SyntaxKind["TypeQuery"] = 132] = "TypeQuery";
|
||||
SyntaxKind[SyntaxKind["TupleType"] = 133] = "TupleType";
|
||||
SyntaxKind[SyntaxKind["UnionType"] = 134] = "UnionType";
|
||||
SyntaxKind[SyntaxKind["ParenthesizedType"] = 135] = "ParenthesizedType";
|
||||
SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 136] = "InterfaceDeclaration";
|
||||
SyntaxKind[SyntaxKind["FunctionDeclaration"] = 137] = "FunctionDeclaration";
|
||||
SyntaxKind[SyntaxKind["ModuleDeclaration"] = 138] = "ModuleDeclaration";
|
||||
SyntaxKind[SyntaxKind["ClassDeclaration"] = 139] = "ClassDeclaration";
|
||||
SyntaxKind[SyntaxKind["EnumDeclaration"] = 140] = "EnumDeclaration";
|
||||
SyntaxKind[SyntaxKind["ImportDeclaration"] = 141] = "ImportDeclaration";
|
||||
SyntaxKind[SyntaxKind["ExportAssignment"] = 142] = "ExportAssignment";
|
||||
SyntaxKind[SyntaxKind["MethodDeclaration"] = 143] = "MethodDeclaration";
|
||||
SyntaxKind[SyntaxKind["PropertyDeclaration"] = 144] = "PropertyDeclaration";
|
||||
SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 145] = "ConstructorDeclaration";
|
||||
SyntaxKind[SyntaxKind["GetAccessor"] = 146] = "GetAccessor";
|
||||
SyntaxKind[SyntaxKind["SetAccessor"] = 147] = "SetAccessor";
|
||||
SyntaxKind[SyntaxKind["PropertySignature"] = 148] = "PropertySignature";
|
||||
SyntaxKind[SyntaxKind["CallSignature"] = 149] = "CallSignature";
|
||||
SyntaxKind[SyntaxKind["ConstructSignature"] = 150] = "ConstructSignature";
|
||||
SyntaxKind[SyntaxKind["IndexSignature"] = 151] = "IndexSignature";
|
||||
SyntaxKind[SyntaxKind["MethodSignature"] = 152] = "MethodSignature";
|
||||
SyntaxKind[SyntaxKind["Block"] = 153] = "Block";
|
||||
SyntaxKind[SyntaxKind["IfStatement"] = 154] = "IfStatement";
|
||||
SyntaxKind[SyntaxKind["VariableStatement"] = 155] = "VariableStatement";
|
||||
SyntaxKind[SyntaxKind["ExpressionStatement"] = 156] = "ExpressionStatement";
|
||||
SyntaxKind[SyntaxKind["ReturnStatement"] = 157] = "ReturnStatement";
|
||||
SyntaxKind[SyntaxKind["SwitchStatement"] = 158] = "SwitchStatement";
|
||||
SyntaxKind[SyntaxKind["BreakStatement"] = 159] = "BreakStatement";
|
||||
SyntaxKind[SyntaxKind["ContinueStatement"] = 160] = "ContinueStatement";
|
||||
SyntaxKind[SyntaxKind["ForStatement"] = 161] = "ForStatement";
|
||||
SyntaxKind[SyntaxKind["ForInStatement"] = 162] = "ForInStatement";
|
||||
SyntaxKind[SyntaxKind["EmptyStatement"] = 163] = "EmptyStatement";
|
||||
SyntaxKind[SyntaxKind["ThrowStatement"] = 164] = "ThrowStatement";
|
||||
SyntaxKind[SyntaxKind["WhileStatement"] = 165] = "WhileStatement";
|
||||
SyntaxKind[SyntaxKind["TryStatement"] = 166] = "TryStatement";
|
||||
SyntaxKind[SyntaxKind["LabeledStatement"] = 167] = "LabeledStatement";
|
||||
SyntaxKind[SyntaxKind["DoStatement"] = 168] = "DoStatement";
|
||||
SyntaxKind[SyntaxKind["DebuggerStatement"] = 169] = "DebuggerStatement";
|
||||
SyntaxKind[SyntaxKind["WithStatement"] = 170] = "WithStatement";
|
||||
SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 171] = "PrefixUnaryExpression";
|
||||
SyntaxKind[SyntaxKind["DeleteExpression"] = 172] = "DeleteExpression";
|
||||
SyntaxKind[SyntaxKind["TypeOfExpression"] = 173] = "TypeOfExpression";
|
||||
SyntaxKind[SyntaxKind["VoidExpression"] = 174] = "VoidExpression";
|
||||
SyntaxKind[SyntaxKind["ConditionalExpression"] = 175] = "ConditionalExpression";
|
||||
SyntaxKind[SyntaxKind["BinaryExpression"] = 176] = "BinaryExpression";
|
||||
SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 177] = "PostfixUnaryExpression";
|
||||
SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression";
|
||||
SyntaxKind[SyntaxKind["InvocationExpression"] = 179] = "InvocationExpression";
|
||||
SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 180] = "ArrayLiteralExpression";
|
||||
SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 181] = "ObjectLiteralExpression";
|
||||
SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 182] = "ObjectCreationExpression";
|
||||
SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 183] = "ParenthesizedExpression";
|
||||
SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 184] = "ParenthesizedArrowFunctionExpression";
|
||||
SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 185] = "SimpleArrowFunctionExpression";
|
||||
SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 186] = "TypeAssertionExpression";
|
||||
SyntaxKind[SyntaxKind["ElementAccessExpression"] = 187] = "ElementAccessExpression";
|
||||
SyntaxKind[SyntaxKind["FunctionExpression"] = 188] = "FunctionExpression";
|
||||
SyntaxKind[SyntaxKind["OmittedExpression"] = 189] = "OmittedExpression";
|
||||
SyntaxKind[SyntaxKind["TemplateExpression"] = 190] = "TemplateExpression";
|
||||
SyntaxKind[SyntaxKind["TemplateAccessExpression"] = 191] = "TemplateAccessExpression";
|
||||
SyntaxKind[SyntaxKind["YieldExpression"] = 192] = "YieldExpression";
|
||||
SyntaxKind[SyntaxKind["AwaitExpression"] = 193] = "AwaitExpression";
|
||||
SyntaxKind[SyntaxKind["VariableDeclaration"] = 194] = "VariableDeclaration";
|
||||
SyntaxKind[SyntaxKind["VariableDeclarator"] = 195] = "VariableDeclarator";
|
||||
SyntaxKind[SyntaxKind["ArgumentList"] = 196] = "ArgumentList";
|
||||
SyntaxKind[SyntaxKind["ParameterList"] = 197] = "ParameterList";
|
||||
SyntaxKind[SyntaxKind["TypeArgumentList"] = 198] = "TypeArgumentList";
|
||||
SyntaxKind[SyntaxKind["TypeParameterList"] = 199] = "TypeParameterList";
|
||||
SyntaxKind[SyntaxKind["HeritageClause"] = 200] = "HeritageClause";
|
||||
SyntaxKind[SyntaxKind["EqualsValueClause"] = 201] = "EqualsValueClause";
|
||||
SyntaxKind[SyntaxKind["CaseSwitchClause"] = 202] = "CaseSwitchClause";
|
||||
SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 203] = "DefaultSwitchClause";
|
||||
SyntaxKind[SyntaxKind["ElseClause"] = 204] = "ElseClause";
|
||||
SyntaxKind[SyntaxKind["CatchClause"] = 205] = "CatchClause";
|
||||
SyntaxKind[SyntaxKind["FinallyClause"] = 206] = "FinallyClause";
|
||||
SyntaxKind[SyntaxKind["TemplateClause"] = 207] = "TemplateClause";
|
||||
SyntaxKind[SyntaxKind["TypeParameter"] = 208] = "TypeParameter";
|
||||
SyntaxKind[SyntaxKind["Constraint"] = 209] = "Constraint";
|
||||
SyntaxKind[SyntaxKind["Parameter"] = 210] = "Parameter";
|
||||
SyntaxKind[SyntaxKind["EnumElement"] = 211] = "EnumElement";
|
||||
SyntaxKind[SyntaxKind["TypeAnnotation"] = 212] = "TypeAnnotation";
|
||||
SyntaxKind[SyntaxKind["ExpressionBody"] = 213] = "ExpressionBody";
|
||||
SyntaxKind[SyntaxKind["ComputedPropertyName"] = 214] = "ComputedPropertyName";
|
||||
SyntaxKind[SyntaxKind["PropertyAssignment"] = 215] = "PropertyAssignment";
|
||||
SyntaxKind[SyntaxKind["TypeAlias"] = 216] = "TypeAlias";
|
||||
SyntaxKind[SyntaxKind["ExternalModuleReference"] = 217] = "ExternalModuleReference";
|
||||
SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 218] = "ModuleNameModuleReference";
|
||||
SyntaxKind[SyntaxKind["FirstStandardKeyword"] = 17] = "FirstStandardKeyword";
|
||||
SyntaxKind[SyntaxKind["LastStandardKeyword"] = 45] = "LastStandardKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = 46] = "FirstFutureReservedKeyword";
|
||||
SyntaxKind[SyntaxKind["LastFutureReservedKeyword"] = 52] = "LastFutureReservedKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstFutureReservedStrictKeyword"] = 53] = "FirstFutureReservedStrictKeyword";
|
||||
SyntaxKind[SyntaxKind["LastFutureReservedStrictKeyword"] = 61] = "LastFutureReservedStrictKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstTypeScriptKeyword"] = 62] = "FirstTypeScriptKeyword";
|
||||
SyntaxKind[SyntaxKind["LastTypeScriptKeyword"] = 74] = "LastTypeScriptKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstKeyword"] = 17] = "FirstKeyword";
|
||||
SyntaxKind[SyntaxKind["LastKeyword"] = 74] = "LastKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstToken"] = 7] = "FirstToken";
|
||||
SyntaxKind[SyntaxKind["LastToken"] = 124] = "LastToken";
|
||||
SyntaxKind[SyntaxKind["FirstPunctuation"] = 75] = "FirstPunctuation";
|
||||
SyntaxKind[SyntaxKind["LastPunctuation"] = 124] = "LastPunctuation";
|
||||
SyntaxKind[SyntaxKind["FirstFixedWidth"] = 17] = "FirstFixedWidth";
|
||||
SyntaxKind[SyntaxKind["LastFixedWidth"] = 124] = "LastFixedWidth";
|
||||
SyntaxKind[SyntaxKind["FirstTrivia"] = 2] = "FirstTrivia";
|
||||
SyntaxKind[SyntaxKind["LastTrivia"] = 6] = "LastTrivia";
|
||||
SyntaxKind[SyntaxKind["FirstNode"] = 125] = "FirstNode";
|
||||
SyntaxKind[SyntaxKind["LastNode"] = 218] = "LastNode";
|
||||
})(TypeScript.SyntaxKind || (TypeScript.SyntaxKind = {}));
|
||||
var SyntaxKind = TypeScript.SyntaxKind;
|
||||
})(TypeScript || (TypeScript = {}));
|
||||
@@ -654,16 +657,18 @@ var TypeScript;
|
||||
(function (SyntaxFacts) {
|
||||
var textToKeywordKind = {
|
||||
"any": 62 /* AnyKeyword */,
|
||||
"boolean": 63 /* BooleanKeyword */,
|
||||
"async": 63 /* AsyncKeyword */,
|
||||
"await": 64 /* AwaitKeyword */,
|
||||
"boolean": 65 /* BooleanKeyword */,
|
||||
"break": 17 /* BreakKeyword */,
|
||||
"case": 18 /* CaseKeyword */,
|
||||
"catch": 19 /* CatchKeyword */,
|
||||
"class": 46 /* ClassKeyword */,
|
||||
"continue": 20 /* ContinueKeyword */,
|
||||
"const": 47 /* ConstKeyword */,
|
||||
"constructor": 64 /* ConstructorKeyword */,
|
||||
"constructor": 66 /* ConstructorKeyword */,
|
||||
"debugger": 21 /* DebuggerKeyword */,
|
||||
"declare": 65 /* DeclareKeyword */,
|
||||
"declare": 67 /* DeclareKeyword */,
|
||||
"default": 22 /* DefaultKeyword */,
|
||||
"delete": 23 /* DeleteKeyword */,
|
||||
"do": 24 /* DoKeyword */,
|
||||
@@ -675,7 +680,7 @@ var TypeScript;
|
||||
"finally": 27 /* FinallyKeyword */,
|
||||
"for": 28 /* ForKeyword */,
|
||||
"function": 29 /* FunctionKeyword */,
|
||||
"get": 66 /* GetKeyword */,
|
||||
"get": 68 /* GetKeyword */,
|
||||
"if": 30 /* IfKeyword */,
|
||||
"implements": 53 /* ImplementsKeyword */,
|
||||
"import": 51 /* ImportKeyword */,
|
||||
@@ -683,81 +688,82 @@ var TypeScript;
|
||||
"instanceof": 32 /* InstanceOfKeyword */,
|
||||
"interface": 54 /* InterfaceKeyword */,
|
||||
"let": 55 /* LetKeyword */,
|
||||
"module": 67 /* ModuleKeyword */,
|
||||
"module": 69 /* ModuleKeyword */,
|
||||
"new": 33 /* NewKeyword */,
|
||||
"null": 34 /* NullKeyword */,
|
||||
"number": 69 /* NumberKeyword */,
|
||||
"number": 71 /* NumberKeyword */,
|
||||
"package": 56 /* PackageKeyword */,
|
||||
"private": 57 /* PrivateKeyword */,
|
||||
"protected": 58 /* ProtectedKeyword */,
|
||||
"public": 59 /* PublicKeyword */,
|
||||
"require": 68 /* RequireKeyword */,
|
||||
"require": 70 /* RequireKeyword */,
|
||||
"return": 35 /* ReturnKeyword */,
|
||||
"set": 70 /* SetKeyword */,
|
||||
"set": 72 /* SetKeyword */,
|
||||
"static": 60 /* StaticKeyword */,
|
||||
"string": 71 /* StringKeyword */,
|
||||
"string": 74 /* StringKeyword */,
|
||||
"super": 52 /* SuperKeyword */,
|
||||
"switch": 36 /* SwitchKeyword */,
|
||||
"this": 37 /* ThisKeyword */,
|
||||
"throw": 38 /* ThrowKeyword */,
|
||||
"true": 39 /* TrueKeyword */,
|
||||
"try": 40 /* TryKeyword */,
|
||||
"type": 73 /* TypeKeyword */,
|
||||
"typeof": 41 /* TypeOfKeyword */,
|
||||
"var": 42 /* VarKeyword */,
|
||||
"void": 43 /* VoidKeyword */,
|
||||
"while": 44 /* WhileKeyword */,
|
||||
"with": 45 /* WithKeyword */,
|
||||
"yield": 61 /* YieldKeyword */,
|
||||
"{": 72 /* OpenBraceToken */,
|
||||
"}": 73 /* CloseBraceToken */,
|
||||
"(": 74 /* OpenParenToken */,
|
||||
")": 75 /* CloseParenToken */,
|
||||
"[": 76 /* OpenBracketToken */,
|
||||
"]": 77 /* CloseBracketToken */,
|
||||
".": 78 /* DotToken */,
|
||||
"...": 79 /* DotDotDotToken */,
|
||||
";": 80 /* SemicolonToken */,
|
||||
",": 81 /* CommaToken */,
|
||||
"<": 82 /* LessThanToken */,
|
||||
">": 83 /* GreaterThanToken */,
|
||||
"<=": 84 /* LessThanEqualsToken */,
|
||||
">=": 85 /* GreaterThanEqualsToken */,
|
||||
"==": 86 /* EqualsEqualsToken */,
|
||||
"=>": 87 /* EqualsGreaterThanToken */,
|
||||
"!=": 88 /* ExclamationEqualsToken */,
|
||||
"===": 89 /* EqualsEqualsEqualsToken */,
|
||||
"!==": 90 /* ExclamationEqualsEqualsToken */,
|
||||
"+": 91 /* PlusToken */,
|
||||
"-": 92 /* MinusToken */,
|
||||
"*": 93 /* AsteriskToken */,
|
||||
"%": 94 /* PercentToken */,
|
||||
"++": 95 /* PlusPlusToken */,
|
||||
"--": 96 /* MinusMinusToken */,
|
||||
"<<": 97 /* LessThanLessThanToken */,
|
||||
">>": 98 /* GreaterThanGreaterThanToken */,
|
||||
">>>": 99 /* GreaterThanGreaterThanGreaterThanToken */,
|
||||
"&": 100 /* AmpersandToken */,
|
||||
"|": 101 /* BarToken */,
|
||||
"^": 102 /* CaretToken */,
|
||||
"!": 103 /* ExclamationToken */,
|
||||
"~": 104 /* TildeToken */,
|
||||
"&&": 105 /* AmpersandAmpersandToken */,
|
||||
"||": 106 /* BarBarToken */,
|
||||
"?": 107 /* QuestionToken */,
|
||||
":": 108 /* ColonToken */,
|
||||
"=": 109 /* EqualsToken */,
|
||||
"+=": 110 /* PlusEqualsToken */,
|
||||
"-=": 111 /* MinusEqualsToken */,
|
||||
"*=": 112 /* AsteriskEqualsToken */,
|
||||
"%=": 113 /* PercentEqualsToken */,
|
||||
"<<=": 114 /* LessThanLessThanEqualsToken */,
|
||||
">>=": 115 /* GreaterThanGreaterThanEqualsToken */,
|
||||
">>>=": 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */,
|
||||
"&=": 117 /* AmpersandEqualsToken */,
|
||||
"|=": 118 /* BarEqualsToken */,
|
||||
"^=": 119 /* CaretEqualsToken */,
|
||||
"/": 120 /* SlashToken */,
|
||||
"/=": 121 /* SlashEqualsToken */
|
||||
"{": 75 /* OpenBraceToken */,
|
||||
"}": 76 /* CloseBraceToken */,
|
||||
"(": 77 /* OpenParenToken */,
|
||||
")": 78 /* CloseParenToken */,
|
||||
"[": 79 /* OpenBracketToken */,
|
||||
"]": 80 /* CloseBracketToken */,
|
||||
".": 81 /* DotToken */,
|
||||
"...": 82 /* DotDotDotToken */,
|
||||
";": 83 /* SemicolonToken */,
|
||||
",": 84 /* CommaToken */,
|
||||
"<": 85 /* LessThanToken */,
|
||||
">": 86 /* GreaterThanToken */,
|
||||
"<=": 87 /* LessThanEqualsToken */,
|
||||
">=": 88 /* GreaterThanEqualsToken */,
|
||||
"==": 89 /* EqualsEqualsToken */,
|
||||
"=>": 90 /* EqualsGreaterThanToken */,
|
||||
"!=": 91 /* ExclamationEqualsToken */,
|
||||
"===": 92 /* EqualsEqualsEqualsToken */,
|
||||
"!==": 93 /* ExclamationEqualsEqualsToken */,
|
||||
"+": 94 /* PlusToken */,
|
||||
"-": 95 /* MinusToken */,
|
||||
"*": 96 /* AsteriskToken */,
|
||||
"%": 97 /* PercentToken */,
|
||||
"++": 98 /* PlusPlusToken */,
|
||||
"--": 99 /* MinusMinusToken */,
|
||||
"<<": 100 /* LessThanLessThanToken */,
|
||||
">>": 101 /* GreaterThanGreaterThanToken */,
|
||||
">>>": 102 /* GreaterThanGreaterThanGreaterThanToken */,
|
||||
"&": 103 /* AmpersandToken */,
|
||||
"|": 104 /* BarToken */,
|
||||
"^": 105 /* CaretToken */,
|
||||
"!": 106 /* ExclamationToken */,
|
||||
"~": 107 /* TildeToken */,
|
||||
"&&": 108 /* AmpersandAmpersandToken */,
|
||||
"||": 109 /* BarBarToken */,
|
||||
"?": 110 /* QuestionToken */,
|
||||
":": 111 /* ColonToken */,
|
||||
"=": 112 /* EqualsToken */,
|
||||
"+=": 113 /* PlusEqualsToken */,
|
||||
"-=": 114 /* MinusEqualsToken */,
|
||||
"*=": 115 /* AsteriskEqualsToken */,
|
||||
"%=": 116 /* PercentEqualsToken */,
|
||||
"<<=": 117 /* LessThanLessThanEqualsToken */,
|
||||
">>=": 118 /* GreaterThanGreaterThanEqualsToken */,
|
||||
">>>=": 119 /* GreaterThanGreaterThanGreaterThanEqualsToken */,
|
||||
"&=": 120 /* AmpersandEqualsToken */,
|
||||
"|=": 121 /* BarEqualsToken */,
|
||||
"^=": 122 /* CaretEqualsToken */,
|
||||
"/": 123 /* SlashToken */,
|
||||
"/=": 124 /* SlashEqualsToken */
|
||||
};
|
||||
var kindToText = new Array();
|
||||
for (var name in textToKeywordKind) {
|
||||
@@ -765,7 +771,7 @@ var TypeScript;
|
||||
kindToText[textToKeywordKind[name]] = name;
|
||||
}
|
||||
}
|
||||
kindToText[64 /* ConstructorKeyword */] = "constructor";
|
||||
kindToText[66 /* ConstructorKeyword */] = "constructor";
|
||||
function getTokenKind(text) {
|
||||
if (textToKeywordKind.hasOwnProperty(text)) {
|
||||
return textToKeywordKind[text];
|
||||
@@ -779,21 +785,21 @@ var TypeScript;
|
||||
}
|
||||
SyntaxFacts.getText = getText;
|
||||
function isAnyKeyword(kind) {
|
||||
return kind >= TypeScript.SyntaxKind.FirstKeyword && kind <= TypeScript.SyntaxKind.LastKeyword;
|
||||
return kind >= 17 /* FirstKeyword */ && kind <= 74 /* LastKeyword */;
|
||||
}
|
||||
SyntaxFacts.isAnyKeyword = isAnyKeyword;
|
||||
function isAnyPunctuation(kind) {
|
||||
return kind >= TypeScript.SyntaxKind.FirstPunctuation && kind <= TypeScript.SyntaxKind.LastPunctuation;
|
||||
return kind >= 75 /* FirstPunctuation */ && kind <= 124 /* LastPunctuation */;
|
||||
}
|
||||
SyntaxFacts.isAnyPunctuation = isAnyPunctuation;
|
||||
function isPrefixUnaryExpressionOperatorToken(tokenKind) {
|
||||
switch (tokenKind) {
|
||||
case 91 /* PlusToken */:
|
||||
case 92 /* MinusToken */:
|
||||
case 104 /* TildeToken */:
|
||||
case 103 /* ExclamationToken */:
|
||||
case 95 /* PlusPlusToken */:
|
||||
case 96 /* MinusMinusToken */:
|
||||
case 94 /* PlusToken */:
|
||||
case 95 /* MinusToken */:
|
||||
case 107 /* TildeToken */:
|
||||
case 106 /* ExclamationToken */:
|
||||
case 98 /* PlusPlusToken */:
|
||||
case 99 /* MinusMinusToken */:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -802,42 +808,42 @@ var TypeScript;
|
||||
SyntaxFacts.isPrefixUnaryExpressionOperatorToken = isPrefixUnaryExpressionOperatorToken;
|
||||
function isBinaryExpressionOperatorToken(tokenKind) {
|
||||
switch (tokenKind) {
|
||||
case 93 /* AsteriskToken */:
|
||||
case 120 /* SlashToken */:
|
||||
case 94 /* PercentToken */:
|
||||
case 91 /* PlusToken */:
|
||||
case 92 /* MinusToken */:
|
||||
case 97 /* LessThanLessThanToken */:
|
||||
case 98 /* GreaterThanGreaterThanToken */:
|
||||
case 99 /* GreaterThanGreaterThanGreaterThanToken */:
|
||||
case 82 /* LessThanToken */:
|
||||
case 83 /* GreaterThanToken */:
|
||||
case 84 /* LessThanEqualsToken */:
|
||||
case 85 /* GreaterThanEqualsToken */:
|
||||
case 96 /* AsteriskToken */:
|
||||
case 123 /* SlashToken */:
|
||||
case 97 /* PercentToken */:
|
||||
case 94 /* PlusToken */:
|
||||
case 95 /* MinusToken */:
|
||||
case 100 /* LessThanLessThanToken */:
|
||||
case 101 /* GreaterThanGreaterThanToken */:
|
||||
case 102 /* GreaterThanGreaterThanGreaterThanToken */:
|
||||
case 85 /* LessThanToken */:
|
||||
case 86 /* GreaterThanToken */:
|
||||
case 87 /* LessThanEqualsToken */:
|
||||
case 88 /* GreaterThanEqualsToken */:
|
||||
case 32 /* InstanceOfKeyword */:
|
||||
case 31 /* InKeyword */:
|
||||
case 86 /* EqualsEqualsToken */:
|
||||
case 88 /* ExclamationEqualsToken */:
|
||||
case 89 /* EqualsEqualsEqualsToken */:
|
||||
case 90 /* ExclamationEqualsEqualsToken */:
|
||||
case 100 /* AmpersandToken */:
|
||||
case 102 /* CaretToken */:
|
||||
case 101 /* BarToken */:
|
||||
case 105 /* AmpersandAmpersandToken */:
|
||||
case 106 /* BarBarToken */:
|
||||
case 118 /* BarEqualsToken */:
|
||||
case 117 /* AmpersandEqualsToken */:
|
||||
case 119 /* CaretEqualsToken */:
|
||||
case 114 /* LessThanLessThanEqualsToken */:
|
||||
case 115 /* GreaterThanGreaterThanEqualsToken */:
|
||||
case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
||||
case 110 /* PlusEqualsToken */:
|
||||
case 111 /* MinusEqualsToken */:
|
||||
case 112 /* AsteriskEqualsToken */:
|
||||
case 121 /* SlashEqualsToken */:
|
||||
case 113 /* PercentEqualsToken */:
|
||||
case 109 /* EqualsToken */:
|
||||
case 81 /* CommaToken */:
|
||||
case 89 /* EqualsEqualsToken */:
|
||||
case 91 /* ExclamationEqualsToken */:
|
||||
case 92 /* EqualsEqualsEqualsToken */:
|
||||
case 93 /* ExclamationEqualsEqualsToken */:
|
||||
case 103 /* AmpersandToken */:
|
||||
case 105 /* CaretToken */:
|
||||
case 104 /* BarToken */:
|
||||
case 108 /* AmpersandAmpersandToken */:
|
||||
case 109 /* BarBarToken */:
|
||||
case 121 /* BarEqualsToken */:
|
||||
case 120 /* AmpersandEqualsToken */:
|
||||
case 122 /* CaretEqualsToken */:
|
||||
case 117 /* LessThanLessThanEqualsToken */:
|
||||
case 118 /* GreaterThanGreaterThanEqualsToken */:
|
||||
case 119 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
||||
case 113 /* PlusEqualsToken */:
|
||||
case 114 /* MinusEqualsToken */:
|
||||
case 115 /* AsteriskEqualsToken */:
|
||||
case 124 /* SlashEqualsToken */:
|
||||
case 116 /* PercentEqualsToken */:
|
||||
case 112 /* EqualsToken */:
|
||||
case 84 /* CommaToken */:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -846,18 +852,18 @@ var TypeScript;
|
||||
SyntaxFacts.isBinaryExpressionOperatorToken = isBinaryExpressionOperatorToken;
|
||||
function isAssignmentOperatorToken(tokenKind) {
|
||||
switch (tokenKind) {
|
||||
case 118 /* BarEqualsToken */:
|
||||
case 117 /* AmpersandEqualsToken */:
|
||||
case 119 /* CaretEqualsToken */:
|
||||
case 114 /* LessThanLessThanEqualsToken */:
|
||||
case 115 /* GreaterThanGreaterThanEqualsToken */:
|
||||
case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
||||
case 110 /* PlusEqualsToken */:
|
||||
case 111 /* MinusEqualsToken */:
|
||||
case 112 /* AsteriskEqualsToken */:
|
||||
case 121 /* SlashEqualsToken */:
|
||||
case 113 /* PercentEqualsToken */:
|
||||
case 109 /* EqualsToken */:
|
||||
case 121 /* BarEqualsToken */:
|
||||
case 120 /* AmpersandEqualsToken */:
|
||||
case 122 /* CaretEqualsToken */:
|
||||
case 117 /* LessThanLessThanEqualsToken */:
|
||||
case 118 /* GreaterThanGreaterThanEqualsToken */:
|
||||
case 119 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
||||
case 113 /* PlusEqualsToken */:
|
||||
case 114 /* MinusEqualsToken */:
|
||||
case 115 /* AsteriskEqualsToken */:
|
||||
case 124 /* SlashEqualsToken */:
|
||||
case 116 /* PercentEqualsToken */:
|
||||
case 112 /* EqualsToken */:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -866,18 +872,18 @@ var TypeScript;
|
||||
SyntaxFacts.isAssignmentOperatorToken = isAssignmentOperatorToken;
|
||||
function isType(kind) {
|
||||
switch (kind) {
|
||||
case 126 /* ArrayType */:
|
||||
case 129 /* ArrayType */:
|
||||
case 62 /* AnyKeyword */:
|
||||
case 69 /* NumberKeyword */:
|
||||
case 63 /* BooleanKeyword */:
|
||||
case 71 /* StringKeyword */:
|
||||
case 71 /* NumberKeyword */:
|
||||
case 65 /* BooleanKeyword */:
|
||||
case 74 /* StringKeyword */:
|
||||
case 43 /* VoidKeyword */:
|
||||
case 125 /* FunctionType */:
|
||||
case 124 /* ObjectType */:
|
||||
case 127 /* ConstructorType */:
|
||||
case 129 /* TypeQuery */:
|
||||
case 128 /* GenericType */:
|
||||
case 123 /* QualifiedName */:
|
||||
case 128 /* FunctionType */:
|
||||
case 127 /* ObjectType */:
|
||||
case 130 /* ConstructorType */:
|
||||
case 132 /* TypeQuery */:
|
||||
case 131 /* GenericType */:
|
||||
case 126 /* QualifiedName */:
|
||||
case 9 /* IdentifierName */:
|
||||
return true;
|
||||
}
|
||||
@@ -947,6 +953,7 @@ var definitions = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IModuleElementSyntax'],
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'exportKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'equalsToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true },
|
||||
@@ -1007,6 +1014,20 @@ var definitions = [
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'TypeAliasSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IModuleElementSyntax'],
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'typeKeyword', isToken: true },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'equalsToken', isToken: true },
|
||||
{ name: 'type', type: 'ITypeSyntax' },
|
||||
{ name: 'semicolonToken', isToken: true, isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'FunctionDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
@@ -1042,7 +1063,7 @@ var definitions = [
|
||||
name: 'VariableDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
children: [
|
||||
{ name: 'varKeyword', isToken: true },
|
||||
{ name: 'varConstOrLetKeyword', isToken: true },
|
||||
{ name: 'variableDeclarators', isSeparatedList: true, requiresAtLeastOneItem: true, elementType: 'VariableDeclaratorSyntax' }
|
||||
]
|
||||
},
|
||||
@@ -1103,6 +1124,7 @@ var definitions = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'asyncKeyword', isToken: true, isOptional: true },
|
||||
{ name: 'parameter', type: 'ParameterSyntax' },
|
||||
{ name: 'equalsGreaterThanToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'body', type: 'BlockSyntax | IExpressionSyntax' }
|
||||
@@ -1114,6 +1136,7 @@ var definitions = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'asyncKeyword', isToken: true, isOptional: true },
|
||||
{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
{ name: 'equalsGreaterThanToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'body', type: 'BlockSyntax | IExpressionSyntax' }
|
||||
@@ -1172,7 +1195,7 @@ var definitions = [
|
||||
interfaces: ['ITypeSyntax'],
|
||||
children: [
|
||||
{ name: 'openBraceToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'typeMembers', isSeparatedList: true, elementType: 'ITypeMemberSyntax' },
|
||||
{ name: 'typeMembers', isList: true, elementType: 'ITypeMemberSyntax' },
|
||||
{ name: 'closeBraceToken', isToken: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@@ -1274,7 +1297,7 @@ var definitions = [
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'MemberAccessExpressionSyntax',
|
||||
name: 'PropertyAccessExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberExpressionSyntax', 'ICallExpressionSyntax'],
|
||||
children: [
|
||||
@@ -1393,12 +1416,14 @@ var definitions = [
|
||||
{
|
||||
name: 'IndexSignatureSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['ITypeMemberSyntax'],
|
||||
interfaces: ['ITypeMemberSyntax', 'IClassElementSyntax'],
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'openBracketToken', isToken: true },
|
||||
{ name: 'parameters', isSeparatedList: true, elementType: 'ParameterSyntax' },
|
||||
{ name: 'closeBracketToken', isToken: true },
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true }
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true },
|
||||
{ name: 'semicolonOrCommaToken', isToken: true, isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
@@ -1409,7 +1434,8 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
{ name: 'questionToken', isToken: true, isOptional: true },
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true }
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true },
|
||||
{ name: 'semicolonOrCommaToken', isToken: true, isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
@@ -1420,7 +1446,8 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'typeParameterList', type: 'TypeParameterListSyntax', isOptional: true, isTypeScriptSpecific: true },
|
||||
{ name: 'parameterList', type: 'ParameterListSyntax' },
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecific: true }
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecific: true },
|
||||
{ name: 'semicolonOrCommaToken', isToken: true, isOptional: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1503,9 +1530,9 @@ var definitions = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'MemberFunctionDeclarationSyntax',
|
||||
name: 'MethodDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
interfaces: ['IMemberDeclarationSyntax', 'IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
@@ -1541,7 +1568,7 @@ var definitions = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'MemberVariableDeclarationSyntax',
|
||||
name: 'PropertyDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
children: [
|
||||
@@ -1551,17 +1578,6 @@ var definitions = [
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'IndexMemberDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IClassElementSyntax'],
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'indexSignature', type: 'IndexSignatureSyntax' },
|
||||
{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'ThrowStatementSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
@@ -1724,7 +1740,7 @@ var definitions = [
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'CastExpressionSyntax',
|
||||
name: 'TypeAssertionExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
@@ -1756,7 +1772,7 @@ var definitions = [
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'SimplePropertyAssignmentSyntax',
|
||||
name: 'PropertyAssignmentSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
@@ -1765,22 +1781,12 @@ var definitions = [
|
||||
{ name: 'expression', type: 'IExpressionSyntax' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'FunctionPropertyAssignmentSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'FunctionExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPrimaryExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'asyncKeyword', isToken: true, isOptional: true },
|
||||
{ name: 'functionKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'identifier', isToken: true, isOptional: true },
|
||||
@@ -1888,6 +1894,15 @@ var definitions = [
|
||||
{ name: 'expression', type: 'IExpressionSyntax', isOptional: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'AwaitExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'awaitKeyword', isToken: true },
|
||||
{ name: 'expression', type: 'IUnaryExpressionSyntax', isOptional: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'DebuggerStatementSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
@@ -1898,9 +1913,13 @@ var definitions = [
|
||||
]
|
||||
}
|
||||
];
|
||||
function getSyntaxKindEnum() {
|
||||
var name = "SyntaxKind";
|
||||
return TypeScript[name];
|
||||
}
|
||||
function firstKind(definition) {
|
||||
var kindName = getNameWithoutSuffix(definition);
|
||||
return TypeScript.SyntaxKind[kindName];
|
||||
return getSyntaxKindEnum()[kindName];
|
||||
}
|
||||
definitions.sort(function (d1, d2) { return firstKind(d1) - firstKind(d2); });
|
||||
function getStringWithoutSuffix(definition) {
|
||||
@@ -2109,7 +2128,7 @@ function generateKeywordCondition(keywords, currentCharacter, indent) {
|
||||
if (keywords.length === 1) {
|
||||
var keyword = keywords[0];
|
||||
if (currentCharacter === length) {
|
||||
return " return SyntaxKind." + firstEnumName(TypeScript.SyntaxKind, keyword.kind) + ";\r\n";
|
||||
return " return SyntaxKind." + firstEnumName(getSyntaxKindEnum(), keyword.kind) + ";\r\n";
|
||||
}
|
||||
var keywordText = keywords[0].text;
|
||||
result = " return (";
|
||||
@@ -2120,7 +2139,7 @@ function generateKeywordCondition(keywords, currentCharacter, indent) {
|
||||
index = i === 0 ? "start" : ("start + " + i);
|
||||
result += "str.charCodeAt(" + index + ") === CharacterCodes." + keywordText.substr(i, 1);
|
||||
}
|
||||
result += ") ? SyntaxKind." + firstEnumName(TypeScript.SyntaxKind, keyword.kind) + " : SyntaxKind.IdentifierName;\r\n";
|
||||
result += ") ? SyntaxKind." + firstEnumName(getSyntaxKindEnum(), keyword.kind) + " : SyntaxKind.IdentifierName;\r\n";
|
||||
}
|
||||
else {
|
||||
result += " // " + TypeScript.ArrayUtilities.select(keywords, function (k) { return k.text; }).join(", ") + "\r\n";
|
||||
@@ -2160,12 +2179,16 @@ function max(array, func) {
|
||||
}
|
||||
function generateUtilities() {
|
||||
var result = "";
|
||||
result += " var fixedWidthArray = [";
|
||||
for (var i = 0; i <= TypeScript.SyntaxKind.LastFixedWidth; i++) {
|
||||
return result;
|
||||
}
|
||||
function generateScannerUtilities() {
|
||||
var result = "///<reference path='references.ts' />\r\n" + "\r\n" + "module TypeScript {\r\n" + " export module ScannerUtilities {\r\n";
|
||||
result += " export var fixedWidthArray = [";
|
||||
for (var i = 0; i <= 124 /* LastFixedWidth */; i++) {
|
||||
if (i) {
|
||||
result += ", ";
|
||||
}
|
||||
if (i < TypeScript.SyntaxKind.FirstFixedWidth) {
|
||||
if (i < 17 /* FirstFixedWidth */) {
|
||||
result += "0";
|
||||
}
|
||||
else {
|
||||
@@ -2173,16 +2196,9 @@ function generateUtilities() {
|
||||
}
|
||||
}
|
||||
result += "];\r\n";
|
||||
result += " function fixedWidthTokenLength(kind: SyntaxKind) {\r\n";
|
||||
result += " return fixedWidthArray[kind];\r\n";
|
||||
result += " }\r\n";
|
||||
return result;
|
||||
}
|
||||
function generateScannerUtilities() {
|
||||
var result = "///<reference path='references.ts' />\r\n" + "\r\n" + "module TypeScript {\r\n" + " export module ScannerUtilities {\r\n";
|
||||
var i;
|
||||
var keywords = [];
|
||||
for (i = TypeScript.SyntaxKind.FirstKeyword; i <= TypeScript.SyntaxKind.LastKeyword; i++) {
|
||||
for (i = 17 /* FirstKeyword */; i <= 74 /* LastKeyword */; i++) {
|
||||
keywords.push({ kind: i, text: TypeScript.SyntaxFacts.getText(i) });
|
||||
}
|
||||
keywords.sort(function (a, b) { return a.text.localeCompare(b.text); });
|
||||
@@ -2205,8 +2221,8 @@ function generateScannerUtilities() {
|
||||
return result;
|
||||
}
|
||||
function syntaxKindName(kind) {
|
||||
for (var name in TypeScript.SyntaxKind) {
|
||||
if (TypeScript.SyntaxKind[name] === kind) {
|
||||
for (var name in getSyntaxKindEnum()) {
|
||||
if (getSyntaxKindEnum()[name] === kind) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,19 +6,21 @@ module TypeScript {
|
||||
DisallowIn = 1 << 1,
|
||||
Yield = 1 << 2,
|
||||
GeneratorParameter = 1 << 3,
|
||||
Async = 1 << 4,
|
||||
|
||||
Mask = 0xF
|
||||
Mask = 0x1F
|
||||
}
|
||||
|
||||
export enum SyntaxNodeConstants {
|
||||
None = 0,
|
||||
|
||||
// The first four bit of the flags are used to store parser context flags.
|
||||
// The width of the node is stored in the remainder of the int. This allows us up to 128MB
|
||||
// for a node by using all 27 bits. However, in the common case, we'll use less than 27 bits
|
||||
// for the width. Thus, the info will be stored in a single int in chakra.
|
||||
DataComputed = 1 << 4, // 0000 0000 0000 0000 0000 0000 0001 0000
|
||||
IncrementallyUnusableMask = 1 << 5, // 0000 0000 0000 0000 0000 0000 0010 0000
|
||||
FullWidthShift = 1 << 6, // 1111 1111 1111 1111 1111 1111 1100 0000
|
||||
// The first five bit of the flags are used to store parser context flags. The next bit
|
||||
// marks if we've computed the transitive data for the node. The next bit marks if the node
|
||||
// is incrementally unusable.
|
||||
//
|
||||
// The width of the node is stored in the remainder of the number.
|
||||
DataComputed = 1 << 5, // 0000 0000 0000 0000 0000 0000 0010 0000
|
||||
IncrementallyUnusableMask = 1 << 6, // 0000 0000 0000 0000 0000 0000 0100 0000
|
||||
FullWidthShift = 1 << 7, // 1111 1111 1111 1111 1111 1111 1000 0000
|
||||
}
|
||||
}
|
||||
+776
-531
File diff suppressed because it is too large
Load Diff
@@ -266,6 +266,20 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendObjectType(node.body, /*appendNewLines:*/ true);
|
||||
}
|
||||
|
||||
public visitTypeAlias(node: TypeAliasSyntax): void {
|
||||
this.appendSpaceList(node.modifiers);
|
||||
this.ensureSpace();
|
||||
this.appendToken(node.typeKeyword);
|
||||
this.ensureSpace();
|
||||
this.appendToken(node.identifier);
|
||||
this.ensureSpace();
|
||||
this.appendToken(node.equalsToken);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.appendToken(node.semicolonToken);
|
||||
|
||||
}
|
||||
|
||||
private appendObjectType(node: ObjectTypeSyntax, appendNewLines: boolean): void {
|
||||
this.appendToken(node.openBraceToken);
|
||||
|
||||
@@ -350,7 +364,7 @@ module TypeScript.PrettyPrinter {
|
||||
}
|
||||
|
||||
public visitVariableDeclaration(node: VariableDeclarationSyntax): void {
|
||||
this.appendToken(node.varKeyword);
|
||||
this.appendToken(node.varConstOrLetKeyword);
|
||||
this.ensureSpace();
|
||||
this.appendSeparatorSpaceList(node.variableDeclarators);
|
||||
}
|
||||
@@ -521,7 +535,7 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendNode(node.equalsValueClause);
|
||||
}
|
||||
|
||||
public visitMemberAccessExpression(node: MemberAccessExpressionSyntax): void {
|
||||
public visitPropertyAccessExpression(node: PropertyAccessExpressionSyntax): void {
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.appendToken(node.dotToken);
|
||||
this.appendToken(node.name);
|
||||
@@ -586,16 +600,19 @@ module TypeScript.PrettyPrinter {
|
||||
}
|
||||
|
||||
public visitIndexSignature(node: IndexSignatureSyntax): void {
|
||||
this.appendSpaceList(node.modifiers);
|
||||
this.appendToken(node.openBracketToken);
|
||||
this.appendSeparatorSpaceList(node.parameters)
|
||||
this.appendToken(node.closeBracketToken);
|
||||
this.appendNode(node.typeAnnotation);
|
||||
this.appendToken(node.semicolonOrCommaToken);
|
||||
}
|
||||
|
||||
public visitPropertySignature(node: PropertySignatureSyntax): void {
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
this.appendToken(node.questionToken);
|
||||
this.appendNode(node.typeAnnotation);
|
||||
this.appendToken(node.semicolonOrCommaToken);
|
||||
}
|
||||
|
||||
public visitParameterList(node: ParameterListSyntax): void {
|
||||
@@ -608,6 +625,7 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendNode(node.typeParameterList);
|
||||
visitNodeOrToken(this, node.parameterList);
|
||||
this.appendNode(node.typeAnnotation);
|
||||
this.appendToken(node.semicolonOrCommaToken);
|
||||
}
|
||||
|
||||
public visitTypeParameterList(node: TypeParameterListSyntax): void {
|
||||
@@ -675,14 +693,7 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendBody(node.body);
|
||||
}
|
||||
|
||||
public visitIndexMemberDeclaration(node: IndexMemberDeclarationSyntax): void {
|
||||
this.appendSpaceList(node.modifiers);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.indexSignature);
|
||||
this.appendToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): void {
|
||||
public visitMethodDeclaration(node: MethodDeclarationSyntax): void {
|
||||
this.appendSpaceList(node.modifiers);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
@@ -712,7 +723,7 @@ module TypeScript.PrettyPrinter {
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitMemberVariableDeclaration(node: MemberVariableDeclarationSyntax): void {
|
||||
public visitPropertyDeclaration(node: PropertyDeclarationSyntax): void {
|
||||
this.appendSpaceList(node.modifiers);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.variableDeclarator);
|
||||
@@ -899,7 +910,7 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendNode(node.equalsValueClause);
|
||||
}
|
||||
|
||||
public visitCastExpression(node: CastExpressionSyntax): void {
|
||||
public visitTypeAssertionExpression(node: TypeAssertionExpressionSyntax): void {
|
||||
this.appendToken(node.lessThanToken);
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.appendToken(node.greaterThanToken);
|
||||
@@ -931,20 +942,13 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendToken(node.closeBracketToken);
|
||||
}
|
||||
|
||||
public visitSimplePropertyAssignment(node: SimplePropertyAssignmentSyntax): void {
|
||||
public visitPropertyAssignment(node: PropertyAssignmentSyntax): void {
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
this.appendToken(node.colonToken);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitFunctionPropertyAssignment(node: FunctionPropertyAssignmentSyntax): void {
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitFunctionExpression(node: FunctionExpressionSyntax): void {
|
||||
this.appendToken(node.functionKeyword);
|
||||
|
||||
@@ -1027,6 +1031,14 @@ module TypeScript.PrettyPrinter {
|
||||
public visitYieldExpression(node: YieldExpressionSyntax): void {
|
||||
this.appendToken(node.yieldKeyword);
|
||||
this.ensureSpace();
|
||||
this.appendToken(node.asterixToken);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitAwaitExpression(node: AwaitExpressionSyntax): void {
|
||||
this.appendToken(node.awaitKeyword);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
// Scanner depends on SyntaxKind and SyntaxFacts
|
||||
///<reference path='syntaxKind.ts' />
|
||||
///<reference path='syntaxFacts.ts' />
|
||||
///<reference path='scannerUtilities.generated.ts' />
|
||||
///<reference path='scanner.ts' />
|
||||
|
||||
///<reference path='scannerUtilities.generated.ts' />
|
||||
///<reference path='slidingWindow.ts' />
|
||||
///<reference path='syntax.ts' />
|
||||
///<reference path='syntaxElement.ts' />
|
||||
@@ -34,8 +34,6 @@
|
||||
// SyntaxInformationMap depends on SyntaxWalker
|
||||
// ///<reference path='syntaxNodeInvariantsChecker.ts' />
|
||||
|
||||
// DepthLimitedWalker depends on PositionTrackingWalker
|
||||
///<reference path='depthLimitedWalker.ts' />
|
||||
///<reference path='parser.ts' />
|
||||
|
||||
// Concrete nodes depend on the parser.
|
||||
|
||||
@@ -202,6 +202,7 @@ module TypeScript.Scanner {
|
||||
public childCount: number;
|
||||
|
||||
constructor(private _fullStart: number, public kind: SyntaxKind) {
|
||||
Debug.assert(!isNaN(_fullStart));
|
||||
}
|
||||
|
||||
public setFullStart(fullStart: number): void {
|
||||
@@ -236,6 +237,7 @@ module TypeScript.Scanner {
|
||||
private cachedText: string;
|
||||
|
||||
constructor(private _fullStart: number, public kind: SyntaxKind, private _packedFullWidthAndInfo: number, cachedText: string) {
|
||||
Debug.assert(!isNaN(_fullStart));
|
||||
if (cachedText !== undefined) {
|
||||
this.cachedText = cachedText;
|
||||
}
|
||||
@@ -1480,6 +1482,7 @@ module TypeScript.Scanner {
|
||||
}
|
||||
|
||||
function absolutePosition() {
|
||||
Debug.assert(!isNaN(_absolutePosition));
|
||||
return _absolutePosition;
|
||||
}
|
||||
|
||||
@@ -1551,6 +1554,7 @@ module TypeScript.Scanner {
|
||||
// We're consuming the token that was just fetched from us by the parser. We just
|
||||
// need to move ourselves forward and ditch this token from the sliding window.
|
||||
_absolutePosition += (<ISyntaxToken>nodeOrToken).fullWidth();
|
||||
Debug.assert(!isNaN(_absolutePosition));
|
||||
slidingWindow.moveToNextItem();
|
||||
}
|
||||
else {
|
||||
@@ -1646,7 +1650,7 @@ module TypeScript.Scanner {
|
||||
};
|
||||
}
|
||||
|
||||
var fixedWidthArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 5, 8, 8, 7, 6, 2, 4, 5, 7, 3, 8, 2, 2, 10, 3, 4, 6, 6, 4, 5, 4, 3, 6, 3, 4, 5, 4, 5, 5, 4, 6, 7, 6, 5, 10, 9, 3, 7, 7, 9, 6, 6, 5, 3, 7, 11, 7, 3, 6, 7, 6, 3, 6, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 2, 2, 2, 1, 2];
|
||||
var fixedWidthArray = ScannerUtilities.fixedWidthArray;
|
||||
function fixedWidthTokenLength(kind: SyntaxKind) {
|
||||
return fixedWidthArray[kind];
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
module TypeScript {
|
||||
export module ScannerUtilities {
|
||||
export var fixedWidthArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 5, 8, 8, 7, 6, 2, 4, 5, 7, 3, 8, 2, 2, 10, 3, 4, 6, 6, 4, 5, 4, 3, 6, 3, 4, 5, 4, 5, 5, 4, 6, 7, 6, 5, 10, 9, 3, 7, 7, 9, 6, 6, 5, 3, 5, 5, 7, 11, 7, 3, 6, 7, 6, 3, 4, 6, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 2, 2, 2, 1, 2];
|
||||
export function identifierKind(str: string, start: number, length: number): SyntaxKind {
|
||||
switch (length) {
|
||||
case 2: // do, if, in
|
||||
@@ -27,7 +28,7 @@ module TypeScript {
|
||||
case CharacterCodes.v: return (str.charCodeAt(start + 1) === CharacterCodes.a && str.charCodeAt(start + 2) === CharacterCodes.r) ? SyntaxKind.VarKeyword : SyntaxKind.IdentifierName;
|
||||
default: return SyntaxKind.IdentifierName;
|
||||
}
|
||||
case 4: // case, else, enum, null, this, true, void, with
|
||||
case 4: // case, else, enum, null, this, true, type, void, with
|
||||
switch(str.charCodeAt(start)) {
|
||||
case CharacterCodes.c: return (str.charCodeAt(start + 1) === CharacterCodes.a && str.charCodeAt(start + 2) === CharacterCodes.s && str.charCodeAt(start + 3) === CharacterCodes.e) ? SyntaxKind.CaseKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.e: // else, enum
|
||||
@@ -37,18 +38,25 @@ module TypeScript {
|
||||
default: return SyntaxKind.IdentifierName;
|
||||
}
|
||||
case CharacterCodes.n: return (str.charCodeAt(start + 1) === CharacterCodes.u && str.charCodeAt(start + 2) === CharacterCodes.l && str.charCodeAt(start + 3) === CharacterCodes.l) ? SyntaxKind.NullKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.t: // this, true
|
||||
case CharacterCodes.t: // this, true, type
|
||||
switch(str.charCodeAt(start + 1)) {
|
||||
case CharacterCodes.h: return (str.charCodeAt(start + 2) === CharacterCodes.i && str.charCodeAt(start + 3) === CharacterCodes.s) ? SyntaxKind.ThisKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.r: return (str.charCodeAt(start + 2) === CharacterCodes.u && str.charCodeAt(start + 3) === CharacterCodes.e) ? SyntaxKind.TrueKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.y: return (str.charCodeAt(start + 2) === CharacterCodes.p && str.charCodeAt(start + 3) === CharacterCodes.e) ? SyntaxKind.TypeKeyword : SyntaxKind.IdentifierName;
|
||||
default: return SyntaxKind.IdentifierName;
|
||||
}
|
||||
case CharacterCodes.v: return (str.charCodeAt(start + 1) === CharacterCodes.o && str.charCodeAt(start + 2) === CharacterCodes.i && str.charCodeAt(start + 3) === CharacterCodes.d) ? SyntaxKind.VoidKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.w: return (str.charCodeAt(start + 1) === CharacterCodes.i && str.charCodeAt(start + 2) === CharacterCodes.t && str.charCodeAt(start + 3) === CharacterCodes.h) ? SyntaxKind.WithKeyword : SyntaxKind.IdentifierName;
|
||||
default: return SyntaxKind.IdentifierName;
|
||||
}
|
||||
case 5: // break, catch, class, const, false, super, throw, while, yield
|
||||
case 5: // async, await, break, catch, class, const, false, super, throw, while, yield
|
||||
switch(str.charCodeAt(start)) {
|
||||
case CharacterCodes.a: // async, await
|
||||
switch(str.charCodeAt(start + 1)) {
|
||||
case CharacterCodes.s: return (str.charCodeAt(start + 2) === CharacterCodes.y && str.charCodeAt(start + 3) === CharacterCodes.n && str.charCodeAt(start + 4) === CharacterCodes.c) ? SyntaxKind.AsyncKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.w: return (str.charCodeAt(start + 2) === CharacterCodes.a && str.charCodeAt(start + 3) === CharacterCodes.i && str.charCodeAt(start + 4) === CharacterCodes.t) ? SyntaxKind.AwaitKeyword : SyntaxKind.IdentifierName;
|
||||
default: return SyntaxKind.IdentifierName;
|
||||
}
|
||||
case CharacterCodes.b: return (str.charCodeAt(start + 1) === CharacterCodes.r && str.charCodeAt(start + 2) === CharacterCodes.e && str.charCodeAt(start + 3) === CharacterCodes.a && str.charCodeAt(start + 4) === CharacterCodes.k) ? SyntaxKind.BreakKeyword : SyntaxKind.IdentifierName;
|
||||
case CharacterCodes.c: // catch, class, const
|
||||
switch(str.charCodeAt(start + 1)) {
|
||||
|
||||
@@ -42,6 +42,10 @@ module TypeScript {
|
||||
return (parserContextFlags(node) & ParserContextFlags.GeneratorParameter) !== 0;
|
||||
}
|
||||
|
||||
export function parsedInAsyncContext(node: ISyntaxNode): boolean {
|
||||
return (parserContextFlags(node) & ParserContextFlags.Async) !== 0;
|
||||
}
|
||||
|
||||
export function previousToken(token: ISyntaxToken): ISyntaxToken {
|
||||
var start = token.fullStart();
|
||||
if (start === 0) {
|
||||
@@ -296,7 +300,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
if ((info & SyntaxNodeConstants.DataComputed) === 0) {
|
||||
info |= computeData(element);
|
||||
info += computeData(element);
|
||||
dataElement.__data = info;
|
||||
}
|
||||
|
||||
@@ -367,19 +371,6 @@ module TypeScript {
|
||||
return fullStart(element) + fullWidth(element);
|
||||
}
|
||||
|
||||
export function existsNewLineBetweenTokens(token1: ISyntaxToken, token2: ISyntaxToken, text: ISimpleText) {
|
||||
if (token1 === token2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!token1 || !token2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var lineMap = text.lineMap();
|
||||
return lineMap.getLineNumberFromPosition(fullEnd(token1)) !== lineMap.getLineNumberFromPosition(start(token2, text));
|
||||
}
|
||||
|
||||
export interface ISyntaxElement {
|
||||
kind: SyntaxKind;
|
||||
parent: ISyntaxElement;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
module TypeScript.SyntaxFacts {
|
||||
var textToKeywordKind: any = {
|
||||
"any": SyntaxKind.AnyKeyword,
|
||||
"async": SyntaxKind.AsyncKeyword,
|
||||
"await": SyntaxKind.AwaitKeyword,
|
||||
"boolean": SyntaxKind.BooleanKeyword,
|
||||
"break": SyntaxKind.BreakKeyword,
|
||||
"case": SyntaxKind.CaseKeyword,
|
||||
@@ -51,6 +53,7 @@ module TypeScript.SyntaxFacts {
|
||||
"throw": SyntaxKind.ThrowKeyword,
|
||||
"true": SyntaxKind.TrueKeyword,
|
||||
"try": SyntaxKind.TryKeyword,
|
||||
"type": SyntaxKind.TypeKeyword,
|
||||
"typeof": SyntaxKind.TypeOfKeyword,
|
||||
"var": SyntaxKind.VarKeyword,
|
||||
"void": SyntaxKind.VoidKeyword,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
///<reference path='syntaxFacts.ts' />
|
||||
///<reference path='syntaxKind.ts' />
|
||||
// ///<reference path='..\..\..\tests\fidelity\es5compat.ts' />
|
||||
|
||||
|
||||
var forPrettyPrinter = false;
|
||||
|
||||
interface ITypeDefinition {
|
||||
@@ -90,6 +90,7 @@ var definitions:ITypeDefinition[] = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IModuleElementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'exportKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'equalsToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
@@ -150,6 +151,20 @@ var definitions:ITypeDefinition[] = [
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'TypeAliasSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IModuleElementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'typeKeyword', isToken: true },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'equalsToken', isToken: true },
|
||||
<any>{ name: 'type', type: 'ITypeSyntax' },
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'FunctionDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
@@ -185,7 +200,7 @@ var definitions:ITypeDefinition[] = [
|
||||
name: 'VariableDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
children: [
|
||||
<any>{ name: 'varKeyword', isToken: true },
|
||||
<any>{ name: 'varConstOrLetKeyword', isToken: true },
|
||||
<any>{ name: 'variableDeclarators', isSeparatedList: true, requiresAtLeastOneItem: true, elementType: 'VariableDeclaratorSyntax' }
|
||||
]
|
||||
},
|
||||
@@ -246,6 +261,7 @@ var definitions:ITypeDefinition[] = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'asyncKeyword', isToken: true, isOptional: true },
|
||||
<any>{ name: 'parameter', type: 'ParameterSyntax' },
|
||||
<any>{ name: 'equalsGreaterThanToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'body', type: 'BlockSyntax | IExpressionSyntax' }
|
||||
@@ -257,6 +273,7 @@ var definitions:ITypeDefinition[] = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'asyncKeyword', isToken: true, isOptional: true },
|
||||
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
<any>{ name: 'equalsGreaterThanToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'body', type: 'BlockSyntax | IExpressionSyntax' }
|
||||
@@ -317,7 +334,7 @@ var definitions:ITypeDefinition[] = [
|
||||
interfaces: ['ITypeSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'openBraceToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'typeMembers', isSeparatedList: true, elementType: 'ITypeMemberSyntax' },
|
||||
<any>{ name: 'typeMembers', isList: true, elementType: 'ITypeMemberSyntax' },
|
||||
<any>{ name: 'closeBraceToken', isToken: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@@ -419,7 +436,7 @@ var definitions:ITypeDefinition[] = [
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
name: 'MemberAccessExpressionSyntax',
|
||||
name: 'PropertyAccessExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberExpressionSyntax', 'ICallExpressionSyntax'],
|
||||
children: [
|
||||
@@ -538,12 +555,14 @@ var definitions:ITypeDefinition[] = [
|
||||
<any>{
|
||||
name: 'IndexSignatureSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['ITypeMemberSyntax'],
|
||||
interfaces: ['ITypeMemberSyntax', 'IClassElementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'openBracketToken', isToken: true },
|
||||
<any>{ name: 'parameters', isSeparatedList: true, elementType: 'ParameterSyntax' },
|
||||
<any>{ name: 'closeBracketToken', isToken: true },
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true }
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true },
|
||||
<any>{ name: 'semicolonOrCommaToken', isToken: true, isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
@@ -554,7 +573,8 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
<any>{ name: 'questionToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true }
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true },
|
||||
<any>{ name: 'semicolonOrCommaToken', isToken: true, isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
@@ -565,7 +585,8 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'typeParameterList', type: 'TypeParameterListSyntax', isOptional: true, isTypeScriptSpecific: true },
|
||||
<any>{ name: 'parameterList', type: 'ParameterListSyntax' },
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecific: true }
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecific: true },
|
||||
<any>{ name: 'semicolonOrCommaToken', isToken: true, isOptional: true }
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
@@ -649,9 +670,9 @@ var definitions:ITypeDefinition[] = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'MemberFunctionDeclarationSyntax',
|
||||
name: 'MethodDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
interfaces: ['IMemberDeclarationSyntax', 'IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
@@ -687,7 +708,7 @@ var definitions:ITypeDefinition[] = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'MemberVariableDeclarationSyntax',
|
||||
name: 'PropertyDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
children: [
|
||||
@@ -697,17 +718,6 @@ var definitions:ITypeDefinition[] = [
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'IndexMemberDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IClassElementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'indexSignature', type: 'IndexSignatureSyntax' },
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'ThrowStatementSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
@@ -870,7 +880,7 @@ var definitions:ITypeDefinition[] = [
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
name: 'CastExpressionSyntax',
|
||||
name: 'TypeAssertionExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
@@ -902,7 +912,7 @@ var definitions:ITypeDefinition[] = [
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
name: 'SimplePropertyAssignmentSyntax',
|
||||
name: 'PropertyAssignmentSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
@@ -911,22 +921,12 @@ var definitions:ITypeDefinition[] = [
|
||||
<any>{ name: 'expression', type: 'IExpressionSyntax' }
|
||||
]
|
||||
},
|
||||
<any> {
|
||||
name: 'FunctionPropertyAssignmentSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
name: 'FunctionExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPrimaryExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'asyncKeyword', isToken: true, isOptional: true },
|
||||
<any>{ name: 'functionKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true },
|
||||
@@ -1023,6 +1023,14 @@ var definitions:ITypeDefinition[] = [
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'expression', type: 'IExpressionSyntax', isOptional: true }]
|
||||
},
|
||||
<any>{
|
||||
name: 'AwaitExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'awaitKeyword', isToken: true },
|
||||
<any>{ name: 'expression', type: 'IUnaryExpressionSyntax', isOptional: true }]
|
||||
},
|
||||
<any>{
|
||||
name: 'DebuggerStatementSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
@@ -1032,9 +1040,14 @@ var definitions:ITypeDefinition[] = [
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }]
|
||||
}];
|
||||
|
||||
function getSyntaxKindEnum() {
|
||||
var name = "SyntaxKind";
|
||||
return (<any>TypeScript)[name];
|
||||
}
|
||||
|
||||
function firstKind(definition: ITypeDefinition): TypeScript.SyntaxKind {
|
||||
var kindName = getNameWithoutSuffix(definition);
|
||||
return (<any>TypeScript.SyntaxKind)[kindName];
|
||||
return getSyntaxKindEnum()[kindName];
|
||||
}
|
||||
|
||||
definitions.sort((d1, d2) => firstKind(d1) - firstKind(d2));
|
||||
@@ -1327,7 +1340,7 @@ function generateKeywordCondition(keywords: { text: string; kind: TypeScript.Syn
|
||||
var keyword = keywords[0];
|
||||
|
||||
if (currentCharacter === length) {
|
||||
return " return SyntaxKind." + firstEnumName(TypeScript.SyntaxKind, keyword.kind) + ";\r\n";
|
||||
return " return SyntaxKind." + firstEnumName(getSyntaxKindEnum(), keyword.kind) + ";\r\n";
|
||||
}
|
||||
|
||||
var keywordText = keywords[0].text;
|
||||
@@ -1342,7 +1355,7 @@ function generateKeywordCondition(keywords: { text: string; kind: TypeScript.Syn
|
||||
result += "str.charCodeAt(" + index + ") === CharacterCodes." + keywordText.substr(i, 1);
|
||||
}
|
||||
|
||||
result += ") ? SyntaxKind." + firstEnumName(TypeScript.SyntaxKind, keyword.kind) + " : SyntaxKind.IdentifierName;\r\n";
|
||||
result += ") ? SyntaxKind." + firstEnumName(getSyntaxKindEnum(), keyword.kind) + " : SyntaxKind.IdentifierName;\r\n";
|
||||
}
|
||||
else {
|
||||
result += " // " + TypeScript.ArrayUtilities.select(keywords, k => k.text).join(", ") + "\r\n"
|
||||
@@ -1392,8 +1405,29 @@ function max<T>(array: T[], func: (v: T) => number): number {
|
||||
}
|
||||
|
||||
function generateUtilities(): string {
|
||||
var result = "";
|
||||
result += " var fixedWidthArray = [";
|
||||
var result = ""; //"module TypeScript.Scanner {";
|
||||
//result += " function fixedWidthTokenLength(kind: SyntaxKind) {\r\n";
|
||||
//result += " return fixedWidthArray[kind];\r\n";
|
||||
|
||||
//result += " switch (kind) {\r\n";
|
||||
|
||||
//for (var k = TypeScript.SyntaxKind.FirstFixedWidth; k <= TypeScript.SyntaxKind.LastFixedWidth; k++) {
|
||||
// result += " case SyntaxKind." + syntaxKindName(k) + ": return " + TypeScript.SyntaxFacts.getText(k).length + ";\r\n";
|
||||
//}
|
||||
//result += " default: throw new Error();\r\n";
|
||||
//result += " }\r\n";
|
||||
// result += " }\r\n";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function generateScannerUtilities(): string {
|
||||
var result = "///<reference path='references.ts' />\r\n" +
|
||||
"\r\n" +
|
||||
"module TypeScript {\r\n" +
|
||||
" export module ScannerUtilities {\r\n";
|
||||
|
||||
result += " export var fixedWidthArray = [";
|
||||
for (var i = 0; i <= TypeScript.SyntaxKind.LastFixedWidth; i++) {
|
||||
if (i) {
|
||||
result += ", ";
|
||||
@@ -1408,26 +1442,6 @@ function generateUtilities(): string {
|
||||
}
|
||||
result += "];\r\n";
|
||||
|
||||
result += " function fixedWidthTokenLength(kind: SyntaxKind) {\r\n";
|
||||
result += " return fixedWidthArray[kind];\r\n";
|
||||
|
||||
//result += " switch (kind) {\r\n";
|
||||
|
||||
//for (var k = TypeScript.SyntaxKind.FirstFixedWidth; k <= TypeScript.SyntaxKind.LastFixedWidth; k++) {
|
||||
// result += " case SyntaxKind." + syntaxKindName(k) + ": return " + TypeScript.SyntaxFacts.getText(k).length + ";\r\n";
|
||||
//}
|
||||
//result += " default: throw new Error();\r\n";
|
||||
//result += " }\r\n";
|
||||
result += " }\r\n";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function generateScannerUtilities(): string {
|
||||
var result = "///<reference path='references.ts' />\r\n" +
|
||||
"\r\n" +
|
||||
"module TypeScript {\r\n" +
|
||||
" export module ScannerUtilities {\r\n";
|
||||
|
||||
var i: number;
|
||||
var keywords: { text: string; kind: TypeScript.SyntaxKind; }[] = [];
|
||||
@@ -1464,8 +1478,8 @@ function generateScannerUtilities(): string {
|
||||
}
|
||||
|
||||
function syntaxKindName(kind: TypeScript.SyntaxKind): string {
|
||||
for (var name in TypeScript.SyntaxKind) {
|
||||
if (<any>TypeScript.SyntaxKind[name] === kind) {
|
||||
for (var name in getSyntaxKindEnum()) {
|
||||
if (getSyntaxKindEnum()[name] === kind) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ module TypeScript {
|
||||
|
||||
export interface ObjectTypeSyntax extends ISyntaxNode, ITypeSyntax {
|
||||
openBraceToken: ISyntaxToken;
|
||||
typeMembers: ISeparatedSyntaxList<ITypeMemberSyntax>;
|
||||
typeMembers: ITypeMemberSyntax[];
|
||||
closeBraceToken: ISyntaxToken;
|
||||
}
|
||||
export interface ObjectTypeConstructor { new (data: number, openBraceToken: ISyntaxToken, typeMembers: ISeparatedSyntaxList<ITypeMemberSyntax>, closeBraceToken: ISyntaxToken): ObjectTypeSyntax }
|
||||
export interface ObjectTypeConstructor { new (data: number, openBraceToken: ISyntaxToken, typeMembers: ITypeMemberSyntax[], closeBraceToken: ISyntaxToken): ObjectTypeSyntax }
|
||||
|
||||
export interface FunctionTypeSyntax extends ISyntaxNode, ITypeSyntax {
|
||||
typeParameterList: TypeParameterListSyntax;
|
||||
@@ -142,28 +142,29 @@ module TypeScript {
|
||||
export interface ImportDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], importKeyword: ISyntaxToken, identifier: ISyntaxToken, equalsToken: ISyntaxToken, moduleReference: IModuleReferenceSyntax, semicolonToken: ISyntaxToken): ImportDeclarationSyntax }
|
||||
|
||||
export interface ExportAssignmentSyntax extends ISyntaxNode, IModuleElementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
exportKeyword: ISyntaxToken;
|
||||
equalsToken: ISyntaxToken;
|
||||
identifier: ISyntaxToken;
|
||||
semicolonToken: ISyntaxToken;
|
||||
}
|
||||
export interface ExportAssignmentConstructor { new (data: number, exportKeyword: ISyntaxToken, equalsToken: ISyntaxToken, identifier: ISyntaxToken, semicolonToken: ISyntaxToken): ExportAssignmentSyntax }
|
||||
export interface ExportAssignmentConstructor { new (data: number, modifiers: ISyntaxToken[], exportKeyword: ISyntaxToken, equalsToken: ISyntaxToken, identifier: ISyntaxToken, semicolonToken: ISyntaxToken): ExportAssignmentSyntax }
|
||||
|
||||
export interface MemberFunctionDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax {
|
||||
export interface MethodDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax, IPropertyAssignmentSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
asterixToken: ISyntaxToken;
|
||||
propertyName: IPropertyNameSyntax;
|
||||
callSignature: CallSignatureSyntax;
|
||||
body: BlockSyntax | ExpressionBody | ISyntaxToken;
|
||||
}
|
||||
export interface MemberFunctionDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken): MemberFunctionDeclarationSyntax }
|
||||
export interface MethodDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken): MethodDeclarationSyntax }
|
||||
|
||||
export interface MemberVariableDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax {
|
||||
export interface PropertyDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
variableDeclarator: VariableDeclaratorSyntax;
|
||||
semicolonToken: ISyntaxToken;
|
||||
}
|
||||
export interface MemberVariableDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], variableDeclarator: VariableDeclaratorSyntax, semicolonToken: ISyntaxToken): MemberVariableDeclarationSyntax }
|
||||
export interface PropertyDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], variableDeclarator: VariableDeclaratorSyntax, semicolonToken: ISyntaxToken): PropertyDeclarationSyntax }
|
||||
|
||||
export interface ConstructorDeclarationSyntax extends ISyntaxNode, IClassElementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
@@ -173,13 +174,6 @@ module TypeScript {
|
||||
}
|
||||
export interface ConstructorDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], constructorKeyword: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken): ConstructorDeclarationSyntax }
|
||||
|
||||
export interface IndexMemberDeclarationSyntax extends ISyntaxNode, IClassElementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
indexSignature: IndexSignatureSyntax;
|
||||
semicolonToken: ISyntaxToken;
|
||||
}
|
||||
export interface IndexMemberDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], indexSignature: IndexSignatureSyntax, semicolonToken: ISyntaxToken): IndexMemberDeclarationSyntax }
|
||||
|
||||
export interface GetAccessorSyntax extends ISyntaxNode, IAccessorSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
getKeyword: ISyntaxToken;
|
||||
@@ -202,15 +196,17 @@ module TypeScript {
|
||||
propertyName: IPropertyNameSyntax;
|
||||
questionToken: ISyntaxToken;
|
||||
typeAnnotation: TypeAnnotationSyntax;
|
||||
semicolonOrCommaToken: ISyntaxToken;
|
||||
}
|
||||
export interface PropertySignatureConstructor { new (data: number, propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax): PropertySignatureSyntax }
|
||||
export interface PropertySignatureConstructor { new (data: number, propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax, semicolonOrCommaToken: ISyntaxToken): PropertySignatureSyntax }
|
||||
|
||||
export interface CallSignatureSyntax extends ISyntaxNode, ITypeMemberSyntax {
|
||||
typeParameterList: TypeParameterListSyntax;
|
||||
parameterList: ParameterListSyntax;
|
||||
typeAnnotation: TypeAnnotationSyntax;
|
||||
semicolonOrCommaToken: ISyntaxToken;
|
||||
}
|
||||
export interface CallSignatureConstructor { new (data: number, typeParameterList: TypeParameterListSyntax, parameterList: ParameterListSyntax, typeAnnotation: TypeAnnotationSyntax): CallSignatureSyntax }
|
||||
export interface CallSignatureConstructor { new (data: number, typeParameterList: TypeParameterListSyntax, parameterList: ParameterListSyntax, typeAnnotation: TypeAnnotationSyntax, semicolonOrCommaToken: ISyntaxToken): CallSignatureSyntax }
|
||||
|
||||
export interface ConstructSignatureSyntax extends ISyntaxNode, ITypeMemberSyntax {
|
||||
newKeyword: ISyntaxToken;
|
||||
@@ -218,13 +214,15 @@ module TypeScript {
|
||||
}
|
||||
export interface ConstructSignatureConstructor { new (data: number, newKeyword: ISyntaxToken, callSignature: CallSignatureSyntax): ConstructSignatureSyntax }
|
||||
|
||||
export interface IndexSignatureSyntax extends ISyntaxNode, ITypeMemberSyntax {
|
||||
export interface IndexSignatureSyntax extends ISyntaxNode, ITypeMemberSyntax, IClassElementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
openBracketToken: ISyntaxToken;
|
||||
parameters: ISeparatedSyntaxList<ParameterSyntax>;
|
||||
closeBracketToken: ISyntaxToken;
|
||||
typeAnnotation: TypeAnnotationSyntax;
|
||||
semicolonOrCommaToken: ISyntaxToken;
|
||||
}
|
||||
export interface IndexSignatureConstructor { new (data: number, openBracketToken: ISyntaxToken, parameters: ISeparatedSyntaxList<ParameterSyntax>, closeBracketToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax): IndexSignatureSyntax }
|
||||
export interface IndexSignatureConstructor { new (data: number, modifiers: ISyntaxToken[], openBracketToken: ISyntaxToken, parameters: ISeparatedSyntaxList<ParameterSyntax>, closeBracketToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax, semicolonOrCommaToken: ISyntaxToken): IndexSignatureSyntax }
|
||||
|
||||
export interface MethodSignatureSyntax extends ISyntaxNode, ITypeMemberSyntax {
|
||||
propertyName: IPropertyNameSyntax;
|
||||
@@ -428,12 +426,12 @@ module TypeScript {
|
||||
}
|
||||
export interface PostfixUnaryExpressionConstructor { new (data: number, operand: ILeftHandSideExpressionSyntax, operatorToken: ISyntaxToken): PostfixUnaryExpressionSyntax }
|
||||
|
||||
export interface MemberAccessExpressionSyntax extends ISyntaxNode, IMemberExpressionSyntax, ICallExpressionSyntax {
|
||||
export interface PropertyAccessExpressionSyntax extends ISyntaxNode, IMemberExpressionSyntax, ICallExpressionSyntax {
|
||||
expression: ILeftHandSideExpressionSyntax;
|
||||
dotToken: ISyntaxToken;
|
||||
name: ISyntaxToken;
|
||||
}
|
||||
export interface MemberAccessExpressionConstructor { new (data: number, expression: ILeftHandSideExpressionSyntax, dotToken: ISyntaxToken, name: ISyntaxToken): MemberAccessExpressionSyntax }
|
||||
export interface PropertyAccessExpressionConstructor { new (data: number, expression: ILeftHandSideExpressionSyntax, dotToken: ISyntaxToken, name: ISyntaxToken): PropertyAccessExpressionSyntax }
|
||||
|
||||
export interface InvocationExpressionSyntax extends ISyntaxNode, ICallExpressionSyntax {
|
||||
expression: ILeftHandSideExpressionSyntax;
|
||||
@@ -470,26 +468,28 @@ module TypeScript {
|
||||
export interface ParenthesizedExpressionConstructor { new (data: number, openParenToken: ISyntaxToken, expression: IExpressionSyntax, closeParenToken: ISyntaxToken): ParenthesizedExpressionSyntax }
|
||||
|
||||
export interface ParenthesizedArrowFunctionExpressionSyntax extends ISyntaxNode, IUnaryExpressionSyntax {
|
||||
asyncKeyword: ISyntaxToken;
|
||||
callSignature: CallSignatureSyntax;
|
||||
equalsGreaterThanToken: ISyntaxToken;
|
||||
body: BlockSyntax | IExpressionSyntax;
|
||||
}
|
||||
export interface ParenthesizedArrowFunctionExpressionConstructor { new (data: number, callSignature: CallSignatureSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax): ParenthesizedArrowFunctionExpressionSyntax }
|
||||
export interface ParenthesizedArrowFunctionExpressionConstructor { new (data: number, asyncKeyword: ISyntaxToken, callSignature: CallSignatureSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax): ParenthesizedArrowFunctionExpressionSyntax }
|
||||
|
||||
export interface SimpleArrowFunctionExpressionSyntax extends ISyntaxNode, IUnaryExpressionSyntax {
|
||||
asyncKeyword: ISyntaxToken;
|
||||
parameter: ParameterSyntax;
|
||||
equalsGreaterThanToken: ISyntaxToken;
|
||||
body: BlockSyntax | IExpressionSyntax;
|
||||
}
|
||||
export interface SimpleArrowFunctionExpressionConstructor { new (data: number, parameter: ParameterSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax): SimpleArrowFunctionExpressionSyntax }
|
||||
export interface SimpleArrowFunctionExpressionConstructor { new (data: number, asyncKeyword: ISyntaxToken, parameter: ParameterSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax): SimpleArrowFunctionExpressionSyntax }
|
||||
|
||||
export interface CastExpressionSyntax extends ISyntaxNode, IUnaryExpressionSyntax {
|
||||
export interface TypeAssertionExpressionSyntax extends ISyntaxNode, IUnaryExpressionSyntax {
|
||||
lessThanToken: ISyntaxToken;
|
||||
type: ITypeSyntax;
|
||||
greaterThanToken: ISyntaxToken;
|
||||
expression: IUnaryExpressionSyntax;
|
||||
}
|
||||
export interface CastExpressionConstructor { new (data: number, lessThanToken: ISyntaxToken, type: ITypeSyntax, greaterThanToken: ISyntaxToken, expression: IUnaryExpressionSyntax): CastExpressionSyntax }
|
||||
export interface TypeAssertionExpressionConstructor { new (data: number, lessThanToken: ISyntaxToken, type: ITypeSyntax, greaterThanToken: ISyntaxToken, expression: IUnaryExpressionSyntax): TypeAssertionExpressionSyntax }
|
||||
|
||||
export interface ElementAccessExpressionSyntax extends ISyntaxNode, IMemberExpressionSyntax, ICallExpressionSyntax {
|
||||
expression: ILeftHandSideExpressionSyntax;
|
||||
@@ -500,13 +500,14 @@ module TypeScript {
|
||||
export interface ElementAccessExpressionConstructor { new (data: number, expression: ILeftHandSideExpressionSyntax, openBracketToken: ISyntaxToken, argumentExpression: IExpressionSyntax, closeBracketToken: ISyntaxToken): ElementAccessExpressionSyntax }
|
||||
|
||||
export interface FunctionExpressionSyntax extends ISyntaxNode, IPrimaryExpressionSyntax {
|
||||
asyncKeyword: ISyntaxToken;
|
||||
functionKeyword: ISyntaxToken;
|
||||
asterixToken: ISyntaxToken;
|
||||
identifier: ISyntaxToken;
|
||||
callSignature: CallSignatureSyntax;
|
||||
body: BlockSyntax | ExpressionBody | ISyntaxToken;
|
||||
}
|
||||
export interface FunctionExpressionConstructor { new (data: number, functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken): FunctionExpressionSyntax }
|
||||
export interface FunctionExpressionConstructor { new (data: number, asyncKeyword: ISyntaxToken, functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken): FunctionExpressionSyntax }
|
||||
|
||||
export interface OmittedExpressionSyntax extends ISyntaxNode, IExpressionSyntax {
|
||||
}
|
||||
@@ -531,11 +532,17 @@ module TypeScript {
|
||||
}
|
||||
export interface YieldExpressionConstructor { new (data: number, yieldKeyword: ISyntaxToken, asterixToken: ISyntaxToken, expression: IExpressionSyntax): YieldExpressionSyntax }
|
||||
|
||||
export interface AwaitExpressionSyntax extends ISyntaxNode, IUnaryExpressionSyntax {
|
||||
awaitKeyword: ISyntaxToken;
|
||||
expression: IUnaryExpressionSyntax;
|
||||
}
|
||||
export interface AwaitExpressionConstructor { new (data: number, awaitKeyword: ISyntaxToken, expression: IUnaryExpressionSyntax): AwaitExpressionSyntax }
|
||||
|
||||
export interface VariableDeclarationSyntax extends ISyntaxNode {
|
||||
varKeyword: ISyntaxToken;
|
||||
varConstOrLetKeyword: ISyntaxToken;
|
||||
variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>;
|
||||
}
|
||||
export interface VariableDeclarationConstructor { new (data: number, varKeyword: ISyntaxToken, variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>): VariableDeclarationSyntax }
|
||||
export interface VariableDeclarationConstructor { new (data: number, varConstOrLetKeyword: ISyntaxToken, variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>): VariableDeclarationSyntax }
|
||||
|
||||
export interface VariableDeclaratorSyntax extends ISyntaxNode {
|
||||
propertyName: IPropertyNameSyntax;
|
||||
@@ -640,21 +647,6 @@ module TypeScript {
|
||||
}
|
||||
export interface ConstraintConstructor { new (data: number, extendsKeyword: ISyntaxToken, typeOrExpression: ISyntaxNodeOrToken): ConstraintSyntax }
|
||||
|
||||
export interface SimplePropertyAssignmentSyntax extends ISyntaxNode, IPropertyAssignmentSyntax {
|
||||
propertyName: IPropertyNameSyntax;
|
||||
colonToken: ISyntaxToken;
|
||||
expression: IExpressionSyntax;
|
||||
}
|
||||
export interface SimplePropertyAssignmentConstructor { new (data: number, propertyName: IPropertyNameSyntax, colonToken: ISyntaxToken, expression: IExpressionSyntax): SimplePropertyAssignmentSyntax }
|
||||
|
||||
export interface FunctionPropertyAssignmentSyntax extends ISyntaxNode, IPropertyAssignmentSyntax {
|
||||
asterixToken: ISyntaxToken;
|
||||
propertyName: IPropertyNameSyntax;
|
||||
callSignature: CallSignatureSyntax;
|
||||
body: BlockSyntax | ExpressionBody | ISyntaxToken;
|
||||
}
|
||||
export interface FunctionPropertyAssignmentConstructor { new (data: number, asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken): FunctionPropertyAssignmentSyntax }
|
||||
|
||||
export interface ParameterSyntax extends ISyntaxNode {
|
||||
dotDotDotToken: ISyntaxToken;
|
||||
modifiers: ISyntaxToken[];
|
||||
@@ -690,6 +682,23 @@ module TypeScript {
|
||||
}
|
||||
export interface ComputedPropertyNameConstructor { new (data: number, openBracketToken: ISyntaxToken, expression: IExpressionSyntax, closeBracketToken: ISyntaxToken): ComputedPropertyNameSyntax }
|
||||
|
||||
export interface PropertyAssignmentSyntax extends ISyntaxNode, IPropertyAssignmentSyntax {
|
||||
propertyName: IPropertyNameSyntax;
|
||||
colonToken: ISyntaxToken;
|
||||
expression: IExpressionSyntax;
|
||||
}
|
||||
export interface PropertyAssignmentConstructor { new (data: number, propertyName: IPropertyNameSyntax, colonToken: ISyntaxToken, expression: IExpressionSyntax): PropertyAssignmentSyntax }
|
||||
|
||||
export interface TypeAliasSyntax extends ISyntaxNode, IModuleElementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
typeKeyword: ISyntaxToken;
|
||||
identifier: ISyntaxToken;
|
||||
equalsToken: ISyntaxToken;
|
||||
type: ITypeSyntax;
|
||||
semicolonToken: ISyntaxToken;
|
||||
}
|
||||
export interface TypeAliasConstructor { new (data: number, modifiers: ISyntaxToken[], typeKeyword: ISyntaxToken, identifier: ISyntaxToken, equalsToken: ISyntaxToken, type: ITypeSyntax, semicolonToken: ISyntaxToken): TypeAliasSyntax }
|
||||
|
||||
export interface ExternalModuleReferenceSyntax extends ISyntaxNode, IModuleReferenceSyntax {
|
||||
requireKeyword: ISyntaxToken;
|
||||
openParenToken: ISyntaxToken;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// If you change anything in this enum, make sure you run SyntaxGenerator again!
|
||||
|
||||
module TypeScript {
|
||||
export enum SyntaxKind {
|
||||
export const enum SyntaxKind {
|
||||
// Variable width tokens, trivia and lists.
|
||||
None,
|
||||
List,
|
||||
@@ -87,6 +87,8 @@ module TypeScript {
|
||||
|
||||
// TypeScript keywords.
|
||||
AnyKeyword,
|
||||
AsyncKeyword,
|
||||
AwaitKeyword,
|
||||
BooleanKeyword,
|
||||
ConstructorKeyword,
|
||||
DeclareKeyword,
|
||||
@@ -95,6 +97,7 @@ module TypeScript {
|
||||
RequireKeyword,
|
||||
NumberKeyword,
|
||||
SetKeyword,
|
||||
TypeKeyword,
|
||||
StringKeyword,
|
||||
|
||||
// Punctuators
|
||||
@@ -176,10 +179,9 @@ module TypeScript {
|
||||
ExportAssignment,
|
||||
|
||||
// ClassElements
|
||||
MemberFunctionDeclaration,
|
||||
MemberVariableDeclaration,
|
||||
MethodDeclaration,
|
||||
PropertyDeclaration,
|
||||
ConstructorDeclaration,
|
||||
IndexMemberDeclaration,
|
||||
|
||||
// ClassElement and PropertyAssignment
|
||||
GetAccessor,
|
||||
@@ -220,7 +222,7 @@ module TypeScript {
|
||||
ConditionalExpression,
|
||||
BinaryExpression,
|
||||
PostfixUnaryExpression,
|
||||
MemberAccessExpression,
|
||||
PropertyAccessExpression,
|
||||
InvocationExpression,
|
||||
ArrayLiteralExpression,
|
||||
ObjectLiteralExpression,
|
||||
@@ -228,13 +230,14 @@ module TypeScript {
|
||||
ParenthesizedExpression,
|
||||
ParenthesizedArrowFunctionExpression,
|
||||
SimpleArrowFunctionExpression,
|
||||
CastExpression,
|
||||
TypeAssertionExpression,
|
||||
ElementAccessExpression,
|
||||
FunctionExpression,
|
||||
OmittedExpression,
|
||||
TemplateExpression,
|
||||
TemplateAccessExpression,
|
||||
YieldExpression,
|
||||
AwaitExpression,
|
||||
|
||||
// Variable declarations
|
||||
VariableDeclaration,
|
||||
@@ -260,16 +263,14 @@ module TypeScript {
|
||||
TypeParameter,
|
||||
Constraint,
|
||||
|
||||
// Property Assignment
|
||||
SimplePropertyAssignment,
|
||||
FunctionPropertyAssignment,
|
||||
|
||||
// Misc.
|
||||
Parameter,
|
||||
EnumElement,
|
||||
TypeAnnotation,
|
||||
ExpressionBody,
|
||||
ComputedPropertyName,
|
||||
PropertyAssignment,
|
||||
TypeAlias,
|
||||
ExternalModuleReference,
|
||||
ModuleNameModuleReference,
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var ObjectTypeSyntax: ObjectTypeConstructor = <any>function(data: number, openBraceToken: ISyntaxToken, typeMembers: ISeparatedSyntaxList<ITypeMemberSyntax>, closeBraceToken: ISyntaxToken) {
|
||||
export var ObjectTypeSyntax: ObjectTypeConstructor = <any>function(data: number, openBraceToken: ISyntaxToken, typeMembers: ITypeMemberSyntax[], closeBraceToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.openBraceToken = openBraceToken,
|
||||
this.typeMembers = typeMembers,
|
||||
@@ -384,29 +384,32 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var ExportAssignmentSyntax: ExportAssignmentConstructor = <any>function(data: number, exportKeyword: ISyntaxToken, equalsToken: ISyntaxToken, identifier: ISyntaxToken, semicolonToken: ISyntaxToken) {
|
||||
export var ExportAssignmentSyntax: ExportAssignmentConstructor = <any>function(data: number, modifiers: ISyntaxToken[], exportKeyword: ISyntaxToken, equalsToken: ISyntaxToken, identifier: ISyntaxToken, semicolonToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.exportKeyword = exportKeyword,
|
||||
this.equalsToken = equalsToken,
|
||||
this.identifier = identifier,
|
||||
this.semicolonToken = semicolonToken,
|
||||
modifiers.parent = this,
|
||||
exportKeyword.parent = this,
|
||||
equalsToken.parent = this,
|
||||
identifier.parent = this,
|
||||
semicolonToken && (semicolonToken.parent = this);
|
||||
};
|
||||
ExportAssignmentSyntax.prototype.kind = SyntaxKind.ExportAssignment;
|
||||
ExportAssignmentSyntax.prototype.childCount = 4;
|
||||
ExportAssignmentSyntax.prototype.childCount = 5;
|
||||
ExportAssignmentSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.exportKeyword;
|
||||
case 1: return this.equalsToken;
|
||||
case 2: return this.identifier;
|
||||
case 3: return this.semicolonToken;
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.exportKeyword;
|
||||
case 2: return this.equalsToken;
|
||||
case 3: return this.identifier;
|
||||
case 4: return this.semicolonToken;
|
||||
}
|
||||
}
|
||||
|
||||
export var MemberFunctionDeclarationSyntax: MemberFunctionDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken) {
|
||||
export var MethodDeclarationSyntax: MethodDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.asterixToken = asterixToken,
|
||||
@@ -419,9 +422,9 @@ module TypeScript {
|
||||
callSignature.parent = this,
|
||||
body && (body.parent = this);
|
||||
};
|
||||
MemberFunctionDeclarationSyntax.prototype.kind = SyntaxKind.MemberFunctionDeclaration;
|
||||
MemberFunctionDeclarationSyntax.prototype.childCount = 5;
|
||||
MemberFunctionDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
MethodDeclarationSyntax.prototype.kind = SyntaxKind.MethodDeclaration;
|
||||
MethodDeclarationSyntax.prototype.childCount = 5;
|
||||
MethodDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.asterixToken;
|
||||
@@ -431,7 +434,7 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var MemberVariableDeclarationSyntax: MemberVariableDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], variableDeclarator: VariableDeclaratorSyntax, semicolonToken: ISyntaxToken) {
|
||||
export var PropertyDeclarationSyntax: PropertyDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], variableDeclarator: VariableDeclaratorSyntax, semicolonToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.variableDeclarator = variableDeclarator,
|
||||
@@ -440,9 +443,9 @@ module TypeScript {
|
||||
variableDeclarator.parent = this,
|
||||
semicolonToken && (semicolonToken.parent = this);
|
||||
};
|
||||
MemberVariableDeclarationSyntax.prototype.kind = SyntaxKind.MemberVariableDeclaration;
|
||||
MemberVariableDeclarationSyntax.prototype.childCount = 3;
|
||||
MemberVariableDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
PropertyDeclarationSyntax.prototype.kind = SyntaxKind.PropertyDeclaration;
|
||||
PropertyDeclarationSyntax.prototype.childCount = 3;
|
||||
PropertyDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.variableDeclarator;
|
||||
@@ -472,25 +475,6 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var IndexMemberDeclarationSyntax: IndexMemberDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], indexSignature: IndexSignatureSyntax, semicolonToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.indexSignature = indexSignature,
|
||||
this.semicolonToken = semicolonToken,
|
||||
modifiers.parent = this,
|
||||
indexSignature.parent = this,
|
||||
semicolonToken && (semicolonToken.parent = this);
|
||||
};
|
||||
IndexMemberDeclarationSyntax.prototype.kind = SyntaxKind.IndexMemberDeclaration;
|
||||
IndexMemberDeclarationSyntax.prototype.childCount = 3;
|
||||
IndexMemberDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.indexSignature;
|
||||
case 2: return this.semicolonToken;
|
||||
}
|
||||
}
|
||||
|
||||
export var GetAccessorSyntax: GetAccessorConstructor = <any>function(data: number, modifiers: ISyntaxToken[], getKeyword: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
@@ -541,41 +525,47 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var PropertySignatureSyntax: PropertySignatureConstructor = <any>function(data: number, propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax) {
|
||||
export var PropertySignatureSyntax: PropertySignatureConstructor = <any>function(data: number, propertyName: IPropertyNameSyntax, questionToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax, semicolonOrCommaToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.propertyName = propertyName,
|
||||
this.questionToken = questionToken,
|
||||
this.typeAnnotation = typeAnnotation,
|
||||
this.semicolonOrCommaToken = semicolonOrCommaToken,
|
||||
propertyName.parent = this,
|
||||
questionToken && (questionToken.parent = this),
|
||||
typeAnnotation && (typeAnnotation.parent = this);
|
||||
typeAnnotation && (typeAnnotation.parent = this),
|
||||
semicolonOrCommaToken && (semicolonOrCommaToken.parent = this);
|
||||
};
|
||||
PropertySignatureSyntax.prototype.kind = SyntaxKind.PropertySignature;
|
||||
PropertySignatureSyntax.prototype.childCount = 3;
|
||||
PropertySignatureSyntax.prototype.childCount = 4;
|
||||
PropertySignatureSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.propertyName;
|
||||
case 1: return this.questionToken;
|
||||
case 2: return this.typeAnnotation;
|
||||
case 3: return this.semicolonOrCommaToken;
|
||||
}
|
||||
}
|
||||
|
||||
export var CallSignatureSyntax: CallSignatureConstructor = <any>function(data: number, typeParameterList: TypeParameterListSyntax, parameterList: ParameterListSyntax, typeAnnotation: TypeAnnotationSyntax) {
|
||||
export var CallSignatureSyntax: CallSignatureConstructor = <any>function(data: number, typeParameterList: TypeParameterListSyntax, parameterList: ParameterListSyntax, typeAnnotation: TypeAnnotationSyntax, semicolonOrCommaToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.typeParameterList = typeParameterList,
|
||||
this.parameterList = parameterList,
|
||||
this.typeAnnotation = typeAnnotation,
|
||||
this.semicolonOrCommaToken = semicolonOrCommaToken,
|
||||
typeParameterList && (typeParameterList.parent = this),
|
||||
parameterList.parent = this,
|
||||
typeAnnotation && (typeAnnotation.parent = this);
|
||||
typeAnnotation && (typeAnnotation.parent = this),
|
||||
semicolonOrCommaToken && (semicolonOrCommaToken.parent = this);
|
||||
};
|
||||
CallSignatureSyntax.prototype.kind = SyntaxKind.CallSignature;
|
||||
CallSignatureSyntax.prototype.childCount = 3;
|
||||
CallSignatureSyntax.prototype.childCount = 4;
|
||||
CallSignatureSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.typeParameterList;
|
||||
case 1: return this.parameterList;
|
||||
case 2: return this.typeAnnotation;
|
||||
case 3: return this.semicolonOrCommaToken;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,25 +585,31 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var IndexSignatureSyntax: IndexSignatureConstructor = <any>function(data: number, openBracketToken: ISyntaxToken, parameters: ISeparatedSyntaxList<ParameterSyntax>, closeBracketToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax) {
|
||||
export var IndexSignatureSyntax: IndexSignatureConstructor = <any>function(data: number, modifiers: ISyntaxToken[], openBracketToken: ISyntaxToken, parameters: ISeparatedSyntaxList<ParameterSyntax>, closeBracketToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax, semicolonOrCommaToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.openBracketToken = openBracketToken,
|
||||
this.parameters = parameters,
|
||||
this.closeBracketToken = closeBracketToken,
|
||||
this.typeAnnotation = typeAnnotation,
|
||||
this.semicolonOrCommaToken = semicolonOrCommaToken,
|
||||
modifiers.parent = this,
|
||||
openBracketToken.parent = this,
|
||||
parameters.parent = this,
|
||||
closeBracketToken.parent = this,
|
||||
typeAnnotation && (typeAnnotation.parent = this);
|
||||
typeAnnotation && (typeAnnotation.parent = this),
|
||||
semicolonOrCommaToken && (semicolonOrCommaToken.parent = this);
|
||||
};
|
||||
IndexSignatureSyntax.prototype.kind = SyntaxKind.IndexSignature;
|
||||
IndexSignatureSyntax.prototype.childCount = 4;
|
||||
IndexSignatureSyntax.prototype.childCount = 6;
|
||||
IndexSignatureSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.openBracketToken;
|
||||
case 1: return this.parameters;
|
||||
case 2: return this.closeBracketToken;
|
||||
case 3: return this.typeAnnotation;
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.openBracketToken;
|
||||
case 2: return this.parameters;
|
||||
case 3: return this.closeBracketToken;
|
||||
case 4: return this.typeAnnotation;
|
||||
case 5: return this.semicolonOrCommaToken;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1171,7 +1167,7 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var MemberAccessExpressionSyntax: MemberAccessExpressionConstructor = <any>function(data: number, expression: ILeftHandSideExpressionSyntax, dotToken: ISyntaxToken, name: ISyntaxToken) {
|
||||
export var PropertyAccessExpressionSyntax: PropertyAccessExpressionConstructor = <any>function(data: number, expression: ILeftHandSideExpressionSyntax, dotToken: ISyntaxToken, name: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.expression = expression,
|
||||
this.dotToken = dotToken,
|
||||
@@ -1180,9 +1176,9 @@ module TypeScript {
|
||||
dotToken.parent = this,
|
||||
name.parent = this;
|
||||
};
|
||||
MemberAccessExpressionSyntax.prototype.kind = SyntaxKind.MemberAccessExpression;
|
||||
MemberAccessExpressionSyntax.prototype.childCount = 3;
|
||||
MemberAccessExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
PropertyAccessExpressionSyntax.prototype.kind = SyntaxKind.PropertyAccessExpression;
|
||||
PropertyAccessExpressionSyntax.prototype.childCount = 3;
|
||||
PropertyAccessExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.expression;
|
||||
case 1: return this.dotToken;
|
||||
@@ -1282,45 +1278,51 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var ParenthesizedArrowFunctionExpressionSyntax: ParenthesizedArrowFunctionExpressionConstructor = <any>function(data: number, callSignature: CallSignatureSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax) {
|
||||
export var ParenthesizedArrowFunctionExpressionSyntax: ParenthesizedArrowFunctionExpressionConstructor = <any>function(data: number, asyncKeyword: ISyntaxToken, callSignature: CallSignatureSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.asyncKeyword = asyncKeyword,
|
||||
this.callSignature = callSignature,
|
||||
this.equalsGreaterThanToken = equalsGreaterThanToken,
|
||||
this.body = body,
|
||||
asyncKeyword && (asyncKeyword.parent = this),
|
||||
callSignature.parent = this,
|
||||
equalsGreaterThanToken.parent = this,
|
||||
body.parent = this;
|
||||
};
|
||||
ParenthesizedArrowFunctionExpressionSyntax.prototype.kind = SyntaxKind.ParenthesizedArrowFunctionExpression;
|
||||
ParenthesizedArrowFunctionExpressionSyntax.prototype.childCount = 3;
|
||||
ParenthesizedArrowFunctionExpressionSyntax.prototype.childCount = 4;
|
||||
ParenthesizedArrowFunctionExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.callSignature;
|
||||
case 1: return this.equalsGreaterThanToken;
|
||||
case 2: return this.body;
|
||||
case 0: return this.asyncKeyword;
|
||||
case 1: return this.callSignature;
|
||||
case 2: return this.equalsGreaterThanToken;
|
||||
case 3: return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
export var SimpleArrowFunctionExpressionSyntax: SimpleArrowFunctionExpressionConstructor = <any>function(data: number, parameter: ParameterSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax) {
|
||||
export var SimpleArrowFunctionExpressionSyntax: SimpleArrowFunctionExpressionConstructor = <any>function(data: number, asyncKeyword: ISyntaxToken, parameter: ParameterSyntax, equalsGreaterThanToken: ISyntaxToken, body: BlockSyntax | IExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.asyncKeyword = asyncKeyword,
|
||||
this.parameter = parameter,
|
||||
this.equalsGreaterThanToken = equalsGreaterThanToken,
|
||||
this.body = body,
|
||||
asyncKeyword && (asyncKeyword.parent = this),
|
||||
parameter.parent = this,
|
||||
equalsGreaterThanToken.parent = this,
|
||||
body.parent = this;
|
||||
};
|
||||
SimpleArrowFunctionExpressionSyntax.prototype.kind = SyntaxKind.SimpleArrowFunctionExpression;
|
||||
SimpleArrowFunctionExpressionSyntax.prototype.childCount = 3;
|
||||
SimpleArrowFunctionExpressionSyntax.prototype.childCount = 4;
|
||||
SimpleArrowFunctionExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.parameter;
|
||||
case 1: return this.equalsGreaterThanToken;
|
||||
case 2: return this.body;
|
||||
case 0: return this.asyncKeyword;
|
||||
case 1: return this.parameter;
|
||||
case 2: return this.equalsGreaterThanToken;
|
||||
case 3: return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
export var CastExpressionSyntax: CastExpressionConstructor = <any>function(data: number, lessThanToken: ISyntaxToken, type: ITypeSyntax, greaterThanToken: ISyntaxToken, expression: IUnaryExpressionSyntax) {
|
||||
export var TypeAssertionExpressionSyntax: TypeAssertionExpressionConstructor = <any>function(data: number, lessThanToken: ISyntaxToken, type: ITypeSyntax, greaterThanToken: ISyntaxToken, expression: IUnaryExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.lessThanToken = lessThanToken,
|
||||
this.type = type,
|
||||
@@ -1331,9 +1333,9 @@ module TypeScript {
|
||||
greaterThanToken.parent = this,
|
||||
expression.parent = this;
|
||||
};
|
||||
CastExpressionSyntax.prototype.kind = SyntaxKind.CastExpression;
|
||||
CastExpressionSyntax.prototype.childCount = 4;
|
||||
CastExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
TypeAssertionExpressionSyntax.prototype.kind = SyntaxKind.TypeAssertionExpression;
|
||||
TypeAssertionExpressionSyntax.prototype.childCount = 4;
|
||||
TypeAssertionExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.lessThanToken;
|
||||
case 1: return this.type;
|
||||
@@ -1364,13 +1366,15 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var FunctionExpressionSyntax: FunctionExpressionConstructor = <any>function(data: number, functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken) {
|
||||
export var FunctionExpressionSyntax: FunctionExpressionConstructor = <any>function(data: number, asyncKeyword: ISyntaxToken, functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.asyncKeyword = asyncKeyword,
|
||||
this.functionKeyword = functionKeyword,
|
||||
this.asterixToken = asterixToken,
|
||||
this.identifier = identifier,
|
||||
this.callSignature = callSignature,
|
||||
this.body = body,
|
||||
asyncKeyword && (asyncKeyword.parent = this),
|
||||
functionKeyword.parent = this,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
identifier && (identifier.parent = this),
|
||||
@@ -1378,14 +1382,15 @@ module TypeScript {
|
||||
body && (body.parent = this);
|
||||
};
|
||||
FunctionExpressionSyntax.prototype.kind = SyntaxKind.FunctionExpression;
|
||||
FunctionExpressionSyntax.prototype.childCount = 5;
|
||||
FunctionExpressionSyntax.prototype.childCount = 6;
|
||||
FunctionExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.functionKeyword;
|
||||
case 1: return this.asterixToken;
|
||||
case 2: return this.identifier;
|
||||
case 3: return this.callSignature;
|
||||
case 4: return this.body;
|
||||
case 0: return this.asyncKeyword;
|
||||
case 1: return this.functionKeyword;
|
||||
case 2: return this.asterixToken;
|
||||
case 3: return this.identifier;
|
||||
case 4: return this.callSignature;
|
||||
case 5: return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1449,18 +1454,34 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var VariableDeclarationSyntax: VariableDeclarationConstructor = <any>function(data: number, varKeyword: ISyntaxToken, variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>) {
|
||||
export var AwaitExpressionSyntax: AwaitExpressionConstructor = <any>function(data: number, awaitKeyword: ISyntaxToken, expression: IUnaryExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.varKeyword = varKeyword,
|
||||
this.awaitKeyword = awaitKeyword,
|
||||
this.expression = expression,
|
||||
awaitKeyword.parent = this,
|
||||
expression && (expression.parent = this);
|
||||
};
|
||||
AwaitExpressionSyntax.prototype.kind = SyntaxKind.AwaitExpression;
|
||||
AwaitExpressionSyntax.prototype.childCount = 2;
|
||||
AwaitExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.awaitKeyword;
|
||||
case 1: return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
export var VariableDeclarationSyntax: VariableDeclarationConstructor = <any>function(data: number, varConstOrLetKeyword: ISyntaxToken, variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>) {
|
||||
if (data) { this.__data = data; }
|
||||
this.varConstOrLetKeyword = varConstOrLetKeyword,
|
||||
this.variableDeclarators = variableDeclarators,
|
||||
varKeyword.parent = this,
|
||||
varConstOrLetKeyword.parent = this,
|
||||
variableDeclarators.parent = this;
|
||||
};
|
||||
VariableDeclarationSyntax.prototype.kind = SyntaxKind.VariableDeclaration;
|
||||
VariableDeclarationSyntax.prototype.childCount = 2;
|
||||
VariableDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.varKeyword;
|
||||
case 0: return this.varConstOrLetKeyword;
|
||||
case 1: return this.variableDeclarators;
|
||||
}
|
||||
}
|
||||
@@ -1744,47 +1765,6 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var SimplePropertyAssignmentSyntax: SimplePropertyAssignmentConstructor = <any>function(data: number, propertyName: IPropertyNameSyntax, colonToken: ISyntaxToken, expression: IExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.propertyName = propertyName,
|
||||
this.colonToken = colonToken,
|
||||
this.expression = expression,
|
||||
propertyName.parent = this,
|
||||
colonToken.parent = this,
|
||||
expression.parent = this;
|
||||
};
|
||||
SimplePropertyAssignmentSyntax.prototype.kind = SyntaxKind.SimplePropertyAssignment;
|
||||
SimplePropertyAssignmentSyntax.prototype.childCount = 3;
|
||||
SimplePropertyAssignmentSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.propertyName;
|
||||
case 1: return this.colonToken;
|
||||
case 2: return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
export var FunctionPropertyAssignmentSyntax: FunctionPropertyAssignmentConstructor = <any>function(data: number, asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ExpressionBody | ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.asterixToken = asterixToken,
|
||||
this.propertyName = propertyName,
|
||||
this.callSignature = callSignature,
|
||||
this.body = body,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
propertyName.parent = this,
|
||||
callSignature.parent = this,
|
||||
body && (body.parent = this);
|
||||
};
|
||||
FunctionPropertyAssignmentSyntax.prototype.kind = SyntaxKind.FunctionPropertyAssignment;
|
||||
FunctionPropertyAssignmentSyntax.prototype.childCount = 4;
|
||||
FunctionPropertyAssignmentSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.asterixToken;
|
||||
case 1: return this.propertyName;
|
||||
case 2: return this.callSignature;
|
||||
case 3: return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
export var ParameterSyntax: ParameterConstructor = <any>function(data: number, dotDotDotToken: ISyntaxToken, modifiers: ISyntaxToken[], identifier: ISyntaxToken, questionToken: ISyntaxToken, typeAnnotation: TypeAnnotationSyntax, equalsValueClause: EqualsValueClauseSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.dotDotDotToken = dotDotDotToken,
|
||||
@@ -1880,6 +1860,53 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var PropertyAssignmentSyntax: PropertyAssignmentConstructor = <any>function(data: number, propertyName: IPropertyNameSyntax, colonToken: ISyntaxToken, expression: IExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.propertyName = propertyName,
|
||||
this.colonToken = colonToken,
|
||||
this.expression = expression,
|
||||
propertyName.parent = this,
|
||||
colonToken.parent = this,
|
||||
expression.parent = this;
|
||||
};
|
||||
PropertyAssignmentSyntax.prototype.kind = SyntaxKind.PropertyAssignment;
|
||||
PropertyAssignmentSyntax.prototype.childCount = 3;
|
||||
PropertyAssignmentSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.propertyName;
|
||||
case 1: return this.colonToken;
|
||||
case 2: return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
export var TypeAliasSyntax: TypeAliasConstructor = <any>function(data: number, modifiers: ISyntaxToken[], typeKeyword: ISyntaxToken, identifier: ISyntaxToken, equalsToken: ISyntaxToken, type: ITypeSyntax, semicolonToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.typeKeyword = typeKeyword,
|
||||
this.identifier = identifier,
|
||||
this.equalsToken = equalsToken,
|
||||
this.type = type,
|
||||
this.semicolonToken = semicolonToken,
|
||||
modifiers.parent = this,
|
||||
typeKeyword.parent = this,
|
||||
identifier.parent = this,
|
||||
equalsToken.parent = this,
|
||||
type.parent = this,
|
||||
semicolonToken && (semicolonToken.parent = this);
|
||||
};
|
||||
TypeAliasSyntax.prototype.kind = SyntaxKind.TypeAlias;
|
||||
TypeAliasSyntax.prototype.childCount = 6;
|
||||
TypeAliasSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.typeKeyword;
|
||||
case 2: return this.identifier;
|
||||
case 3: return this.equalsToken;
|
||||
case 4: return this.type;
|
||||
case 5: return this.semicolonToken;
|
||||
}
|
||||
}
|
||||
|
||||
export var ExternalModuleReferenceSyntax: ExternalModuleReferenceConstructor = <any>function(data: number, requireKeyword: ISyntaxToken, openParenToken: ISyntaxToken, stringLiteral: ISyntaxToken, closeParenToken: ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.requireKeyword = requireKeyword,
|
||||
|
||||
@@ -301,6 +301,7 @@ module TypeScript.Syntax {
|
||||
public childCount: number;
|
||||
|
||||
constructor(public kind: SyntaxKind, private _fullStart: number) {
|
||||
Debug.assert(!isNaN(_fullStart));
|
||||
}
|
||||
|
||||
public setFullStart(fullStart: number): void {
|
||||
@@ -339,7 +340,6 @@ module TypeScript.Syntax {
|
||||
class RealizedToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _nameBrand: any; public _propertyAssignmentBrand: any; public _propertyNameBrand: any;
|
||||
|
||||
private _fullStart: number;
|
||||
private _isKeywordConvertedToIdentifier: boolean;
|
||||
private _leadingTrivia: ISyntaxTriviaList;
|
||||
private _text: string;
|
||||
@@ -347,12 +347,12 @@ module TypeScript.Syntax {
|
||||
public parent: ISyntaxElement;
|
||||
public childCount: number;
|
||||
|
||||
constructor(fullStart: number,
|
||||
constructor(private _fullStart: number,
|
||||
public kind: SyntaxKind,
|
||||
isKeywordConvertedToIdentifier: boolean,
|
||||
leadingTrivia: ISyntaxTriviaList,
|
||||
text: string) {
|
||||
this._fullStart = fullStart;
|
||||
Debug.assert(!isNaN(_fullStart));
|
||||
this._isKeywordConvertedToIdentifier = isKeywordConvertedToIdentifier;
|
||||
this._text = text;
|
||||
|
||||
|
||||
+285
-237
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,7 @@ module TypeScript {
|
||||
case SyntaxKind.ParenthesizedArrowFunctionExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.FunctionPropertyAssignment:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.ConstructorDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -45,7 +44,7 @@ module TypeScript {
|
||||
export function isLeftHandSizeExpression(element: ISyntaxElement) {
|
||||
if (element) {
|
||||
switch (element.kind) {
|
||||
case SyntaxKind.MemberAccessExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.TemplateAccessExpression:
|
||||
case SyntaxKind.ObjectCreationExpression:
|
||||
@@ -101,12 +100,11 @@ module TypeScript {
|
||||
if (element) {
|
||||
switch (element.kind) {
|
||||
case SyntaxKind.ConstructorDeclaration:
|
||||
case SyntaxKind.IndexMemberDeclaration:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.MemberVariableDeclaration:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -187,7 +185,7 @@ module TypeScript {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.TypeArgumentList:
|
||||
case SyntaxKind.TypeParameterList:
|
||||
case SyntaxKind.CastExpression:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -228,40 +226,5 @@ module TypeScript {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export function isAmbientDeclarationSyntax(positionNode: ISyntaxNode): boolean {
|
||||
if (!positionNode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var node = positionNode;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
if (SyntaxUtilities.containsToken(<ISyntaxToken[]>(<any>node).modifiers, SyntaxKind.DeclareKeyword)) {
|
||||
return true;
|
||||
}
|
||||
// Fall through to check if syntax container is ambient
|
||||
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ConstructorDeclaration:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MemberVariableDeclaration:
|
||||
if (SyntaxUtilities.isClassElement(node) || SyntaxUtilities.isModuleElement(node)) {
|
||||
return SyntaxUtilities.isAmbientDeclarationSyntax(Syntax.containingNode(positionNode));
|
||||
}
|
||||
|
||||
case SyntaxKind.EnumElement:
|
||||
return SyntaxUtilities.isAmbientDeclarationSyntax(Syntax.containingNode(Syntax.containingNode(positionNode)));
|
||||
|
||||
default:
|
||||
return SyntaxUtilities.isAmbientDeclarationSyntax(Syntax.containingNode(positionNode));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,9 @@ module TypeScript {
|
||||
case SyntaxKind.EnumDeclaration: return visitor.visitEnumDeclaration(<EnumDeclarationSyntax>element);
|
||||
case SyntaxKind.ImportDeclaration: return visitor.visitImportDeclaration(<ImportDeclarationSyntax>element);
|
||||
case SyntaxKind.ExportAssignment: return visitor.visitExportAssignment(<ExportAssignmentSyntax>element);
|
||||
case SyntaxKind.MemberFunctionDeclaration: return visitor.visitMemberFunctionDeclaration(<MemberFunctionDeclarationSyntax>element);
|
||||
case SyntaxKind.MemberVariableDeclaration: return visitor.visitMemberVariableDeclaration(<MemberVariableDeclarationSyntax>element);
|
||||
case SyntaxKind.MethodDeclaration: return visitor.visitMethodDeclaration(<MethodDeclarationSyntax>element);
|
||||
case SyntaxKind.PropertyDeclaration: return visitor.visitPropertyDeclaration(<PropertyDeclarationSyntax>element);
|
||||
case SyntaxKind.ConstructorDeclaration: return visitor.visitConstructorDeclaration(<ConstructorDeclarationSyntax>element);
|
||||
case SyntaxKind.IndexMemberDeclaration: return visitor.visitIndexMemberDeclaration(<IndexMemberDeclarationSyntax>element);
|
||||
case SyntaxKind.GetAccessor: return visitor.visitGetAccessor(<GetAccessorSyntax>element);
|
||||
case SyntaxKind.SetAccessor: return visitor.visitSetAccessor(<SetAccessorSyntax>element);
|
||||
case SyntaxKind.PropertySignature: return visitor.visitPropertySignature(<PropertySignatureSyntax>element);
|
||||
@@ -58,7 +57,7 @@ module TypeScript {
|
||||
case SyntaxKind.ConditionalExpression: return visitor.visitConditionalExpression(<ConditionalExpressionSyntax>element);
|
||||
case SyntaxKind.BinaryExpression: return visitor.visitBinaryExpression(<BinaryExpressionSyntax>element);
|
||||
case SyntaxKind.PostfixUnaryExpression: return visitor.visitPostfixUnaryExpression(<PostfixUnaryExpressionSyntax>element);
|
||||
case SyntaxKind.MemberAccessExpression: return visitor.visitMemberAccessExpression(<MemberAccessExpressionSyntax>element);
|
||||
case SyntaxKind.PropertyAccessExpression: return visitor.visitPropertyAccessExpression(<PropertyAccessExpressionSyntax>element);
|
||||
case SyntaxKind.InvocationExpression: return visitor.visitInvocationExpression(<InvocationExpressionSyntax>element);
|
||||
case SyntaxKind.ArrayLiteralExpression: return visitor.visitArrayLiteralExpression(<ArrayLiteralExpressionSyntax>element);
|
||||
case SyntaxKind.ObjectLiteralExpression: return visitor.visitObjectLiteralExpression(<ObjectLiteralExpressionSyntax>element);
|
||||
@@ -66,13 +65,14 @@ module TypeScript {
|
||||
case SyntaxKind.ParenthesizedExpression: return visitor.visitParenthesizedExpression(<ParenthesizedExpressionSyntax>element);
|
||||
case SyntaxKind.ParenthesizedArrowFunctionExpression: return visitor.visitParenthesizedArrowFunctionExpression(<ParenthesizedArrowFunctionExpressionSyntax>element);
|
||||
case SyntaxKind.SimpleArrowFunctionExpression: return visitor.visitSimpleArrowFunctionExpression(<SimpleArrowFunctionExpressionSyntax>element);
|
||||
case SyntaxKind.CastExpression: return visitor.visitCastExpression(<CastExpressionSyntax>element);
|
||||
case SyntaxKind.TypeAssertionExpression: return visitor.visitTypeAssertionExpression(<TypeAssertionExpressionSyntax>element);
|
||||
case SyntaxKind.ElementAccessExpression: return visitor.visitElementAccessExpression(<ElementAccessExpressionSyntax>element);
|
||||
case SyntaxKind.FunctionExpression: return visitor.visitFunctionExpression(<FunctionExpressionSyntax>element);
|
||||
case SyntaxKind.OmittedExpression: return visitor.visitOmittedExpression(<OmittedExpressionSyntax>element);
|
||||
case SyntaxKind.TemplateExpression: return visitor.visitTemplateExpression(<TemplateExpressionSyntax>element);
|
||||
case SyntaxKind.TemplateAccessExpression: return visitor.visitTemplateAccessExpression(<TemplateAccessExpressionSyntax>element);
|
||||
case SyntaxKind.YieldExpression: return visitor.visitYieldExpression(<YieldExpressionSyntax>element);
|
||||
case SyntaxKind.AwaitExpression: return visitor.visitAwaitExpression(<AwaitExpressionSyntax>element);
|
||||
case SyntaxKind.VariableDeclaration: return visitor.visitVariableDeclaration(<VariableDeclarationSyntax>element);
|
||||
case SyntaxKind.VariableDeclarator: return visitor.visitVariableDeclarator(<VariableDeclaratorSyntax>element);
|
||||
case SyntaxKind.ArgumentList: return visitor.visitArgumentList(<ArgumentListSyntax>element);
|
||||
@@ -89,13 +89,13 @@ module TypeScript {
|
||||
case SyntaxKind.TemplateClause: return visitor.visitTemplateClause(<TemplateClauseSyntax>element);
|
||||
case SyntaxKind.TypeParameter: return visitor.visitTypeParameter(<TypeParameterSyntax>element);
|
||||
case SyntaxKind.Constraint: return visitor.visitConstraint(<ConstraintSyntax>element);
|
||||
case SyntaxKind.SimplePropertyAssignment: return visitor.visitSimplePropertyAssignment(<SimplePropertyAssignmentSyntax>element);
|
||||
case SyntaxKind.FunctionPropertyAssignment: return visitor.visitFunctionPropertyAssignment(<FunctionPropertyAssignmentSyntax>element);
|
||||
case SyntaxKind.Parameter: return visitor.visitParameter(<ParameterSyntax>element);
|
||||
case SyntaxKind.EnumElement: return visitor.visitEnumElement(<EnumElementSyntax>element);
|
||||
case SyntaxKind.TypeAnnotation: return visitor.visitTypeAnnotation(<TypeAnnotationSyntax>element);
|
||||
case SyntaxKind.ExpressionBody: return visitor.visitExpressionBody(<ExpressionBody>element);
|
||||
case SyntaxKind.ComputedPropertyName: return visitor.visitComputedPropertyName(<ComputedPropertyNameSyntax>element);
|
||||
case SyntaxKind.PropertyAssignment: return visitor.visitPropertyAssignment(<PropertyAssignmentSyntax>element);
|
||||
case SyntaxKind.TypeAlias: return visitor.visitTypeAlias(<TypeAliasSyntax>element);
|
||||
case SyntaxKind.ExternalModuleReference: return visitor.visitExternalModuleReference(<ExternalModuleReferenceSyntax>element);
|
||||
case SyntaxKind.ModuleNameModuleReference: return visitor.visitModuleNameModuleReference(<ModuleNameModuleReferenceSyntax>element);
|
||||
default: return visitor.visitToken(<ISyntaxToken>element);
|
||||
@@ -122,10 +122,9 @@ module TypeScript {
|
||||
visitEnumDeclaration(node: EnumDeclarationSyntax): any;
|
||||
visitImportDeclaration(node: ImportDeclarationSyntax): any;
|
||||
visitExportAssignment(node: ExportAssignmentSyntax): any;
|
||||
visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): any;
|
||||
visitMemberVariableDeclaration(node: MemberVariableDeclarationSyntax): any;
|
||||
visitMethodDeclaration(node: MethodDeclarationSyntax): any;
|
||||
visitPropertyDeclaration(node: PropertyDeclarationSyntax): any;
|
||||
visitConstructorDeclaration(node: ConstructorDeclarationSyntax): any;
|
||||
visitIndexMemberDeclaration(node: IndexMemberDeclarationSyntax): any;
|
||||
visitGetAccessor(node: GetAccessorSyntax): any;
|
||||
visitSetAccessor(node: SetAccessorSyntax): any;
|
||||
visitPropertySignature(node: PropertySignatureSyntax): any;
|
||||
@@ -158,7 +157,7 @@ module TypeScript {
|
||||
visitConditionalExpression(node: ConditionalExpressionSyntax): any;
|
||||
visitBinaryExpression(node: BinaryExpressionSyntax): any;
|
||||
visitPostfixUnaryExpression(node: PostfixUnaryExpressionSyntax): any;
|
||||
visitMemberAccessExpression(node: MemberAccessExpressionSyntax): any;
|
||||
visitPropertyAccessExpression(node: PropertyAccessExpressionSyntax): any;
|
||||
visitInvocationExpression(node: InvocationExpressionSyntax): any;
|
||||
visitArrayLiteralExpression(node: ArrayLiteralExpressionSyntax): any;
|
||||
visitObjectLiteralExpression(node: ObjectLiteralExpressionSyntax): any;
|
||||
@@ -166,13 +165,14 @@ module TypeScript {
|
||||
visitParenthesizedExpression(node: ParenthesizedExpressionSyntax): any;
|
||||
visitParenthesizedArrowFunctionExpression(node: ParenthesizedArrowFunctionExpressionSyntax): any;
|
||||
visitSimpleArrowFunctionExpression(node: SimpleArrowFunctionExpressionSyntax): any;
|
||||
visitCastExpression(node: CastExpressionSyntax): any;
|
||||
visitTypeAssertionExpression(node: TypeAssertionExpressionSyntax): any;
|
||||
visitElementAccessExpression(node: ElementAccessExpressionSyntax): any;
|
||||
visitFunctionExpression(node: FunctionExpressionSyntax): any;
|
||||
visitOmittedExpression(node: OmittedExpressionSyntax): any;
|
||||
visitTemplateExpression(node: TemplateExpressionSyntax): any;
|
||||
visitTemplateAccessExpression(node: TemplateAccessExpressionSyntax): any;
|
||||
visitYieldExpression(node: YieldExpressionSyntax): any;
|
||||
visitAwaitExpression(node: AwaitExpressionSyntax): any;
|
||||
visitVariableDeclaration(node: VariableDeclarationSyntax): any;
|
||||
visitVariableDeclarator(node: VariableDeclaratorSyntax): any;
|
||||
visitArgumentList(node: ArgumentListSyntax): any;
|
||||
@@ -189,13 +189,13 @@ module TypeScript {
|
||||
visitTemplateClause(node: TemplateClauseSyntax): any;
|
||||
visitTypeParameter(node: TypeParameterSyntax): any;
|
||||
visitConstraint(node: ConstraintSyntax): any;
|
||||
visitSimplePropertyAssignment(node: SimplePropertyAssignmentSyntax): any;
|
||||
visitFunctionPropertyAssignment(node: FunctionPropertyAssignmentSyntax): any;
|
||||
visitParameter(node: ParameterSyntax): any;
|
||||
visitEnumElement(node: EnumElementSyntax): any;
|
||||
visitTypeAnnotation(node: TypeAnnotationSyntax): any;
|
||||
visitExpressionBody(node: ExpressionBody): any;
|
||||
visitComputedPropertyName(node: ComputedPropertyNameSyntax): any;
|
||||
visitPropertyAssignment(node: PropertyAssignmentSyntax): any;
|
||||
visitTypeAlias(node: TypeAliasSyntax): any;
|
||||
visitExternalModuleReference(node: ExternalModuleReferenceSyntax): any;
|
||||
visitModuleNameModuleReference(node: ModuleNameModuleReferenceSyntax): any;
|
||||
}
|
||||
|
||||
@@ -142,13 +142,14 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitExportAssignment(node: ExportAssignmentSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.exportKeyword);
|
||||
this.visitToken(node.equalsToken);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): void {
|
||||
public visitMethodDeclaration(node: MethodDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
@@ -156,7 +157,7 @@ module TypeScript {
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitMemberVariableDeclaration(node: MemberVariableDeclarationSyntax): void {
|
||||
public visitPropertyDeclaration(node: PropertyDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
visitNodeOrToken(this, node.variableDeclarator);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
@@ -169,12 +170,6 @@ module TypeScript {
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitIndexMemberDeclaration(node: IndexMemberDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
visitNodeOrToken(this, node.indexSignature);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitGetAccessor(node: GetAccessorSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.getKeyword);
|
||||
@@ -195,12 +190,14 @@ module TypeScript {
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
this.visitOptionalToken(node.questionToken);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
this.visitOptionalToken(node.semicolonOrCommaToken);
|
||||
}
|
||||
|
||||
public visitCallSignature(node: CallSignatureSyntax): void {
|
||||
visitNodeOrToken(this, node.typeParameterList);
|
||||
visitNodeOrToken(this, node.parameterList);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
this.visitOptionalToken(node.semicolonOrCommaToken);
|
||||
}
|
||||
|
||||
public visitConstructSignature(node: ConstructSignatureSyntax): void {
|
||||
@@ -209,10 +206,12 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitIndexSignature(node: IndexSignatureSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.openBracketToken);
|
||||
this.visitList(node.parameters);
|
||||
this.visitToken(node.closeBracketToken);
|
||||
visitNodeOrToken(this, node.typeAnnotation);
|
||||
this.visitOptionalToken(node.semicolonOrCommaToken);
|
||||
}
|
||||
|
||||
public visitMethodSignature(node: MethodSignatureSyntax): void {
|
||||
@@ -391,7 +390,7 @@ module TypeScript {
|
||||
this.visitToken(node.operatorToken);
|
||||
}
|
||||
|
||||
public visitMemberAccessExpression(node: MemberAccessExpressionSyntax): void {
|
||||
public visitPropertyAccessExpression(node: PropertyAccessExpressionSyntax): void {
|
||||
visitNodeOrToken(this, node.expression);
|
||||
this.visitToken(node.dotToken);
|
||||
this.visitToken(node.name);
|
||||
@@ -427,18 +426,20 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitParenthesizedArrowFunctionExpression(node: ParenthesizedArrowFunctionExpressionSyntax): void {
|
||||
this.visitOptionalToken(node.asyncKeyword);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
this.visitToken(node.equalsGreaterThanToken);
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitSimpleArrowFunctionExpression(node: SimpleArrowFunctionExpressionSyntax): void {
|
||||
this.visitOptionalToken(node.asyncKeyword);
|
||||
visitNodeOrToken(this, node.parameter);
|
||||
this.visitToken(node.equalsGreaterThanToken);
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitCastExpression(node: CastExpressionSyntax): void {
|
||||
public visitTypeAssertionExpression(node: TypeAssertionExpressionSyntax): void {
|
||||
this.visitToken(node.lessThanToken);
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.visitToken(node.greaterThanToken);
|
||||
@@ -453,6 +454,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitFunctionExpression(node: FunctionExpressionSyntax): void {
|
||||
this.visitOptionalToken(node.asyncKeyword);
|
||||
this.visitToken(node.functionKeyword);
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
this.visitOptionalToken(node.identifier);
|
||||
@@ -479,8 +481,13 @@ module TypeScript {
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitAwaitExpression(node: AwaitExpressionSyntax): void {
|
||||
this.visitToken(node.awaitKeyword);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitVariableDeclaration(node: VariableDeclarationSyntax): void {
|
||||
this.visitToken(node.varKeyword);
|
||||
this.visitToken(node.varConstOrLetKeyword);
|
||||
this.visitList(node.variableDeclarators);
|
||||
}
|
||||
|
||||
@@ -572,19 +579,6 @@ module TypeScript {
|
||||
visitNodeOrToken(this, node.typeOrExpression);
|
||||
}
|
||||
|
||||
public visitSimplePropertyAssignment(node: SimplePropertyAssignmentSyntax): void {
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
this.visitToken(node.colonToken);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitFunctionPropertyAssignment(node: FunctionPropertyAssignmentSyntax): void {
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.body);
|
||||
}
|
||||
|
||||
public visitParameter(node: ParameterSyntax): void {
|
||||
this.visitOptionalToken(node.dotDotDotToken);
|
||||
this.visitList(node.modifiers);
|
||||
@@ -615,6 +609,21 @@ module TypeScript {
|
||||
this.visitToken(node.closeBracketToken);
|
||||
}
|
||||
|
||||
public visitPropertyAssignment(node: PropertyAssignmentSyntax): void {
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
this.visitToken(node.colonToken);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitTypeAlias(node: TypeAliasSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.typeKeyword);
|
||||
this.visitToken(node.identifier);
|
||||
this.visitToken(node.equalsToken);
|
||||
visitNodeOrToken(this, node.type);
|
||||
this.visitOptionalToken(node.semicolonToken);
|
||||
}
|
||||
|
||||
public visitExternalModuleReference(node: ExternalModuleReferenceSyntax): void {
|
||||
this.visitToken(node.requireKeyword);
|
||||
this.visitToken(node.openParenToken);
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
var fixedWidthArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 5, 8, 8, 7, 6, 2, 4, 5, 7, 3, 8, 2, 2, 10, 3, 4, 6, 6, 4, 5, 4, 3, 6, 3, 4, 5, 4, 5, 5, 4, 6, 7, 6, 5, 10, 9, 3, 7, 7, 9, 6, 6, 5, 3, 7, 11, 7, 3, 6, 7, 6, 3, 6, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 2, 2, 2, 1, 2];
|
||||
function fixedWidthTokenLength(kind: SyntaxKind) {
|
||||
return fixedWidthArray[kind];
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ module ts {
|
||||
}
|
||||
|
||||
export function isInsideTemplateLiteral(node: LiteralExpression, position: number) {
|
||||
return (node.getStart() < position && position < node.getEnd())
|
||||
|| (isUnterminatedTemplateEnd(node) && position === node.getEnd());
|
||||
return isTemplateLiteralKind(node.kind)
|
||||
&& (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts(2,8): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName10_es6.ts (1 errors) ====
|
||||
class C {
|
||||
[e] = 1
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(2,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(2,8): error TS1109: Expression expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName11_es6.ts (3 errors) ====
|
||||
class C {
|
||||
[e]();
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(2,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(2,10): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName12_es6.ts (3 errors) ====
|
||||
class C {
|
||||
[e]() { }
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts(1,11): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName13_es6.ts (1 errors) ====
|
||||
var v: { [e]: number };
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName14_es6.ts (1 errors) ====
|
||||
var v: { [e](): number };
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts(1,32): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName15_es6.ts (1 errors) ====
|
||||
var v: { [e: number]: string; [e]: number };
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
@@ -1,18 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,3): error TS1132: Enum member expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,3): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts(2,4): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName16_es6.ts (4 errors) ====
|
||||
enum E {
|
||||
[e] = 1
|
||||
~
|
||||
!!! error TS1132: Enum member expected.
|
||||
~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,22): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,26): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts(1,16): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName17_es6.ts (4 errors) ====
|
||||
var v = { set [e](v) { } }
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName18_es6.ts (1 errors) ====
|
||||
var v: { [e]?(): number };
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName19_es6.ts (1 errors) ====
|
||||
var v: { [e]? };
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,15): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName1_es6.ts (3 errors) ====
|
||||
var v = { [e] };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,19 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,14): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,16): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,18): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName2_es6.ts (5 errors) ====
|
||||
var v = { [e]: 1 };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,17): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName3_es6.ts (4 errors) ====
|
||||
var v = { [e]() { } };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,15): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,21): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,25): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts(1,16): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName4_es6.ts (4 errors) ====
|
||||
var v = { get [e]() { } };
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,19 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,18): error TS1005: ':' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,28): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,32): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,18): error TS2304: Cannot find name 'get'.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts(1,23): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName5_es6.ts (5 errors) ====
|
||||
var v = { public get [e]() { } };
|
||||
~~~
|
||||
!!! error TS1005: ':' expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'get'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,28 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,11): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,14): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,16): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,30): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,12): error TS2304: Cannot find name 'e'.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,20): error TS2304: Cannot find name 'e'.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts(1,24): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName6_es6.ts (8 errors) ====
|
||||
var v = { [e]: 1, [e + e]: 2 };
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts(2,5): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName7_es6.ts (1 errors) ====
|
||||
class C {
|
||||
[e]
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts(2,12): error TS1022: An index signature parameter must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName8_es6.ts (1 errors) ====
|
||||
class C {
|
||||
public [e]
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts(2,5): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts(2,9): error TS2304: Cannot find name 'Type'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedPropertyNames/ComputedPropertyName9_es6.ts (2 errors) ====
|
||||
class C {
|
||||
[e]: Type
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'Type'.
|
||||
}
|
||||
+1
-1
@@ -17,6 +17,6 @@ module A {
|
||||
export var beez2 = new Array<B>();
|
||||
>beez2 : B[]
|
||||
>new Array<B>() : B[]
|
||||
>Array : { (arrayLength?: number): any[]; <T>(arrayLength: number): T[]; <T>(...items: T[]): T[]; new (arrayLength?: number): any[]; new <T>(arrayLength: number): T[]; new <T>(...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }
|
||||
>Array : ArrayConstructor
|
||||
>B : B
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
|
||||
function * foo(a = yield => yield) {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//// [FunctionDeclaration10_es6.ts]
|
||||
function * foo(a = yield => yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration10_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = function (yield) { return yield; }; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts ===
|
||||
function * foo(a = yield => yield) {
|
||||
>foo : (a?: (yield: any) => any) => void
|
||||
>a : (yield: any) => any
|
||||
>yield => yield : (yield: any) => any
|
||||
>yield : any
|
||||
>yield : any
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
|
||||
function * yield() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [FunctionDeclaration11_es6.ts]
|
||||
function * yield() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration11_es6.js]
|
||||
function yield() {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts ===
|
||||
function * yield() {
|
||||
>yield : () => void
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
~~~~~
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//// [FunctionDeclaration13_es6.ts]
|
||||
function * foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
}
|
||||
|
||||
|
||||
//// [FunctionDeclaration13_es6.js]
|
||||
function foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [FunctionDeclaration1_es6.ts]
|
||||
function * foo() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration1_es6.js]
|
||||
function foo() {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts ===
|
||||
function * foo() {
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
|
||||
function*foo(a = yield) {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//// [FunctionDeclaration6_es6.ts]
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration6_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (2 errors) ====
|
||||
function*bar() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
~~~~~
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user