aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-11-11 18:03:36 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-11-15 08:32:27 +0100
commit1166ebf3e9493b0be7e72aaeb72362ec666bc8d6 (patch)
tree14bf43f238174239b0a4a1587d59fb8fa48d0992 /src/qml/compiler/qv4codegen_p.h
parent72462f6f96018c6cf8bc18194b74b43f43418c0a (diff)
QML: Require TDZ checks variables declared in case blocks
... and check the tdz only once on function calls. Task-number: QTBUG-108362 Change-Id: I534e2604fb68b3b9145b7b7dd003e988e9df17d0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r--src/qml/compiler/qv4codegen_p.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 85a68f5e85..16609c2fa1 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -330,6 +330,14 @@ public:
return theStackSlot;
}
+ void tdzCheck() const
+ {
+ if (isAccumulator())
+ tdzCheck(requiresTDZCheck, throwsReferenceError);
+ else if (isStackSlot())
+ tdzCheckStackSlot(stackSlot(), requiresTDZCheck, throwsReferenceError);
+ }
+
union {
Moth::StackSlot theStackSlot;
QV4::ReturnedValue constant;
@@ -370,6 +378,9 @@ public:
private:
void storeAccumulator() const;
Reference doStoreOnStack(int tempIndex) const;
+ void tdzCheck(bool requiresCheck, bool throwsReferenceError) const;
+ void tdzCheckStackSlot(
+ Moth::StackSlot slot, bool requiresCheck, bool throwsReferenceError) const;
};
struct RegisterScope {