aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4bytecodegenerator_p.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h
index 3b3c766bfe..e69f2cd310 100644
--- a/src/qml/compiler/qv4bytecodegenerator_p.h
+++ b/src/qml/compiler/qv4bytecodegenerator_p.h
@@ -102,14 +102,19 @@ public:
Jump(BytecodeGenerator *generator, int instruction)
: generator(generator),
index(instruction)
- {}
+ { Q_ASSERT(generator && index != -1); }
+
~Jump() {
- Q_ASSERT(generator->instructions[index].linkedLabel != -1);
+ Q_ASSERT(index == -1 || generator->instructions[index].linkedLabel != -1); // make sure link() got called
}
+ Jump(Jump &&j) {
+ std::swap(generator, j.generator);
+ std::swap(index, j.index);
+ }
- BytecodeGenerator *generator;
- int index;
+ BytecodeGenerator *generator = nullptr;
+ int index = -1;
void link() {
link(generator->label());
@@ -119,6 +124,12 @@ public:
Q_ASSERT(generator->instructions[index].linkedLabel == -1);
generator->instructions[index].linkedLabel = l.index;
}
+
+ private:
+ // make this type move-only:
+ Q_DISABLE_COPY(Jump)
+ // we never move-assign this type anywhere, so disable it:
+ Jump &operator=(Jump &&) = delete;
};
struct ExceptionHandler : public Label {