mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
@@ -552,8 +552,8 @@ var TypeScript;
|
||||
SyntaxKind[SyntaxKind["EnumDeclaration"] = 140] = "EnumDeclaration";
|
||||
SyntaxKind[SyntaxKind["ImportDeclaration"] = 141] = "ImportDeclaration";
|
||||
SyntaxKind[SyntaxKind["ExportAssignment"] = 142] = "ExportAssignment";
|
||||
SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 143] = "MemberFunctionDeclaration";
|
||||
SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 144] = "MemberVariableDeclaration";
|
||||
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";
|
||||
@@ -587,7 +587,7 @@ var TypeScript;
|
||||
SyntaxKind[SyntaxKind["ConditionalExpression"] = 175] = "ConditionalExpression";
|
||||
SyntaxKind[SyntaxKind["BinaryExpression"] = 176] = "BinaryExpression";
|
||||
SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 177] = "PostfixUnaryExpression";
|
||||
SyntaxKind[SyntaxKind["MemberAccessExpression"] = 178] = "MemberAccessExpression";
|
||||
SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression";
|
||||
SyntaxKind[SyntaxKind["InvocationExpression"] = 179] = "InvocationExpression";
|
||||
SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 180] = "ArrayLiteralExpression";
|
||||
SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 181] = "ObjectLiteralExpression";
|
||||
@@ -1297,7 +1297,7 @@ var definitions = [
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'MemberAccessExpressionSyntax',
|
||||
name: 'PropertyAccessExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberExpressionSyntax', 'ICallExpressionSyntax'],
|
||||
children: [
|
||||
@@ -1530,7 +1530,7 @@ var definitions = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'MemberFunctionDeclarationSyntax',
|
||||
name: 'MethodDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax', 'IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
@@ -1568,7 +1568,7 @@ var definitions = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
{
|
||||
name: 'MemberVariableDeclarationSyntax',
|
||||
name: 'PropertyDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
children: [
|
||||
@@ -1900,7 +1900,7 @@ var definitions = [
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
{ name: 'awaitKeyword', isToken: true },
|
||||
{ name: 'expression', type: 'IExpressionSyntax', isOptional: true }
|
||||
{ name: 'expression', type: 'IUnaryExpressionSyntax', isOptional: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -993,24 +993,24 @@ module TypeScript.Parser {
|
||||
return tryParseName(allowIdentifierName) || eatIdentifierToken();
|
||||
}
|
||||
|
||||
function eatRightSideOfName(allowIdentifierNames: boolean): ISyntaxToken {
|
||||
function eatRightSideOfDot(allowIdentifierNames: boolean): ISyntaxToken {
|
||||
var _currentToken = currentToken();
|
||||
|
||||
// Technically a keyword is valid here as all keywords are identifier names.
|
||||
// However, often we'll encounter this in error situations when the keyword
|
||||
// is actually starting another valid construct.
|
||||
|
||||
//
|
||||
// So, we check for the following specific case:
|
||||
|
||||
//
|
||||
// name.
|
||||
// keyword identifierNameOrKeyword
|
||||
|
||||
//
|
||||
// Note: the newlines are important here. For example, if that above code
|
||||
// were rewritten into:
|
||||
|
||||
//
|
||||
// name.keyword
|
||||
// identifierNameOrKeyword
|
||||
|
||||
//
|
||||
// Then we would consider it valid. That's because ASI would take effect and
|
||||
// the code would be implicitly: "name.keyword; identifierNameOrKeyword".
|
||||
// In the first case though, ASI will not take effect because there is not a
|
||||
@@ -1041,7 +1041,7 @@ module TypeScript.Parser {
|
||||
|
||||
while (shouldContinue && currentToken().kind === SyntaxKind.DotToken) {
|
||||
var dotToken = consumeToken(currentToken());
|
||||
var identifierName = eatRightSideOfName(allowIdentifierNames);
|
||||
var identifierName = eatRightSideOfDot(allowIdentifierNames);
|
||||
|
||||
current = new QualifiedNameSyntax(contextFlags, current, dotToken, identifierName);
|
||||
shouldContinue = identifierName.fullWidth() > 0;
|
||||
@@ -1375,10 +1375,10 @@ module TypeScript.Parser {
|
||||
// if we have a call signature. If so, then this is a member function, otherwise
|
||||
// it's a member variable.
|
||||
if (asterixToken || isCallSignature(/*peekIndex:*/ 0)) {
|
||||
return parseMemberFunctionDeclaration(modifiers, asterixToken, propertyName);
|
||||
return parseMethodDeclaration(modifiers, asterixToken, propertyName);
|
||||
}
|
||||
else {
|
||||
return parseMemberVariableDeclaration(modifiers, propertyName);
|
||||
return parsePropertyDeclaration(modifiers, propertyName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1405,13 +1405,13 @@ module TypeScript.Parser {
|
||||
parseFunctionBody(/*isGenerator:*/ false, /*asyncContext:*/ false));
|
||||
}
|
||||
|
||||
function parseMemberFunctionDeclaration(modifiers: ISyntaxToken[], asteriskToken: ISyntaxToken, propertyName: IPropertyNameSyntax): MemberFunctionDeclarationSyntax {
|
||||
function parseMethodDeclaration(modifiers: ISyntaxToken[], asteriskToken: ISyntaxToken, propertyName: IPropertyNameSyntax): MethodDeclarationSyntax {
|
||||
// Note: if we see an arrow after the close paren, then try to parse out a function
|
||||
// block anyways. It's likely the user just though '=> expr' was legal anywhere a
|
||||
// block was legal.
|
||||
var asyncContext = containsAsync(modifiers);
|
||||
var isGenerator = asteriskToken !== undefined;
|
||||
return new MemberFunctionDeclarationSyntax(contextFlags,
|
||||
return new MethodDeclarationSyntax(contextFlags,
|
||||
modifiers,
|
||||
asteriskToken,
|
||||
propertyName,
|
||||
@@ -1429,8 +1429,8 @@ module TypeScript.Parser {
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseMemberVariableDeclaration(modifiers: ISyntaxToken[], propertyName: IPropertyNameSyntax): MemberVariableDeclarationSyntax {
|
||||
return new MemberVariableDeclarationSyntax(contextFlags,
|
||||
function parsePropertyDeclaration(modifiers: ISyntaxToken[], propertyName: IPropertyNameSyntax): PropertyDeclarationSyntax {
|
||||
return new PropertyDeclarationSyntax(contextFlags,
|
||||
modifiers,
|
||||
new VariableDeclaratorSyntax(contextFlags, propertyName,
|
||||
parseOptionalTypeAnnotation(/*allowStringLiteral:*/ false),
|
||||
@@ -2608,7 +2608,7 @@ module TypeScript.Parser {
|
||||
function parseAwaitExpression(awaitKeyword: ISyntaxToken): AwaitExpressionSyntax {
|
||||
return new AwaitExpressionSyntax(contextFlags,
|
||||
consumeToken(awaitKeyword),
|
||||
parseAssignmentExpressionOrHigher());
|
||||
parseUnaryExpressionOrHigher(currentToken()));
|
||||
}
|
||||
|
||||
function isYieldExpression(_currentToken: ISyntaxToken): boolean {
|
||||
@@ -2898,7 +2898,10 @@ module TypeScript.Parser {
|
||||
continue;
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
expression = new MemberAccessExpressionSyntax(contextFlags, expression, consumeToken(_currentToken), eatIdentifierNameToken());
|
||||
expression = new PropertyAccessExpressionSyntax(contextFlags,
|
||||
expression,
|
||||
consumeToken(_currentToken),
|
||||
eatRightSideOfDot(/*allowIdentifierNames:*/ true));
|
||||
continue;
|
||||
|
||||
case SyntaxKind.NoSubstitutionTemplateToken:
|
||||
@@ -2988,9 +2991,14 @@ module TypeScript.Parser {
|
||||
// If we have seen "super" it must be followed by '(' or '.'.
|
||||
// If it wasn't then just try to parse out a '.' and report an error.
|
||||
var currentTokenKind = currentToken().kind;
|
||||
return currentTokenKind === SyntaxKind.OpenParenToken || currentTokenKind === SyntaxKind.DotToken
|
||||
? expression
|
||||
: new MemberAccessExpressionSyntax(contextFlags, expression, eatToken(SyntaxKind.DotToken), eatIdentifierNameToken());
|
||||
if (currentTokenKind === SyntaxKind.OpenParenToken || currentTokenKind === SyntaxKind.DotToken) {
|
||||
return expression;
|
||||
}
|
||||
|
||||
return new PropertyAccessExpressionSyntax(contextFlags,
|
||||
expression,
|
||||
eatToken(SyntaxKind.DotToken),
|
||||
eatRightSideOfDot(/*allowIdentifierNames:*/ true));
|
||||
}
|
||||
|
||||
function parsePostfixExpressionOrHigher(_currentToken: ISyntaxToken): IPostfixExpressionSyntax {
|
||||
@@ -3664,7 +3672,7 @@ module TypeScript.Parser {
|
||||
var propertyName = parsePropertyName();
|
||||
|
||||
if (modifiers.length > 0 || asterixToken !== undefined || isCallSignature(/*peekIndex:*/ 0)) {
|
||||
return parseMemberFunctionDeclaration(modifiers, asterixToken, propertyName);
|
||||
return parseMethodDeclaration(modifiers, asterixToken, propertyName);
|
||||
}
|
||||
else {
|
||||
// PropertyName[?Yield] : AssignmentExpression[In, ?Yield]
|
||||
|
||||
@@ -535,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);
|
||||
@@ -693,7 +693,7 @@ module TypeScript.PrettyPrinter {
|
||||
this.appendBody(node.body);
|
||||
}
|
||||
|
||||
public visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): void {
|
||||
public visitMethodDeclaration(node: MethodDeclarationSyntax): void {
|
||||
this.appendSpaceList(node.modifiers);
|
||||
this.ensureSpace();
|
||||
visitNodeOrToken(this, node.propertyName);
|
||||
@@ -723,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);
|
||||
|
||||
@@ -436,7 +436,7 @@ var definitions:ITypeDefinition[] = [
|
||||
]
|
||||
},
|
||||
<any>{
|
||||
name: 'MemberAccessExpressionSyntax',
|
||||
name: 'PropertyAccessExpressionSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberExpressionSyntax', 'ICallExpressionSyntax'],
|
||||
children: [
|
||||
@@ -670,7 +670,7 @@ var definitions:ITypeDefinition[] = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'MemberFunctionDeclarationSyntax',
|
||||
name: 'MethodDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax', 'IPropertyAssignmentSyntax'],
|
||||
children: [
|
||||
@@ -708,7 +708,7 @@ var definitions:ITypeDefinition[] = [
|
||||
isTypeScriptSpecific: true
|
||||
},
|
||||
<any>{
|
||||
name: 'MemberVariableDeclarationSyntax',
|
||||
name: 'PropertyDeclarationSyntax',
|
||||
baseType: 'ISyntaxNode',
|
||||
interfaces: ['IMemberDeclarationSyntax'],
|
||||
children: [
|
||||
@@ -1029,7 +1029,7 @@ var definitions:ITypeDefinition[] = [
|
||||
interfaces: ['IUnaryExpressionSyntax'],
|
||||
children: [
|
||||
<any>{ name: 'awaitKeyword', isToken: true },
|
||||
<any>{ name: 'expression', type: 'IExpressionSyntax', isOptional: true }]
|
||||
<any>{ name: 'expression', type: 'IUnaryExpressionSyntax', isOptional: true }]
|
||||
},
|
||||
<any>{
|
||||
name: 'DebuggerStatementSyntax',
|
||||
|
||||
@@ -150,21 +150,21 @@ module TypeScript {
|
||||
}
|
||||
export interface ExportAssignmentConstructor { new (data: number, modifiers: ISyntaxToken[], exportKeyword: ISyntaxToken, equalsToken: ISyntaxToken, identifier: ISyntaxToken, semicolonToken: ISyntaxToken): ExportAssignmentSyntax }
|
||||
|
||||
export interface MemberFunctionDeclarationSyntax extends ISyntaxNode, IMemberDeclarationSyntax, IPropertyAssignmentSyntax {
|
||||
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[];
|
||||
@@ -426,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;
|
||||
@@ -534,9 +534,9 @@ module TypeScript {
|
||||
|
||||
export interface AwaitExpressionSyntax extends ISyntaxNode, IUnaryExpressionSyntax {
|
||||
awaitKeyword: ISyntaxToken;
|
||||
expression: IExpressionSyntax;
|
||||
expression: IUnaryExpressionSyntax;
|
||||
}
|
||||
export interface AwaitExpressionConstructor { new (data: number, awaitKeyword: ISyntaxToken, expression: IExpressionSyntax): AwaitExpressionSyntax }
|
||||
export interface AwaitExpressionConstructor { new (data: number, awaitKeyword: ISyntaxToken, expression: IUnaryExpressionSyntax): AwaitExpressionSyntax }
|
||||
|
||||
export interface VariableDeclarationSyntax extends ISyntaxNode {
|
||||
varConstOrLetKeyword: ISyntaxToken;
|
||||
|
||||
@@ -179,8 +179,8 @@ module TypeScript {
|
||||
ExportAssignment,
|
||||
|
||||
// ClassElements
|
||||
MemberFunctionDeclaration,
|
||||
MemberVariableDeclaration,
|
||||
MethodDeclaration,
|
||||
PropertyDeclaration,
|
||||
ConstructorDeclaration,
|
||||
|
||||
// ClassElement and PropertyAssignment
|
||||
@@ -222,7 +222,7 @@ module TypeScript {
|
||||
ConditionalExpression,
|
||||
BinaryExpression,
|
||||
PostfixUnaryExpression,
|
||||
MemberAccessExpression,
|
||||
PropertyAccessExpression,
|
||||
InvocationExpression,
|
||||
ArrayLiteralExpression,
|
||||
ObjectLiteralExpression,
|
||||
|
||||
@@ -409,7 +409,7 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -422,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;
|
||||
@@ -434,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,
|
||||
@@ -443,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;
|
||||
@@ -1167,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,
|
||||
@@ -1176,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;
|
||||
@@ -1454,7 +1454,7 @@ module TypeScript {
|
||||
}
|
||||
}
|
||||
|
||||
export var AwaitExpressionSyntax: AwaitExpressionConstructor = <any>function(data: number, awaitKeyword: ISyntaxToken, expression: IExpressionSyntax) {
|
||||
export var AwaitExpressionSyntax: AwaitExpressionConstructor = <any>function(data: number, awaitKeyword: ISyntaxToken, expression: IUnaryExpressionSyntax) {
|
||||
if (data) { this.__data = data; }
|
||||
this.awaitKeyword = awaitKeyword,
|
||||
this.expression = expression,
|
||||
|
||||
@@ -551,13 +551,13 @@ module TypeScript {
|
||||
return false;
|
||||
}
|
||||
|
||||
public visitMemberVariableDeclaration(node: MemberVariableDeclarationSyntax): void {
|
||||
public visitPropertyDeclaration(node: PropertyDeclarationSyntax): void {
|
||||
if (this.checkClassElementModifiers(node.modifiers) ||
|
||||
this.checkForDisallowedAsyncModifier(node.modifiers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitMemberVariableDeclaration(node);
|
||||
super.visitPropertyDeclaration(node);
|
||||
}
|
||||
|
||||
public visitMethodSignature(node: MethodSignatureSyntax): void {
|
||||
@@ -579,7 +579,7 @@ module TypeScript {
|
||||
super.visitPropertySignature(node);
|
||||
}
|
||||
|
||||
public visitMemberFunctionDeclaration(node: MemberFunctionDeclarationSyntax): void {
|
||||
public visitMethodDeclaration(node: MethodDeclarationSyntax): void {
|
||||
if (node.parent && node.parent.parent &&
|
||||
node.parent.kind === SyntaxKind.List && node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
|
||||
@@ -603,7 +603,7 @@ module TypeScript {
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitMemberFunctionDeclaration(node);
|
||||
super.visitMethodDeclaration(node);
|
||||
}
|
||||
|
||||
private checkForDisallowedObjectLiteralMethod(modifiers: ISyntaxToken[]): boolean {
|
||||
@@ -1556,7 +1556,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
private checkVariableDeclaratorIdentifier(node: VariableDeclaratorSyntax): boolean {
|
||||
if (node.parent.kind !== SyntaxKind.MemberVariableDeclaration) {
|
||||
if (node.parent.kind !== SyntaxKind.PropertyDeclaration) {
|
||||
Debug.assert(isToken(node.propertyName), "A normal variable declarator must always have a token for a name.");
|
||||
if (this.checkForDisallowedEvalOrArguments(node, <ISyntaxToken>node.propertyName)) {
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,7 @@ module TypeScript {
|
||||
case SyntaxKind.ParenthesizedArrowFunctionExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.ConstructorDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -44,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,11 +101,10 @@ module TypeScript {
|
||||
switch (element.kind) {
|
||||
case SyntaxKind.ConstructorDeclaration:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.MemberVariableDeclaration:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -227,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,8 +22,8 @@ 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.GetAccessor: return visitor.visitGetAccessor(<GetAccessorSyntax>element);
|
||||
case SyntaxKind.SetAccessor: return visitor.visitSetAccessor(<SetAccessorSyntax>element);
|
||||
@@ -57,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);
|
||||
@@ -122,8 +122,8 @@ 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;
|
||||
visitGetAccessor(node: GetAccessorSyntax): any;
|
||||
visitSetAccessor(node: SetAccessorSyntax): any;
|
||||
@@ -157,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;
|
||||
|
||||
@@ -149,7 +149,7 @@ module TypeScript {
|
||||
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);
|
||||
@@ -157,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);
|
||||
@@ -390,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);
|
||||
|
||||
Reference in New Issue
Block a user