Merge branch 'master' into templates

Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/types.ts
	src/services/utilities.ts
This commit is contained in:
Daniel Rosenwasser
2014-10-28 19:06:07 -07:00
27 changed files with 4447 additions and 4149 deletions

View File

@@ -336,6 +336,9 @@ module ts {
children((<InterfaceDeclaration>node).typeParameters) ||
children((<InterfaceDeclaration>node).baseTypes) ||
children((<InterfaceDeclaration>node).members);
case SyntaxKind.TypeAliasDeclaration:
return child((<TypeAliasDeclaration>node).name) ||
child((<TypeAliasDeclaration>node).type);
case SyntaxKind.EnumDeclaration:
return child((<EnumDeclaration>node).name) ||
children((<EnumDeclaration>node).members);
@@ -572,6 +575,7 @@ module ts {
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
@@ -634,6 +638,7 @@ module ts {
return <ClassDeclaration>node;
case SyntaxKind.EnumDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
// early exit cases - declarations cannot be nested in classes
@@ -1108,7 +1113,6 @@ module ts {
return finishNode(node);
}
error(Diagnostics.Identifier_expected);
var node = <Identifier>createMissingNode();
node.text = "";
return node;
@@ -3265,6 +3269,7 @@ module ts {
case SyntaxKind.ClassKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.TypeKeyword:
// When followed by an identifier, these do not start a statement but might
// instead be following declarations
if (isDeclarationStart()) {
@@ -3842,7 +3847,25 @@ module ts {
}
return finishNode(node);
}
function parseTypeAliasDeclaration(pos: number, flags: NodeFlags): TypeAliasDeclaration {
var node = <TypeAliasDeclaration>createNode(SyntaxKind.TypeAliasDeclaration, pos);
node.flags = flags;
parseExpected(SyntaxKind.TypeKeyword);
node.name = parseIdentifier();
parseExpected(SyntaxKind.EqualsToken);
node.type = parseType();
parseSemicolon();
var n = node.type;
while (n.kind === SyntaxKind.ParenType) {
n = (<ParenTypeNode>n).type;
}
if (n.kind === SyntaxKind.TypeLiteral && (n.pos !== (<TypeLiteralNode>n).members.pos || n.end !== (<TypeLiteralNode>n).members.end)) {
grammarErrorOnNode(node.type, Diagnostics.Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead);
}
return finishNode(node);
}
function parseAndCheckEnumDeclaration(pos: number, flags: NodeFlags): EnumDeclaration {
function isIntegerLiteral(expression: Expression): boolean {
function isInteger(literalExpression: LiteralExpression): boolean {
@@ -4004,6 +4027,7 @@ module ts {
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.ImportKeyword:
case SyntaxKind.TypeKeyword:
// Not true keywords so ensure an identifier follows
return lookAhead(() => nextToken() >= SyntaxKind.Identifier);
case SyntaxKind.ModuleKeyword:
@@ -4061,6 +4085,9 @@ module ts {
case SyntaxKind.InterfaceKeyword:
result = parseInterfaceDeclaration(pos, flags);
break;
case SyntaxKind.TypeKeyword:
result = parseTypeAliasDeclaration(pos, flags);
break;
case SyntaxKind.EnumKeyword:
result = parseAndCheckEnumDeclaration(pos, flags);
break;