diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-07 11:47:51 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-07 10:32:15 +0000 |
commit | e99c203b77743fe7554663c12a98960d8514fb6b (patch) | |
tree | ff1d36effac6e7efc255f418fb2f418aea56baf4 /src | |
parent | e45eca9058bd475060637143188a4466faf487d9 (diff) |
Use the correct enum value instead of hard coded ints
Change-Id: I2d65fe6fb3d9f299f5aeff1542c7dc1d2db8b012
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index c90787acc8..5c91b51b91 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -646,7 +646,7 @@ void Codegen::destructureElementList(const Codegen::Reference &array, PatternEle array.loadInAccumulator(); Instruction::GetIterator iteratorObjInstr; - iteratorObjInstr.iterator = 1; // ForEachType::Of + iteratorObjInstr.iterator = static_cast<int>(AST::ForEachType::Of); bytecodeGenerator->addInstruction(iteratorObjInstr); iterator.storeConsumeAccumulator(); @@ -1128,7 +1128,7 @@ bool Codegen::visit(ArrayPattern *ast) expr.loadInAccumulator(); Instruction::GetIterator iteratorObjInstr; - iteratorObjInstr.iterator = /*ForEachType::Of*/ 1; + iteratorObjInstr.iterator = static_cast<int>(AST::ForEachType::Of); bytecodeGenerator->addInstruction(iteratorObjInstr); iterator.storeConsumeAccumulator(); } @@ -2844,7 +2844,7 @@ bool Codegen::visit(YieldExpression *ast) expr.loadInAccumulator(); Instruction::GetIterator getIterator; - getIterator.iterator = /*ForEachType::Of*/ 1; + getIterator.iterator = static_cast<int>(AST::ForEachType::Of); bytecodeGenerator->addInstruction(getIterator); iterator.storeConsumeAccumulator(); Instruction::LoadUndefined load; @@ -3212,7 +3212,7 @@ bool Codegen::visit(ForEachStatement *ast) expr.loadInAccumulator(); Instruction::GetIterator iteratorObjInstr; - iteratorObjInstr.iterator = (ast->type == ForEachType::Of) ? 1 : 0; + iteratorObjInstr.iterator = static_cast<int>(ast->type); bytecodeGenerator->addInstruction(iteratorObjInstr); iterator.storeConsumeAccumulator(); } diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 4e1993d45f..39a451e941 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -731,7 +731,7 @@ ReturnedValue Runtime::method_getIterator(ExecutionEngine *engine, const Value & o = in.toObject(engine); if (engine->hasException) return Encode::undefined(); - if (iterator) { + if (iterator == static_cast<int>(QQmlJS::AST::ForEachType::Of)) { if (!o) return engine->throwTypeError(); ScopedFunctionObject f(scope, o->get(engine->symbol_iterator())); |