mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into es6Typings
This commit is contained in:
+10
-10
@@ -66,9 +66,9 @@ module ts {
|
||||
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();
|
||||
|
||||
@@ -222,7 +222,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 = {};
|
||||
}
|
||||
@@ -279,7 +279,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;
|
||||
@@ -341,7 +341,7 @@ 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);
|
||||
@@ -434,14 +434,14 @@ 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);
|
||||
@@ -471,7 +471,7 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
+260
-188
File diff suppressed because it is too large
Load Diff
@@ -134,6 +134,13 @@ module ts {
|
||||
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." },
|
||||
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." },
|
||||
|
||||
@@ -491,7 +491,8 @@
|
||||
"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
|
||||
},
|
||||
@@ -527,7 +528,34 @@
|
||||
"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
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
|
||||
+131
-79
@@ -357,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[] = [];
|
||||
|
||||
@@ -485,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);
|
||||
@@ -518,8 +518,8 @@ 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);
|
||||
@@ -583,7 +583,7 @@ module ts {
|
||||
emitSeparatedList(type.types, " | ", emitType);
|
||||
}
|
||||
|
||||
function emitParenType(type: ParenTypeNode) {
|
||||
function emitParenType(type: ParenthesizedTypeNode) {
|
||||
write("(");
|
||||
emitType(type.type);
|
||||
write(")");
|
||||
@@ -615,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
|
||||
@@ -701,7 +701,7 @@ module ts {
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines((<Block>node.body).statements);
|
||||
emitLines((<ModuleBlock>node.body).statements);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
@@ -851,11 +851,11 @@ module ts {
|
||||
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
|
||||
@@ -865,7 +865,7 @@ module ts {
|
||||
return {
|
||||
diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: (<Declaration>node.parent).name
|
||||
typeName: (<Declaration>node.parent.parent).name
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -890,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();
|
||||
@@ -915,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();
|
||||
@@ -927,7 +928,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitPropertyDeclaration(node: PropertyDeclaration) {
|
||||
function emitPropertyDeclaration(node: Declaration) {
|
||||
emitJsDocComments(node);
|
||||
emitClassMemberDeclarationFlags(node);
|
||||
emitVariableDeclaration(<VariableDeclaration>node);
|
||||
@@ -1944,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);
|
||||
}
|
||||
@@ -1996,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(" + ");
|
||||
@@ -2027,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.");
|
||||
@@ -2170,7 +2187,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitArrayLiteral(node: ArrayLiteral) {
|
||||
function emitArrayLiteral(node: ArrayLiteralExpression) {
|
||||
if (node.flags & NodeFlags.MultiLine) {
|
||||
write("[");
|
||||
increaseIndent();
|
||||
@@ -2186,7 +2203,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitObjectLiteral(node: ObjectLiteral) {
|
||||
function emitObjectLiteral(node: ObjectLiteralExpression) {
|
||||
if (!node.properties.length) {
|
||||
write("{}");
|
||||
}
|
||||
@@ -2249,48 +2266,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);
|
||||
@@ -2306,7 +2329,7 @@ module ts {
|
||||
|
||||
function emitNewExpression(node: NewExpression) {
|
||||
write("new ");
|
||||
emit(node.func);
|
||||
emit(node.expression);
|
||||
if (node.arguments) {
|
||||
write("(");
|
||||
emitCommaList(node.arguments, /*includeTrailingComma*/ false);
|
||||
@@ -2321,14 +2344,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)
|
||||
@@ -2339,7 +2362,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);
|
||||
@@ -2351,10 +2379,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
|
||||
@@ -2367,11 +2411,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(" ");
|
||||
}
|
||||
@@ -2380,11 +2421,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(" ");
|
||||
@@ -2860,7 +2904,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;
|
||||
}
|
||||
@@ -3006,19 +3050,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();
|
||||
@@ -3037,8 +3082,8 @@ module ts {
|
||||
scopeEmitEnd();
|
||||
emitStart(node);
|
||||
write(")(");
|
||||
if (node.baseType) {
|
||||
emit(node.baseType.typeName);
|
||||
if (baseTypeNode) {
|
||||
emit(baseTypeNode.typeName);
|
||||
}
|
||||
write(");");
|
||||
emitEnd(node);
|
||||
@@ -3079,7 +3124,7 @@ module ts {
|
||||
if (ctor) {
|
||||
emitDefaultValueAssignments(ctor);
|
||||
emitRestParameter(ctor);
|
||||
if (node.baseType) {
|
||||
if (baseTypeNode) {
|
||||
var superCall = findInitialSuperCall(ctor);
|
||||
if (superCall) {
|
||||
writeLine();
|
||||
@@ -3089,11 +3134,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);
|
||||
@@ -3231,7 +3276,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();
|
||||
}
|
||||
@@ -3377,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) {
|
||||
@@ -3471,38 +3516,45 @@ 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.ShorthandPropertyAssignment:
|
||||
return emitShortHandPropertyAssignment(<ShortHandPropertyDeclaration>node);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return emitComputedPropertyName(<ComputedPropertyName>node);
|
||||
case SyntaxKind.PropertyAccess:
|
||||
return emitPropertyAccess(<PropertyAccess>node);
|
||||
case SyntaxKind.IndexedAccess:
|
||||
return emitIndexedAccess(<IndexedAccess>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:
|
||||
|
||||
+610
-282
File diff suppressed because it is too large
Load Diff
@@ -753,6 +753,30 @@ 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;
|
||||
@@ -933,6 +957,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();
|
||||
|
||||
+149
-66
@@ -163,29 +163,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,
|
||||
@@ -201,8 +203,6 @@ module ts {
|
||||
ReturnStatement,
|
||||
WithStatement,
|
||||
SwitchStatement,
|
||||
CaseClause,
|
||||
DefaultClause,
|
||||
LabeledStatement,
|
||||
ThrowStatement,
|
||||
TryStatement,
|
||||
@@ -221,6 +221,13 @@ module ts {
|
||||
ModuleBlock,
|
||||
ImportDeclaration,
|
||||
ExportAssignment,
|
||||
// Clauses
|
||||
CaseClause,
|
||||
DefaultClause,
|
||||
HeritageClause,
|
||||
// Property assignments
|
||||
PropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
// Enum
|
||||
EnumMember,
|
||||
// Top-level nodes
|
||||
@@ -240,7 +247,7 @@ module ts {
|
||||
FirstFutureReservedWord = ImplementsKeyword,
|
||||
LastFutureReservedWord = YieldKeyword,
|
||||
FirstTypeNode = TypeReference,
|
||||
LastTypeNode = ParenType,
|
||||
LastTypeNode = ParenthesizedType,
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = EndOfFileToken,
|
||||
@@ -310,7 +317,7 @@ module ts {
|
||||
flags: number;
|
||||
}
|
||||
|
||||
export interface Identifier extends Node {
|
||||
export interface Identifier extends PrimaryExpression {
|
||||
text: string; // Text of identifier (with escapes converted to characters)
|
||||
}
|
||||
|
||||
@@ -331,6 +338,7 @@ module ts {
|
||||
export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName;
|
||||
|
||||
export interface Declaration extends Node {
|
||||
_declarationBrand: any;
|
||||
name?: DeclarationName;
|
||||
}
|
||||
|
||||
@@ -346,7 +354,8 @@ module ts {
|
||||
expression?: Expression;
|
||||
}
|
||||
|
||||
export interface SignatureDeclaration extends Declaration, ParsedSignature { }
|
||||
export interface SignatureDeclaration extends Declaration, ParsedSignature {
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
@@ -354,7 +363,7 @@ module ts {
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export interface PropertyDeclaration extends Declaration {
|
||||
export interface PropertyDeclaration extends Declaration, ClassElement {
|
||||
type?: TypeNode;
|
||||
initializer?: Expression;
|
||||
}
|
||||
@@ -374,27 +383,33 @@ module ts {
|
||||
* AccessorDeclaration
|
||||
*/
|
||||
export interface FunctionLikeDeclaration extends SignatureDeclaration {
|
||||
_functionLikeDeclarationBrand: any;
|
||||
|
||||
asteriskToken?: 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 Node, ParsedSignature {
|
||||
export interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration {
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
|
||||
_indexSignatureDeclarationBrand: any;
|
||||
}
|
||||
|
||||
export interface TypeNode extends Node { }
|
||||
|
||||
export interface TypeReferenceNode extends TypeNode {
|
||||
@@ -406,7 +421,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>;
|
||||
}
|
||||
|
||||
@@ -422,7 +438,7 @@ module ts {
|
||||
types: NodeArray<TypeNode>;
|
||||
}
|
||||
|
||||
export interface ParenTypeNode extends TypeNode {
|
||||
export interface ParenthesizedTypeNode extends TypeNode {
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
@@ -430,13 +446,58 @@ module ts {
|
||||
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 {
|
||||
@@ -456,7 +517,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
|
||||
}
|
||||
@@ -464,11 +525,11 @@ 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;
|
||||
}
|
||||
|
||||
export interface TemplateExpression extends Expression {
|
||||
export interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
}
|
||||
@@ -480,49 +541,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>;
|
||||
@@ -605,27 +669,39 @@ module ts {
|
||||
finallyBlock?: Block;
|
||||
}
|
||||
|
||||
export interface CatchBlock extends Block {
|
||||
export interface CatchBlock extends Block, Declaration {
|
||||
variable: Identifier;
|
||||
type?: TypeNode;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
baseType?: TypeReferenceNode;
|
||||
implementedTypes?: NodeArray<TypeReferenceNode>;
|
||||
members: NodeArray<Node>;
|
||||
export interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
|
||||
export interface InterfaceDeclaration extends Declaration {
|
||||
export interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
baseTypes?: NodeArray<TypeReferenceNode>;
|
||||
members: NodeArray<Node>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration {
|
||||
export interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
export interface InterfaceDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<Declaration>;
|
||||
}
|
||||
|
||||
export interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
type: TypeNode;
|
||||
}
|
||||
@@ -637,23 +713,27 @@ module ts {
|
||||
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;
|
||||
}
|
||||
|
||||
export interface ExportAssignment extends Statement {
|
||||
export interface ExportAssignment extends Statement, ModuleElement {
|
||||
exportName: Identifier;
|
||||
}
|
||||
|
||||
@@ -665,7 +745,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;
|
||||
@@ -782,7 +865,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;
|
||||
}
|
||||
|
||||
@@ -873,7 +956,7 @@ module ts {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -242,8 +242,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
|
||||
@@ -483,8 +483,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' />
|
||||
|
||||
@@ -701,25 +701,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)) &&
|
||||
|
||||
@@ -523,7 +523,7 @@ 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:
|
||||
@@ -613,7 +613,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 +673,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
+34
-30
@@ -349,7 +349,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 +712,7 @@ module ts {
|
||||
}
|
||||
|
||||
class SourceFileObject extends NodeObject implements SourceFile {
|
||||
public _declarationBrand: any;
|
||||
public filename: string;
|
||||
public text: string;
|
||||
|
||||
@@ -771,7 +772,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
namedDeclarations.push(node);
|
||||
namedDeclarations.push(functionDeclaration);
|
||||
}
|
||||
|
||||
forEachChild(node, visit);
|
||||
@@ -1927,21 +1928,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 +1971,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2373,9 +2374,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 +2405,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 +2416,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 +2427,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);
|
||||
}
|
||||
});
|
||||
@@ -2542,7 +2546,7 @@ module ts {
|
||||
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 +2555,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;
|
||||
}
|
||||
@@ -2878,8 +2882,8 @@ 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)){
|
||||
location = location.parent;
|
||||
@@ -2903,7 +2907,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)) {
|
||||
@@ -3201,7 +3205,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:
|
||||
@@ -3721,7 +3725,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)) {
|
||||
@@ -3795,7 +3799,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getModifierOccurrences(modifier: SyntaxKind, declaration: Declaration) {
|
||||
function getModifierOccurrences(modifier: SyntaxKind, declaration: Node) {
|
||||
var container = declaration.parent;
|
||||
|
||||
// Make sure we only highlight the keyword when it makes sense to do so.
|
||||
@@ -4424,11 +4428,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -4574,7 +4578,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) {
|
||||
@@ -4736,7 +4740,7 @@ module ts {
|
||||
return emitOutput;
|
||||
}
|
||||
|
||||
function getMeaningFromDeclaration(node: Declaration): SemanticMeaning {
|
||||
function getMeaningFromDeclaration(node: Node): SemanticMeaning {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
@@ -4879,7 +4883,7 @@ module ts {
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
@@ -5063,8 +5067,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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
@@ -323,19 +323,19 @@ 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:
|
||||
@@ -397,7 +397,7 @@ module ts.formatting {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
@@ -405,7 +405,7 @@ module ts.formatting {
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
@@ -424,7 +424,7 @@ 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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user