diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-02-21 14:53:58 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-02-22 11:17:39 +0000 |
commit | b6d1e97be274e67a47cce950ed4cf05518eebcc8 (patch) | |
tree | fd8a26ec1a382f695d91152a6411daefa4dc9ccd | |
parent | 8fdf466741f31bc9f33db7b5d09c2e282f0b6bbe (diff) |
Remove superfluous assert when traversing IR
When accessing/calling a property on an object, it is possible (and
perfectly fine) for that object to be a constant value. I.e. Undefined.
All code handling such a call do handle constants correctly.
Note: this is a 5.9 specific change, because 5.11 got rid of this code.
Task-number: QTBUG-66027
Change-Id: Ied9d0c9c8f8bf958f8634f7be196900b3ea64861
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/compiler/qv4isel_p.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index efcfb9bd77..753e8d9b8d 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -259,7 +259,6 @@ void IRDecoder::visitExp(IR::Exp *s) } else if (c->base->asTemp() || c->base->asArgLocal() || c->base->asConst()) { callValue(c->base, c->args, 0); } else if (Member *member = c->base->asMember()) { - Q_ASSERT(member->base->asTemp() || member->base->asArgLocal()); #ifndef V4_BOOTSTRAP Q_ASSERT(member->kind != IR::Member::MemberOfIdObjectsArray); if (member->kind == IR::Member::MemberOfQmlScopeObject || member->kind == IR::Member::MemberOfQmlContextObject) { diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 14447383c1..6318b12f9f 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -339,6 +339,7 @@ private slots: void singleBlockLoops(); void qtbug_60547(); void anotherNaN(); + void callPropertyOnUndefined(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -8281,6 +8282,18 @@ void tst_qqmlecmascript::anotherNaN() object->setProperty("prop", d); // don't crash } +void tst_qqmlecmascript::callPropertyOnUndefined() +{ + QJSEngine engine; + QJSValue v = engine.evaluate(QString::fromLatin1( + "function f() {\n" + " var base;\n" + " base.push(1);" + "}\n" + )); + QVERIFY(!v.isError()); // well, more importantly: this shouldn't fail on an assert. +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |