Some cleanup and renaming

This commit is contained in:
Jason Freeman 2015-06-09 17:12:12 -07:00
parent e4df03adcb
commit cc9bf13ffd
2 changed files with 6 additions and 7 deletions

View file

@ -11195,7 +11195,6 @@ module ts {
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral; let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) { if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(moduleName, node.kind === SyntaxKind.ExportDeclaration ? error(moduleName, node.kind === SyntaxKind.ExportDeclaration ?
// TODO: StatementFlags (clarify message)
Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false; return false;

View file

@ -3804,7 +3804,7 @@ module ts {
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
} }
function parseDeclarationFlags(): boolean { function isDeclaration(): boolean {
while (true) { while (true) {
switch (token) { switch (token) {
case SyntaxKind.VarKeyword: case SyntaxKind.VarKeyword:
@ -3873,8 +3873,8 @@ module ts {
} }
} }
function getDeclarationFlags(): boolean { function isStartOfDeclaration(): boolean {
return lookAhead(parseDeclarationFlags); return lookAhead(isDeclaration);
} }
function isStartOfStatement(): boolean { function isStartOfStatement(): boolean {
@ -3908,7 +3908,7 @@ module ts {
case SyntaxKind.ConstKeyword: case SyntaxKind.ConstKeyword:
case SyntaxKind.ExportKeyword: case SyntaxKind.ExportKeyword:
case SyntaxKind.ImportKeyword: case SyntaxKind.ImportKeyword:
return getDeclarationFlags(); return isStartOfDeclaration();
case SyntaxKind.DeclareKeyword: case SyntaxKind.DeclareKeyword:
case SyntaxKind.InterfaceKeyword: case SyntaxKind.InterfaceKeyword:
@ -3924,7 +3924,7 @@ module ts {
case SyntaxKind.StaticKeyword: case SyntaxKind.StaticKeyword:
// When these don't start a declaration, they may be the start of a class member if an identifier // When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement. // immediately follows. Otherwise they're an identifier in an expression statement.
return getDeclarationFlags() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
default: default:
return isStartOfExpression(); return isStartOfExpression();
@ -4003,7 +4003,7 @@ module ts {
case SyntaxKind.ProtectedKeyword: case SyntaxKind.ProtectedKeyword:
case SyntaxKind.PublicKeyword: case SyntaxKind.PublicKeyword:
case SyntaxKind.StaticKeyword: case SyntaxKind.StaticKeyword:
if (getDeclarationFlags()) { if (isStartOfDeclaration()) {
return parseDeclaration(); return parseDeclaration();
} }
break; break;