mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 21:37:41 -06:00
Move grammar checking: labelStatement
This commit is contained in:
parent
3903a65062
commit
ee1f19efca
@ -8131,6 +8131,21 @@ module ts {
|
||||
}
|
||||
|
||||
function checkLabeledStatement(node: LabeledStatement) {
|
||||
// ensure that label is unique
|
||||
// Grammar checking
|
||||
var current = node.parent;
|
||||
while (current) {
|
||||
if (isAnyFunction(current)) {
|
||||
break;
|
||||
}
|
||||
if (current.kind === SyntaxKind.LabeledStatement && (<LabeledStatement>current).label.text === node.label.text) {
|
||||
var sourceFile = getSourceFileOfNode(node);
|
||||
grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceFile.text, node.label));
|
||||
break;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
|
||||
|
||||
@ -4651,7 +4651,7 @@ module ts {
|
||||
case SyntaxKind.GetAccessor: return checkGetAccessor(<MethodDeclaration>node);
|
||||
//case SyntaxKind.HeritageClause: return checkHeritageClause(<HeritageClause>node);
|
||||
//case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
|
||||
//case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
|
||||
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyAssignment>node);
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user