aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-17 17:21:11 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 14:26:56 +0200
commit9702c226edbb58aede140af91b13136b7cd810d8 (patch)
treee0aa5c7a6ceeb72070192d11355a997491a63707
parent975efc4030cabb41c109d5c848bd865cd50d4ae4 (diff)
[new compiler] Fix id parsing
id: foo; produces a statement on the right hand side that includes the semicolon. Strip it off - reduce expression statements similar to setBindingValue. Change-Id: I22a02ce364a309b4364476166402f8284e01ef98 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 04f2b9c8f2..1739d2c22b 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -782,12 +782,16 @@ bool QQmlCodeGenerator::setId(AST::Statement *value)
AST::SourceLocation loc = value->firstSourceLocation();
QStringRef str;
- if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(value))
+ AST::Node *node = value;
+ if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(node)) {
if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(stmt->expression))
str = lit->value;
+ else
+ node = stmt->expression;
+ }
if (str.isEmpty())
- str = asStringRef(value);
+ str = asStringRef(node);
if (str.isEmpty())
COMPILE_EXCEPTION(loc, tr( "Invalid empty ID"));