mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Merge pull request #1129 from Microsoft/yieldExpressions
Parsing support (including incremental parsing) for 'yield' expressions.
This commit is contained in:
commit
bc40997aed
@ -96,6 +96,7 @@ module TypeScript {
|
||||
Type_expected: "Type expected.",
|
||||
Template_literal_cannot_be_used_as_an_element_name: "Template literal cannot be used as an element name.",
|
||||
Computed_property_names_cannot_be_used_here: "Computed property names cannot be used here.",
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: "'yield' expression must be contained within a generator declaration.",
|
||||
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.",
|
||||
|
||||
@ -98,6 +98,7 @@ module TypeScript {
|
||||
"Type expected.": { "code": 1110, "category": DiagnosticCategory.Error },
|
||||
"Template literal cannot be used as an element name.": { "code": 1111, "category": DiagnosticCategory.Error },
|
||||
"Computed property names cannot be used here.": { "code": 1112, "category": DiagnosticCategory.Error },
|
||||
"'yield' expression must be contained within a generator declaration.": { "code": 1113, "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 },
|
||||
|
||||
@ -379,6 +379,10 @@
|
||||
"category": "Error",
|
||||
"code": 1112
|
||||
},
|
||||
"'yield' expression must be contained within a generator declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1113
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2000
|
||||
|
||||
@ -599,30 +599,31 @@ var TypeScript;
|
||||
SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression";
|
||||
SyntaxKind[SyntaxKind["TemplateExpression"] = 188] = "TemplateExpression";
|
||||
SyntaxKind[SyntaxKind["TemplateAccessExpression"] = 189] = "TemplateAccessExpression";
|
||||
SyntaxKind[SyntaxKind["VariableDeclaration"] = 190] = "VariableDeclaration";
|
||||
SyntaxKind[SyntaxKind["VariableDeclarator"] = 191] = "VariableDeclarator";
|
||||
SyntaxKind[SyntaxKind["ArgumentList"] = 192] = "ArgumentList";
|
||||
SyntaxKind[SyntaxKind["ParameterList"] = 193] = "ParameterList";
|
||||
SyntaxKind[SyntaxKind["TypeArgumentList"] = 194] = "TypeArgumentList";
|
||||
SyntaxKind[SyntaxKind["TypeParameterList"] = 195] = "TypeParameterList";
|
||||
SyntaxKind[SyntaxKind["HeritageClause"] = 196] = "HeritageClause";
|
||||
SyntaxKind[SyntaxKind["EqualsValueClause"] = 197] = "EqualsValueClause";
|
||||
SyntaxKind[SyntaxKind["CaseSwitchClause"] = 198] = "CaseSwitchClause";
|
||||
SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 199] = "DefaultSwitchClause";
|
||||
SyntaxKind[SyntaxKind["ElseClause"] = 200] = "ElseClause";
|
||||
SyntaxKind[SyntaxKind["CatchClause"] = 201] = "CatchClause";
|
||||
SyntaxKind[SyntaxKind["FinallyClause"] = 202] = "FinallyClause";
|
||||
SyntaxKind[SyntaxKind["TemplateClause"] = 203] = "TemplateClause";
|
||||
SyntaxKind[SyntaxKind["TypeParameter"] = 204] = "TypeParameter";
|
||||
SyntaxKind[SyntaxKind["Constraint"] = 205] = "Constraint";
|
||||
SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 206] = "SimplePropertyAssignment";
|
||||
SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 207] = "FunctionPropertyAssignment";
|
||||
SyntaxKind[SyntaxKind["Parameter"] = 208] = "Parameter";
|
||||
SyntaxKind[SyntaxKind["EnumElement"] = 209] = "EnumElement";
|
||||
SyntaxKind[SyntaxKind["TypeAnnotation"] = 210] = "TypeAnnotation";
|
||||
SyntaxKind[SyntaxKind["ComputedPropertyName"] = 211] = "ComputedPropertyName";
|
||||
SyntaxKind[SyntaxKind["ExternalModuleReference"] = 212] = "ExternalModuleReference";
|
||||
SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 213] = "ModuleNameModuleReference";
|
||||
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["ComputedPropertyName"] = 212] = "ComputedPropertyName";
|
||||
SyntaxKind[SyntaxKind["ExternalModuleReference"] = 213] = "ExternalModuleReference";
|
||||
SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 214] = "ModuleNameModuleReference";
|
||||
SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword";
|
||||
SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword";
|
||||
SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword";
|
||||
@ -910,9 +911,9 @@ var definitions = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IModuleReferenceSyntax'],
|
||||
children: [
|
||||
{ name: 'requireKeyword', isToken: true, tokenKinds: ['RequireKeyword'], excludeFromAST: true },
|
||||
{ name: 'requireKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'openParenToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'stringLiteral', isToken: true, tokenKinds: ['StringLiteral'] },
|
||||
{ name: 'stringLiteral', isToken: true },
|
||||
{ name: 'closeParenToken', isToken: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@ -933,7 +934,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'importKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'equalsToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'moduleReference', type: 'IModuleReferenceSyntax' },
|
||||
{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
@ -947,7 +948,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'exportKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'equalsToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@ -959,7 +960,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'classKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'typeParameterList', type: 'TypeParameterListSyntax', isOptional: true },
|
||||
{ name: 'heritageClauses', isList: true, elementType: 'HeritageClauseSyntax' },
|
||||
{ name: 'openBraceToken', isToken: true, excludeFromAST: true },
|
||||
@ -975,7 +976,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'interfaceKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'typeParameterList', type: 'TypeParameterListSyntax', isOptional: true },
|
||||
{ name: 'heritageClauses', isList: true, elementType: 'HeritageClauseSyntax' },
|
||||
{ name: 'body', type: 'ObjectTypeSyntax' }
|
||||
@ -1012,7 +1013,8 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken', isTypeScriptSpecific: true },
|
||||
{ name: 'functionKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
{ name: 'body', type: 'BlockSyntax | ISyntaxToken', isOptional: true }
|
||||
]
|
||||
@ -1116,7 +1118,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'left', type: 'INameSyntax' },
|
||||
{ name: 'dotToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'right', isToken: true, tokenKinds: ['IdentifierName'] }
|
||||
{ name: 'right', isToken: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
@ -1255,7 +1257,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'dotDotDotToken', isToken: true, isOptional: true, isTypeScriptSpecific: true },
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'questionToken', isToken: true, isOptional: true, isTypeScriptSpecific: true },
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecific: true },
|
||||
{ name: 'equalsValueClause', type: 'EqualsValueClauseSyntax', isOptional: true, isTypeScriptSpecific: true }
|
||||
@ -1268,7 +1270,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'expression', type: 'ILeftHandSideExpressionSyntax' },
|
||||
{ name: 'dotToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'name', isToken: true, tokenKinds: ['IdentifierName'] }
|
||||
{ name: 'name', isToken: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1434,7 +1436,7 @@ var definitions = [
|
||||
name: 'TypeParameterSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
children: [
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'constraint', type: 'ConstraintSyntax', isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@ -1496,6 +1498,7 @@ var definitions = [
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
{ name: 'body', type: 'BlockSyntax | ISyntaxToken', isOptional: true }
|
||||
@ -1620,7 +1623,7 @@ var definitions = [
|
||||
interfaces: ['IStatementSyntax'],
|
||||
children: [
|
||||
{ name: 'breakKeyword', isToken: true },
|
||||
{ name: 'identifier', isToken: true, isOptional: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true, isOptional: true },
|
||||
{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
]
|
||||
},
|
||||
@ -1630,7 +1633,7 @@ var definitions = [
|
||||
interfaces: ['IStatementSyntax'],
|
||||
children: [
|
||||
{ name: 'continueKeyword', isToken: true },
|
||||
{ name: 'identifier', isToken: true, isOptional: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true, isOptional: true },
|
||||
{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
]
|
||||
},
|
||||
@ -1642,9 +1645,9 @@ var definitions = [
|
||||
{ name: 'forKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'openParenToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'initializer', type: 'VariableDeclarationSyntax | IExpressionSyntax', isOptional: true },
|
||||
{ name: 'firstSemicolonToken', isToken: true, tokenKinds: ['SemicolonToken'], excludeFromAST: true },
|
||||
{ name: 'firstSemicolonToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'condition', type: 'IExpressionSyntax', isOptional: true },
|
||||
{ name: 'secondSemicolonToken', isToken: true, tokenKinds: ['SemicolonToken'], excludeFromAST: true },
|
||||
{ name: 'secondSemicolonToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'incrementor', type: 'IExpressionSyntax', isOptional: true },
|
||||
{ name: 'closeParenToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'statement', type: 'IStatementSyntax' }
|
||||
@ -1695,7 +1698,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
{ name: 'enumKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'openBraceToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'enumElements', isSeparatedList: true, elementType: 'EnumElementSyntax' },
|
||||
{ name: 'closeBraceToken', isToken: true, excludeFromAST: true }
|
||||
@ -1757,6 +1760,7 @@ var definitions = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
{ name: 'block', type: 'BlockSyntax' }
|
||||
@ -1768,7 +1772,8 @@ var definitions = [
|
||||
interfaces: ['IPrimaryExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'functionKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, isOptional: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'identifier', isToken: true, isOptional: true },
|
||||
{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
{ name: 'block', type: 'BlockSyntax' }
|
||||
]
|
||||
@ -1798,7 +1803,7 @@ var definitions = [
|
||||
children: [
|
||||
{ name: 'catchKeyword', isToken: true, excludeFromAST: true },
|
||||
{ name: 'openParenToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecified: true },
|
||||
{ name: 'closeParenToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'block', type: 'BlockSyntax' }
|
||||
@ -1817,7 +1822,7 @@ var definitions = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IStatementSyntax'],
|
||||
children: [
|
||||
{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
{ name: 'identifier', isToken: true },
|
||||
{ name: 'colonToken', isToken: true, excludeFromAST: true },
|
||||
{ name: 'statement', type: 'IStatementSyntax' }
|
||||
]
|
||||
@ -1863,6 +1868,16 @@ var definitions = [
|
||||
{ name: 'expression', type: 'IUnaryExpressionSyntax' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'YieldExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'yieldKeyword', isToken: true },
|
||||
{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
{ name: 'expression', type: 'IExpressionSyntax', isOptional: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'DebuggerStatementSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
///<reference path='references.ts' />
|
||||
|
||||
module TypeScript {
|
||||
export enum SyntaxConstants {
|
||||
export enum SyntaxNodeConstants {
|
||||
None = 0,
|
||||
|
||||
// Masks that we use to place information about a node into a single int. The first bit tells
|
||||
@ -15,13 +15,15 @@ module TypeScript {
|
||||
// only be used by the incremental parser if it is parsed in the same strict context as before.
|
||||
// last masks off the part of the int
|
||||
//
|
||||
// The width of the node is stored in the remainder of the int. This allows us up to 256MB
|
||||
// for a node by using all 28 bits. However, in the common case, we'll use less than 28 bits
|
||||
// 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.
|
||||
NodeDataComputed = 0x00000001, // 0000 0000 0000 0000 0000 0000 0000 0001
|
||||
NodeIncrementallyUnusableMask = 0x00000002, // 0000 0000 0000 0000 0000 0000 0000 0010
|
||||
NodeParsedInStrictModeMask = 0x00000004, // 0000 0000 0000 0000 0000 0000 0000 0100
|
||||
NodeParsedInDisallowInMask = 0x00000008, // 0000 0000 0000 0000 0000 0000 0000 1000
|
||||
NodeFullWidthShift = 4, // 1111 1111 1111 1111 1111 1111 1111 0000
|
||||
DataComputed = 0x00000001, // 0000 0000 0000 0000 0000 0000 0000 0001
|
||||
IncrementallyUnusableMask = 0x00000002, // 0000 0000 0000 0000 0000 0000 0000 0010
|
||||
ParsedInStrictModeContext = 0x00000004, // 0000 0000 0000 0000 0000 0000 0000 0100
|
||||
ParsedInDisallowInContext = 0x00000008, // 0000 0000 0000 0000 0000 0000 0000 1000
|
||||
ParsedInYieldContext = 0x00000010, // 0000 0000 0000 0000 0000 0000 0001 0000
|
||||
ParsedInGeneratorParameterContext = 0x00000020, // 0000 0000 0000 0000 0000 0000 0010 0000
|
||||
FullWidthShift = 1 << 6, // 1111 1111 1111 1111 1111 1111 1100 0000
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1018,6 +1018,12 @@ module TypeScript.PrettyPrinter {
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitYieldExpression(node: YieldExpressionSyntax): void {
|
||||
this.appendToken(node.yieldKeyword);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitDebuggerStatement(node: DebuggerStatementSyntax): void {
|
||||
this.appendToken(node.debuggerKeyword);
|
||||
this.appendToken(node.semicolonToken);
|
||||
|
||||
@ -17,22 +17,40 @@ module TypeScript {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function parsedInStrictMode(node: ISyntaxNode): boolean {
|
||||
export function parsedInStrictModeContext(node: ISyntaxNode): boolean {
|
||||
var info = node.__data;
|
||||
if (info === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (info & SyntaxConstants.NodeParsedInStrictModeMask) !== 0;
|
||||
return (info & SyntaxNodeConstants.ParsedInStrictModeContext) !== 0;
|
||||
}
|
||||
|
||||
export function parsedInDisallowInMode(node: ISyntaxNode): boolean {
|
||||
export function parsedInDisallowInContext(node: ISyntaxNode): boolean {
|
||||
var info = node.__data;
|
||||
if (info === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (info & SyntaxConstants.NodeParsedInDisallowInMask) !== 0;
|
||||
return (info & SyntaxNodeConstants.ParsedInDisallowInContext) !== 0;
|
||||
}
|
||||
|
||||
export function parsedInYieldContext(node: ISyntaxNode): boolean {
|
||||
var info = node.__data;
|
||||
if (info === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (info & SyntaxNodeConstants.ParsedInYieldContext) !== 0;
|
||||
}
|
||||
|
||||
export function parsedInGeneratorParameterContext(node: ISyntaxNode): boolean {
|
||||
var info = node.__data;
|
||||
if (info === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (info & SyntaxNodeConstants.ParsedInGeneratorParameterContext) !== 0;
|
||||
}
|
||||
|
||||
export function previousToken(token: ISyntaxToken): ISyntaxToken {
|
||||
@ -266,7 +284,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
var info = data(element);
|
||||
return info >>> SyntaxConstants.NodeFullWidthShift;
|
||||
return (info / SyntaxNodeConstants.FullWidthShift) | 0;
|
||||
}
|
||||
|
||||
export function isIncrementallyUnusable(element: ISyntaxElement): boolean {
|
||||
@ -274,7 +292,7 @@ module TypeScript {
|
||||
return (<ISyntaxToken>element).isIncrementallyUnusable();
|
||||
}
|
||||
|
||||
return (data(element) & SyntaxConstants.NodeIncrementallyUnusableMask) !== 0;
|
||||
return (data(element) & SyntaxNodeConstants.IncrementallyUnusableMask) !== 0;
|
||||
}
|
||||
|
||||
function data(element: ISyntaxElement): number {
|
||||
@ -288,7 +306,7 @@ module TypeScript {
|
||||
info = 0;
|
||||
}
|
||||
|
||||
if ((info & SyntaxConstants.NodeDataComputed) === 0) {
|
||||
if ((info & SyntaxNodeConstants.DataComputed) === 0) {
|
||||
info |= computeData(element);
|
||||
dataElement.__data = info;
|
||||
}
|
||||
@ -297,9 +315,9 @@ module TypeScript {
|
||||
}
|
||||
|
||||
function combineData(fullWidth: number, isIncrementallyUnusable: boolean) {
|
||||
return (fullWidth << SyntaxConstants.NodeFullWidthShift)
|
||||
| (isIncrementallyUnusable ? SyntaxConstants.NodeIncrementallyUnusableMask : 0)
|
||||
| SyntaxConstants.NodeDataComputed;
|
||||
return (fullWidth * SyntaxNodeConstants.FullWidthShift) +
|
||||
(isIncrementallyUnusable ? SyntaxNodeConstants.IncrementallyUnusableMask : 0) +
|
||||
SyntaxNodeConstants.DataComputed;
|
||||
}
|
||||
|
||||
function listComputeData(list: ISyntaxNodeOrToken[]): number {
|
||||
|
||||
@ -23,7 +23,6 @@ interface IMemberDefinition {
|
||||
isSeparatedList?: boolean;
|
||||
requiresAtLeastOneItem?: boolean;
|
||||
isOptional?: boolean;
|
||||
tokenKinds?: string[];
|
||||
isTypeScriptSpecific: boolean;
|
||||
elementType?: string;
|
||||
}
|
||||
@ -56,9 +55,9 @@ var definitions:ITypeDefinition[] = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IModuleReferenceSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'requireKeyword', isToken: true, tokenKinds: ['RequireKeyword'], excludeFromAST: true },
|
||||
<any>{ name: 'requireKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'openParenToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'stringLiteral', isToken: true, tokenKinds: ['StringLiteral'] },
|
||||
<any>{ name: 'stringLiteral', isToken: true },
|
||||
<any>{ name: 'closeParenToken', isToken: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@ -79,7 +78,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'importKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'equalsToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'moduleReference', type: 'IModuleReferenceSyntax' },
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
@ -93,7 +92,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'exportKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'equalsToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@ -105,7 +104,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'classKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'typeParameterList', type: 'TypeParameterListSyntax', isOptional: true },
|
||||
<any>{ name: 'heritageClauses', isList: true, elementType: 'HeritageClauseSyntax' },
|
||||
<any>{ name: 'openBraceToken', isToken: true, excludeFromAST: true },
|
||||
@ -121,7 +120,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'interfaceKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'typeParameterList', type: 'TypeParameterListSyntax', isOptional: true },
|
||||
<any>{ name: 'heritageClauses', isList: true, elementType: 'HeritageClauseSyntax' },
|
||||
<any>{ name: 'body', type: 'ObjectTypeSyntax' }
|
||||
@ -158,7 +157,8 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken', isTypeScriptSpecific: true },
|
||||
<any>{ name: 'functionKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
<any>{ name: 'body', type: 'BlockSyntax | ISyntaxToken', isOptional: true }
|
||||
]
|
||||
@ -262,7 +262,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'left', type: 'INameSyntax' },
|
||||
<any>{ name: 'dotToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'right', isToken: true, tokenKinds:['IdentifierName'] }
|
||||
<any>{ name: 'right', isToken: true }
|
||||
],
|
||||
// Qualified names only show up in Types, which are TypeScript specific. Note that a dotted
|
||||
// expression (like A.B.Foo()) is a MemberAccessExpression, not a QualifiedName.
|
||||
@ -403,7 +403,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'dotDotDotToken', isToken: true, isOptional: true, isTypeScriptSpecific: true },
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'questionToken', isToken: true, isOptional: true, isTypeScriptSpecific: true },
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecific: true },
|
||||
<any>{ name: 'equalsValueClause', type: 'EqualsValueClauseSyntax', isOptional: true, isTypeScriptSpecific: true }
|
||||
@ -416,7 +416,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'expression', type: 'ILeftHandSideExpressionSyntax' },
|
||||
<any>{ name: 'dotToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'name', isToken: true, tokenKinds: ['IdentifierName'] }
|
||||
<any>{ name: 'name', isToken: true }
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
@ -582,7 +582,7 @@ var definitions:ITypeDefinition[] = [
|
||||
name: 'TypeParameterSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
children: [
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'constraint', type: 'ConstraintSyntax', isOptional: true }
|
||||
],
|
||||
isTypeScriptSpecific: true
|
||||
@ -645,6 +645,7 @@ var definitions:ITypeDefinition[] = [
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
<any>{ name: 'body', type: 'BlockSyntax | ISyntaxToken', isOptional: true }
|
||||
@ -769,7 +770,7 @@ var definitions:ITypeDefinition[] = [
|
||||
interfaces: ['IStatementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'breakKeyword', isToken: true },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true },
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
]
|
||||
},
|
||||
@ -779,7 +780,7 @@ var definitions:ITypeDefinition[] = [
|
||||
interfaces: ['IStatementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'continueKeyword', isToken: true },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true },
|
||||
<any>{ name: 'semicolonToken', isToken: true, isOptional: true, excludeFromAST: true }
|
||||
]
|
||||
},
|
||||
@ -791,9 +792,9 @@ var definitions:ITypeDefinition[] = [
|
||||
<any>{ name: 'forKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'openParenToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'initializer', type: 'VariableDeclarationSyntax | IExpressionSyntax', isOptional: true },
|
||||
<any>{ name: 'firstSemicolonToken', isToken: true, tokenKinds: ['SemicolonToken'], excludeFromAST: true },
|
||||
<any>{ name: 'firstSemicolonToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'condition', type: 'IExpressionSyntax', isOptional: true },
|
||||
<any>{ name: 'secondSemicolonToken', isToken: true, tokenKinds: ['SemicolonToken'], excludeFromAST: true },
|
||||
<any>{ name: 'secondSemicolonToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'incrementor', type: 'IExpressionSyntax', isOptional: true },
|
||||
<any>{ name: 'closeParenToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'statement', type: 'IStatementSyntax' }
|
||||
@ -844,7 +845,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
|
||||
<any>{ name: 'enumKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'openBraceToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'enumElements', isSeparatedList: true, elementType: 'EnumElementSyntax' },
|
||||
<any>{ name: 'closeBraceToken', isToken: true, excludeFromAST: true }
|
||||
@ -906,6 +907,7 @@ var definitions:ITypeDefinition[] = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
|
||||
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
<any>{ name: 'block', type: 'BlockSyntax' }
|
||||
@ -917,7 +919,8 @@ var definitions:ITypeDefinition[] = [
|
||||
interfaces: ['IPrimaryExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'functionKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'identifier', isToken: true, isOptional: true },
|
||||
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
|
||||
<any>{ name: 'block', type: 'BlockSyntax' }]
|
||||
},
|
||||
@ -944,7 +947,7 @@ var definitions:ITypeDefinition[] = [
|
||||
children: [
|
||||
<any>{ name: 'catchKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'openParenToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'typeAnnotation', type: 'TypeAnnotationSyntax', isOptional: true, isTypeScriptSpecified: true },
|
||||
<any>{ name: 'closeParenToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'block', type: 'BlockSyntax' }]
|
||||
@ -961,7 +964,7 @@ var definitions:ITypeDefinition[] = [
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IStatementSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'identifier', isToken: true, tokenKinds: ['IdentifierName'] },
|
||||
<any>{ name: 'identifier', isToken: true },
|
||||
<any>{ name: 'colonToken', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'statement', type: 'IStatementSyntax' }]
|
||||
},
|
||||
@ -1002,6 +1005,15 @@ var definitions:ITypeDefinition[] = [
|
||||
<any>{ name: 'voidKeyword', isToken: true, excludeFromAST: true },
|
||||
<any>{ name: 'expression', type: 'IUnaryExpressionSyntax' }]
|
||||
},
|
||||
<any>{
|
||||
name: 'YieldExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'yieldKeyword', isToken: true },
|
||||
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
|
||||
<any>{ name: 'expression', type: 'IExpressionSyntax', isOptional: true }]
|
||||
},
|
||||
<any>{
|
||||
name: 'DebuggerStatementSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
|
||||
@ -92,11 +92,12 @@ module TypeScript {
|
||||
export interface FunctionDeclarationSyntax extends ISyntaxNode, IStatementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
functionKeyword: ISyntaxToken;
|
||||
asterixToken: ISyntaxToken;
|
||||
identifier: ISyntaxToken;
|
||||
callSignature: CallSignatureSyntax;
|
||||
body: BlockSyntax | ISyntaxToken;
|
||||
}
|
||||
export interface FunctionDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken): FunctionDeclarationSyntax }
|
||||
export interface FunctionDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken): FunctionDeclarationSyntax }
|
||||
|
||||
export interface ModuleDeclarationSyntax extends ISyntaxNode, IModuleElementSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
@ -150,11 +151,12 @@ module TypeScript {
|
||||
|
||||
export interface MemberFunctionDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
asterixToken: ISyntaxToken;
|
||||
propertyName: IPropertyNameSyntax;
|
||||
callSignature: CallSignatureSyntax;
|
||||
body: BlockSyntax | ISyntaxToken;
|
||||
}
|
||||
export interface MemberFunctionDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken): MemberFunctionDeclarationSyntax }
|
||||
export interface MemberFunctionDeclarationConstructor { new (data: number, modifiers: ISyntaxToken[], asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken): MemberFunctionDeclarationSyntax }
|
||||
|
||||
export interface MemberVariableDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
@ -498,11 +500,12 @@ module TypeScript {
|
||||
|
||||
export interface FunctionExpressionSyntax extends ISyntaxNode, IPrimaryExpressionSyntax {
|
||||
functionKeyword: ISyntaxToken;
|
||||
asterixToken: ISyntaxToken;
|
||||
identifier: ISyntaxToken;
|
||||
callSignature: CallSignatureSyntax;
|
||||
block: BlockSyntax;
|
||||
}
|
||||
export interface FunctionExpressionConstructor { new (data: number, functionKeyword: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, block: BlockSyntax): FunctionExpressionSyntax }
|
||||
export interface FunctionExpressionConstructor { new (data: number, functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, block: BlockSyntax): FunctionExpressionSyntax }
|
||||
|
||||
export interface OmittedExpressionSyntax extends ISyntaxNode, IExpressionSyntax {
|
||||
}
|
||||
@ -520,6 +523,13 @@ module TypeScript {
|
||||
}
|
||||
export interface TemplateAccessExpressionConstructor { new (data: number, expression: ILeftHandSideExpressionSyntax, templateExpression: IPrimaryExpressionSyntax): TemplateAccessExpressionSyntax }
|
||||
|
||||
export interface YieldExpressionSyntax extends ISyntaxNode, IExpressionSyntax {
|
||||
yieldKeyword: ISyntaxToken;
|
||||
asterixToken: ISyntaxToken;
|
||||
expression: IExpressionSyntax;
|
||||
}
|
||||
export interface YieldExpressionConstructor { new (data: number, yieldKeyword: ISyntaxToken, asterixToken: ISyntaxToken, expression: IExpressionSyntax): YieldExpressionSyntax }
|
||||
|
||||
export interface VariableDeclarationSyntax extends ISyntaxNode {
|
||||
varKeyword: ISyntaxToken;
|
||||
variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>;
|
||||
@ -637,11 +647,12 @@ module TypeScript {
|
||||
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;
|
||||
block: BlockSyntax;
|
||||
}
|
||||
export interface FunctionPropertyAssignmentConstructor { new (data: number, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, block: BlockSyntax): FunctionPropertyAssignmentSyntax }
|
||||
export interface FunctionPropertyAssignmentConstructor { new (data: number, asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, block: BlockSyntax): FunctionPropertyAssignmentSyntax }
|
||||
|
||||
export interface ParameterSyntax extends ISyntaxNode {
|
||||
dotDotDotToken: ISyntaxToken;
|
||||
|
||||
@ -234,6 +234,7 @@ module TypeScript {
|
||||
OmittedExpression,
|
||||
TemplateExpression,
|
||||
TemplateAccessExpression,
|
||||
YieldExpression,
|
||||
|
||||
// Variable declarations
|
||||
VariableDeclaration,
|
||||
|
||||
@ -238,28 +238,31 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var FunctionDeclarationSyntax: FunctionDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken) {
|
||||
export var FunctionDeclarationSyntax: FunctionDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.functionKeyword = functionKeyword,
|
||||
this.asterixToken = asterixToken,
|
||||
this.identifier = identifier,
|
||||
this.callSignature = callSignature,
|
||||
this.body = body,
|
||||
modifiers.parent = this,
|
||||
functionKeyword.parent = this,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
identifier.parent = this,
|
||||
callSignature.parent = this,
|
||||
body && (body.parent = this);
|
||||
};
|
||||
FunctionDeclarationSyntax.prototype.kind = SyntaxKind.FunctionDeclaration;
|
||||
FunctionDeclarationSyntax.prototype.childCount = 5;
|
||||
FunctionDeclarationSyntax.prototype.childCount = 6;
|
||||
FunctionDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.functionKeyword;
|
||||
case 2: return this.identifier;
|
||||
case 3: return this.callSignature;
|
||||
case 4: return this.body;
|
||||
case 2: return this.asterixToken;
|
||||
case 3: return this.identifier;
|
||||
case 4: return this.callSignature;
|
||||
case 5: return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,25 +406,28 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var MemberFunctionDeclarationSyntax: MemberFunctionDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken) {
|
||||
export var MemberFunctionDeclarationSyntax: MemberFunctionDeclarationConstructor = <any>function(data: number, modifiers: ISyntaxToken[], asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, body: BlockSyntax | ISyntaxToken) {
|
||||
if (data) { this.__data = data; }
|
||||
this.modifiers = modifiers,
|
||||
this.asterixToken = asterixToken,
|
||||
this.propertyName = propertyName,
|
||||
this.callSignature = callSignature,
|
||||
this.body = body,
|
||||
modifiers.parent = this,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
propertyName.parent = this,
|
||||
callSignature.parent = this,
|
||||
body && (body.parent = this);
|
||||
};
|
||||
MemberFunctionDeclarationSyntax.prototype.kind = SyntaxKind.MemberFunctionDeclaration;
|
||||
MemberFunctionDeclarationSyntax.prototype.childCount = 4;
|
||||
MemberFunctionDeclarationSyntax.prototype.childCount = 5;
|
||||
MemberFunctionDeclarationSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.modifiers;
|
||||
case 1: return this.propertyName;
|
||||
case 2: return this.callSignature;
|
||||
case 3: return this.body;
|
||||
case 1: return this.asterixToken;
|
||||
case 2: return this.propertyName;
|
||||
case 3: return this.callSignature;
|
||||
case 4: return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1355,25 +1361,28 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var FunctionExpressionSyntax: FunctionExpressionConstructor = <any>function(data: number, functionKeyword: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, block: BlockSyntax) {
|
||||
export var FunctionExpressionSyntax: FunctionExpressionConstructor = <any>function(data: number, functionKeyword: ISyntaxToken, asterixToken: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, block: BlockSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.functionKeyword = functionKeyword,
|
||||
this.asterixToken = asterixToken,
|
||||
this.identifier = identifier,
|
||||
this.callSignature = callSignature,
|
||||
this.block = block,
|
||||
functionKeyword.parent = this,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
identifier && (identifier.parent = this),
|
||||
callSignature.parent = this,
|
||||
block.parent = this;
|
||||
};
|
||||
FunctionExpressionSyntax.prototype.kind = SyntaxKind.FunctionExpression;
|
||||
FunctionExpressionSyntax.prototype.childCount = 4;
|
||||
FunctionExpressionSyntax.prototype.childCount = 5;
|
||||
FunctionExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.functionKeyword;
|
||||
case 1: return this.identifier;
|
||||
case 2: return this.callSignature;
|
||||
case 3: return this.block;
|
||||
case 1: return this.asterixToken;
|
||||
case 2: return this.identifier;
|
||||
case 3: return this.callSignature;
|
||||
case 4: return this.block;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1418,6 +1427,25 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var YieldExpressionSyntax: YieldExpressionConstructor = <any>function(data: number, yieldKeyword: ISyntaxToken, asterixToken: ISyntaxToken, expression: IExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.yieldKeyword = yieldKeyword,
|
||||
this.asterixToken = asterixToken,
|
||||
this.expression = expression,
|
||||
yieldKeyword.parent = this,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
expression && (expression.parent = this);
|
||||
};
|
||||
YieldExpressionSyntax.prototype.kind = SyntaxKind.YieldExpression;
|
||||
YieldExpressionSyntax.prototype.childCount = 3;
|
||||
YieldExpressionSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.yieldKeyword;
|
||||
case 1: return this.asterixToken;
|
||||
case 2: return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
export var VariableDeclarationSyntax: VariableDeclarationConstructor = <any>function(data: number, varKeyword: ISyntaxToken, variableDeclarators: ISeparatedSyntaxList<VariableDeclaratorSyntax>) {
|
||||
if (data) { this.__data = data; }
|
||||
this.varKeyword = varKeyword,
|
||||
@ -1732,22 +1760,25 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var FunctionPropertyAssignmentSyntax: FunctionPropertyAssignmentConstructor = <any>function(data: number, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, block: BlockSyntax) {
|
||||
export var FunctionPropertyAssignmentSyntax: FunctionPropertyAssignmentConstructor = <any>function(data: number, asterixToken: ISyntaxToken, propertyName: IPropertyNameSyntax, callSignature: CallSignatureSyntax, block: BlockSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.asterixToken = asterixToken,
|
||||
this.propertyName = propertyName,
|
||||
this.callSignature = callSignature,
|
||||
this.block = block,
|
||||
asterixToken && (asterixToken.parent = this),
|
||||
propertyName.parent = this,
|
||||
callSignature.parent = this,
|
||||
block.parent = this;
|
||||
};
|
||||
FunctionPropertyAssignmentSyntax.prototype.kind = SyntaxKind.FunctionPropertyAssignment;
|
||||
FunctionPropertyAssignmentSyntax.prototype.childCount = 3;
|
||||
FunctionPropertyAssignmentSyntax.prototype.childCount = 4;
|
||||
FunctionPropertyAssignmentSyntax.prototype.childAt = function(index: number): ISyntaxElement {
|
||||
switch (index) {
|
||||
case 0: return this.propertyName;
|
||||
case 1: return this.callSignature;
|
||||
case 2: return this.block;
|
||||
case 0: return this.asterixToken;
|
||||
case 1: return this.propertyName;
|
||||
case 2: return this.callSignature;
|
||||
case 3: return this.block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1297,7 +1297,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
private checkForWithInStrictMode(node: WithStatementSyntax): boolean {
|
||||
if (parsedInStrictMode(node)) {
|
||||
if (parsedInStrictModeContext(node)) {
|
||||
this.pushDiagnostic(firstToken(node), DiagnosticCode.with_statements_are_not_allowed_in_strict_mode);
|
||||
return true;
|
||||
}
|
||||
@ -1509,7 +1509,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitPrefixUnaryExpression(node: PrefixUnaryExpressionSyntax): void {
|
||||
if (parsedInStrictMode(node) && this.isPreIncrementOrDecrementExpression(node) && this.isEvalOrArguments(node.operand)) {
|
||||
if (parsedInStrictModeContext(node) && this.isPreIncrementOrDecrementExpression(node) && this.isEvalOrArguments(node.operand)) {
|
||||
this.pushDiagnostic(node.operatorToken, DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(node.operand)]);
|
||||
}
|
||||
|
||||
@ -1517,7 +1517,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitPostfixUnaryExpression(node: PostfixUnaryExpressionSyntax): void {
|
||||
if (parsedInStrictMode(node) && this.isEvalOrArguments(node.operand)) {
|
||||
if (parsedInStrictModeContext(node) && this.isEvalOrArguments(node.operand)) {
|
||||
this.pushDiagnostic(node.operatorToken, DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(node.operand)]);
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ module TypeScript {
|
||||
|
||||
private checkForDisallowedEvalOrArguments(node: ISyntaxNode, token: ISyntaxToken): boolean {
|
||||
if (token) {
|
||||
if (parsedInStrictMode(node) && this.isEvalOrArguments(token)) {
|
||||
if (parsedInStrictModeContext(node) && this.isEvalOrArguments(token)) {
|
||||
this.pushDiagnostic(token, DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(token)]);
|
||||
return true;
|
||||
}
|
||||
@ -1554,16 +1554,25 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitDeleteExpression(node: DeleteExpressionSyntax): void {
|
||||
if (parsedInStrictMode(node) && node.expression.kind === SyntaxKind.IdentifierName) {
|
||||
this.pushDiagnostic(firstToken(node), DiagnosticCode.delete_cannot_be_called_on_an_identifier_in_strict_mode);
|
||||
if (parsedInStrictModeContext(node) && node.expression.kind === SyntaxKind.IdentifierName) {
|
||||
this.pushDiagnostic(node.deleteKeyword, DiagnosticCode.delete_cannot_be_called_on_an_identifier_in_strict_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitDeleteExpression(node);
|
||||
}
|
||||
|
||||
public visitYieldExpression(node: YieldExpressionSyntax): void {
|
||||
if (!parsedInYieldContext(node)) {
|
||||
this.pushDiagnostic(node.yieldKeyword, DiagnosticCode.yield_expression_must_be_contained_within_a_generator_declaration);
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitYieldExpression(node);
|
||||
}
|
||||
|
||||
private checkIllegalAssignment(node: BinaryExpressionSyntax): boolean {
|
||||
if (parsedInStrictMode(node) && SyntaxFacts.isAssignmentOperatorToken(node.operatorToken.kind) && this.isEvalOrArguments(node.left)) {
|
||||
if (parsedInStrictModeContext(node) && SyntaxFacts.isAssignmentOperatorToken(node.operatorToken.kind) && this.isEvalOrArguments(node.left)) {
|
||||
this.pushDiagnostic(node.operatorToken, DiagnosticCode.Invalid_use_of_0_in_strict_mode, [this.getEvalOrArguments(node.left)]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ module TypeScript {
|
||||
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.VariableDeclaration: return visitor.visitVariableDeclaration(<VariableDeclarationSyntax>element);
|
||||
case SyntaxKind.VariableDeclarator: return visitor.visitVariableDeclarator(<VariableDeclaratorSyntax>element);
|
||||
case SyntaxKind.ArgumentList: return visitor.visitArgumentList(<ArgumentListSyntax>element);
|
||||
@ -170,6 +171,7 @@ module TypeScript {
|
||||
visitOmittedExpression(node: OmittedExpressionSyntax): any;
|
||||
visitTemplateExpression(node: TemplateExpressionSyntax): any;
|
||||
visitTemplateAccessExpression(node: TemplateAccessExpressionSyntax): any;
|
||||
visitYieldExpression(node: YieldExpressionSyntax): any;
|
||||
visitVariableDeclaration(node: VariableDeclarationSyntax): any;
|
||||
visitVariableDeclarator(node: VariableDeclaratorSyntax): any;
|
||||
visitArgumentList(node: ArgumentListSyntax): any;
|
||||
|
||||
@ -97,6 +97,7 @@ module TypeScript {
|
||||
public visitFunctionDeclaration(node: FunctionDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.functionKeyword);
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
this.visitToken(node.identifier);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.body);
|
||||
@ -149,6 +150,7 @@ module TypeScript {
|
||||
|
||||
public visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.body);
|
||||
@ -451,6 +453,7 @@ module TypeScript {
|
||||
|
||||
public visitFunctionExpression(node: FunctionExpressionSyntax): void {
|
||||
this.visitToken(node.functionKeyword);
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
this.visitOptionalToken(node.identifier);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
@ -469,6 +472,12 @@ module TypeScript {
|
||||
visitNodeOrToken(this, node.templateExpression);
|
||||
}
|
||||
|
||||
public visitYieldExpression(node: YieldExpressionSyntax): void {
|
||||
this.visitToken(node.yieldKeyword);
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
visitNodeOrToken(this, node.expression);
|
||||
}
|
||||
|
||||
public visitVariableDeclaration(node: VariableDeclarationSyntax): void {
|
||||
this.visitToken(node.varKeyword);
|
||||
this.visitList(node.variableDeclarators);
|
||||
@ -569,6 +578,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
public visitFunctionPropertyAssignment(node: FunctionPropertyAssignmentSyntax): void {
|
||||
this.visitOptionalToken(node.asterixToken);
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
visitNodeOrToken(this, node.callSignature);
|
||||
visitNodeOrToken(this, node.block);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user