Move grammar checking: labelStatement
This commit is contained in:
parent
3903a65062
commit
ee1f19efca
2 changed files with 16 additions and 1 deletions
|
@ -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…
Reference in a new issue