aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-29 14:06:24 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-29 18:10:48 +0000
commit123f01df338972e2253ae2ab993027755695ceea (patch)
treeaa7adcea73e37f3c6753e91549ae6b5daf34bddb /tests
parent6a93ce86fcad0d51e5c49dd3109fb65ee38d714e (diff)
Fix TDZ check for references
So far we've not been doing the TDZ check for expressions such as x.name, a[x] and super[x] correctly. Fix this by adding a second boolean that states whether a tdz check for the subscript is required and use the first boolean to check the base of these references. Change-Id: I658cd5b69f001fbdc714f252914ad9749734f027 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 69b62c733c..99306d8d15 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -356,6 +356,7 @@ private slots:
void callPropertyOnUndefined();
void jumpStrictNotEqualUndefined();
void removeBindingsWithNoDependencies();
+ void temporaryDeadZone();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -8798,6 +8799,19 @@ void tst_qqmlecmascript::removeBindingsWithNoDependencies()
}
+void tst_qqmlecmascript::temporaryDeadZone()
+{
+ QJSEngine engine;
+ QJSValue v = engine.evaluate(QString::fromLatin1("a; let a;"));
+ QVERIFY(v.isError());
+ v = engine.evaluate(QString::fromLatin1("a.name; let a;"));
+ QVERIFY(v.isError());
+ v = engine.evaluate(QString::fromLatin1("var a = {}; a[b]; let b;"));
+ QVERIFY(v.isError());
+ v = engine.evaluate(QString::fromLatin1("class C { constructor() { super[x]; let x; } }; new C()"));
+ QVERIFY(v.isError());
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"