aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen_p.h
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 /src/qml/compiler/qv4codegen_p.h
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 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r--src/qml/compiler/qv4codegen_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index d780df394b..1fc3c2180b 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -294,12 +294,14 @@ public:
Reference r(baseRef.codegen, Member);
r.propertyBase = baseRef.asRValue();
r.propertyNameIndex = r.codegen->registerString(name);
+ r.requiresTDZCheck = baseRef.requiresTDZCheck;
return r;
}
static Reference fromSuperProperty(const Reference &property) {
Q_ASSERT(property.isStackSlot());
Reference r(property.codegen, SuperProperty);
r.property = property.stackSlot();
+ r.subscriptRequiresTDZCheck = property.requiresTDZCheck;
return r;
}
static Reference fromSubscript(const Reference &baseRef, const Reference &subscript) {
@@ -307,6 +309,8 @@ public:
Reference r(baseRef.codegen, Subscript);
r.elementBase = baseRef.stackSlot();
r.elementSubscript = subscript.asRValue();
+ r.requiresTDZCheck = baseRef.requiresTDZCheck;
+ r.subscriptRequiresTDZCheck = subscript.requiresTDZCheck;
return r;
}
static Reference fromConst(Codegen *cg, QV4::ReturnedValue constant) {
@@ -395,6 +399,7 @@ public:
bool isReadonly = false;
bool isReferenceToConst = false;
bool requiresTDZCheck = false;
+ bool subscriptRequiresTDZCheck = false;
bool stackSlotIsLocalOrArgument = false;
bool isVolatile = false;
bool global = false;