Allow modifiers on an Export Assignment node.
Conflicts: src/services/syntax/SyntaxGenerator.js.map
This commit is contained in:
parent
ac5d670d7c
commit
480020e1d6
|
@ -951,6 +951,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 },
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -821,6 +821,7 @@ module TypeScript.Parser {
|
|||
case SyntaxKind.InterfaceKeyword: return parseInterfaceDeclaration();
|
||||
case SyntaxKind.ClassKeyword: return parseClassDeclaration();
|
||||
case SyntaxKind.EnumKeyword: return parseEnumDeclaration();
|
||||
case SyntaxKind.ExportKeyword: return parseExportAssignment();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,7 +883,11 @@ module TypeScript.Parser {
|
|||
|
||||
function parseExportAssignment(): ExportAssignmentSyntax {
|
||||
return new ExportAssignmentSyntax(contextFlags,
|
||||
eatToken(SyntaxKind.ExportKeyword), eatToken(SyntaxKind.EqualsToken), eatIdentifierToken(), eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false));
|
||||
parseModifiers(),
|
||||
eatToken(SyntaxKind.ExportKeyword),
|
||||
eatToken(SyntaxKind.EqualsToken),
|
||||
eatIdentifierToken(),
|
||||
eatExplicitOrAutomaticSemicolon(/*allowWithoutNewline:*/ false));
|
||||
}
|
||||
|
||||
function parseModuleReference(): IModuleReferenceSyntax {
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -142,12 +142,13 @@ 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, IPropertyAssignmentSyntax {
|
||||
modifiers: ISyntaxToken[];
|
||||
|
|
|
@ -384,25 +384,28 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1054,6 +1054,15 @@ module TypeScript {
|
|||
return false;
|
||||
}
|
||||
|
||||
public visitExportAssignment(node: ExportAssignmentSyntax): void {
|
||||
if (node.modifiers.length > 0) {
|
||||
this.pushDiagnostic(node.modifiers[0], DiagnosticCode.Modifiers_cannot_appear_here);
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitExportAssignment(node);
|
||||
}
|
||||
|
||||
public visitExpressionBody(node: ExpressionBody): void {
|
||||
// These are always errors. So no need to ever recurse on them.
|
||||
this.pushDiagnostic(node.equalsGreaterThanToken, DiagnosticCode._0_expected, ["{"]);
|
||||
|
|
|
@ -142,6 +142,7 @@ module TypeScript {
|
|||
}
|
||||
|
||||
public visitExportAssignment(node: ExportAssignmentSyntax): void {
|
||||
this.visitList(node.modifiers);
|
||||
this.visitToken(node.exportKeyword);
|
||||
this.visitToken(node.equalsToken);
|
||||
this.visitToken(node.identifier);
|
||||
|
|
Loading…
Reference in a new issue