aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-11-19 00:31:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-19 07:57:45 +0100
commitcac9989643d54b15ea0b8e53889336b429e4504d (patch)
tree35211bbb4829385c2c91d4296b2a9d4e5929030b /src/qml/compiler/qv4codegen.cpp
parentda31479ee237a40ed03bcaf1352f00d33d1f325c (diff)
Fix failing assertion when trying to assign to an id referenced QML object
References to id addressed QML objects are member expressions, which are unlike other member expressions by not being lvalues. Handle this correctly. Task-Number: QTBUG-34890 Change-Id: Ied6230edbc561128ad36bf0d1a1918185204deec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 68c46f5677..893abc9659 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -418,6 +418,7 @@ Codegen::Codegen(bool strict)
, _labelledStatement(0)
, _scopeAndFinally(0)
, _strictMode(strict)
+ , _fileNameIsUrl(false)
, hasError(false)
{
}
@@ -1182,7 +1183,7 @@ bool Codegen::visit(BinaryExpression *ast)
if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(left, ast->left->lastSourceLocation()))
return false;
V4IR::Expr* right = *expression(ast->right);
- if (! (left->asTemp() || left->asName() || left->asSubscript() || left->asMember())) {
+ if (!left->isLValue()) {
throwReferenceError(ast->operatorToken, QStringLiteral("left-hand side of assignment operator is not an lvalue"));
return false;
}
@@ -2850,7 +2851,7 @@ void Codegen::throwSyntaxError(const SourceLocation &loc, const QString &detail)
hasError = true;
QQmlError error;
- error.setUrl(QUrl::fromLocalFile(_module->fileName));
+ error.setUrl(_fileNameIsUrl ? QUrl(_module->fileName) : QUrl::fromLocalFile(_module->fileName));
error.setDescription(detail);
error.setLine(loc.startLine);
error.setColumn(loc.startColumn);
@@ -2864,7 +2865,7 @@ void Codegen::throwReferenceError(const SourceLocation &loc, const QString &deta
hasError = true;
QQmlError error;
- error.setUrl(QUrl::fromLocalFile(_module->fileName));
+ error.setUrl(_fileNameIsUrl ? QUrl(_module->fileName) : QUrl::fromLocalFile(_module->fileName));
error.setDescription(detail);
error.setLine(loc.startLine);
error.setColumn(loc.startColumn);