From: Lars Knoll Date: Fri, 14 Jun 2013 09:18:12 +0000 (+0200) Subject: Check for duplicated label statements as to 12.12 of the spec X-Git-Tag: upstream/5.2.1~669^2~218 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eeee3aabd133cdae7f08b356187d6867f6dc8b4b;p=platform%2Fupstream%2Fqtdeclarative.git Check for duplicated label statements as to 12.12 of the spec Change-Id: Ia2ccddef08a2b3dedd46c509a8693d52dc472982 Reviewed-by: Simon Hausmann --- diff --git a/src/qml/qml/v4/qv4codegen.cpp b/src/qml/qml/v4/qv4codegen.cpp index f5868b1..77c4610 100644 --- a/src/qml/qml/v4/qv4codegen.cpp +++ b/src/qml/qml/v4/qv4codegen.cpp @@ -2158,6 +2158,15 @@ bool Codegen::visit(IfStatement *ast) bool Codegen::visit(LabelledStatement *ast) { + // check that no outer loop contains the label + Loop *l = _loop; + while (l) { + if (l->labelledStatement->label == ast->label) { + QString error = QString(QStringLiteral("Label '%1' has already been declared")).arg(ast->label.toString()); + throwSyntaxError(ast->firstSourceLocation(), error); + } + l = l->parent; + } _labelledStatement = ast; if (AST::cast(ast->statement) ||