aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4generatorobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-11 11:07:32 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-17 07:47:09 +0000
commit1dac47c1418b44cf4a56b42bfca2b277795fd213 (patch)
tree26727943c30628340662a66d7cbe9f52d75c5b58 /src/qml/jsruntime/qv4generatorobject.cpp
parentd89d5cffe79bd060a1b04a2c47a3d728bffbe195 (diff)
Cleanups in Value/Primitive
Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4generatorobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4generatorobject.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4generatorobject.cpp b/src/qml/jsruntime/qv4generatorobject.cpp
index dd3d0328b0..da87127e08 100644
--- a/src/qml/jsruntime/qv4generatorobject.cpp
+++ b/src/qml/jsruntime/qv4generatorobject.cpp
@@ -108,8 +108,8 @@ ReturnedValue GeneratorFunction::virtualCall(const FunctionObject *f, const Valu
memcpy(gp->stack.values, argv, argc*sizeof(Value));
gp->cppFrame.init(engine, function, gp->stack.values, argc);
gp->cppFrame.setupJSFrame(&gp->stack.values[argc], *gf, gf->scope(),
- thisObject ? *thisObject : Primitive::undefinedValue(),
- Primitive::undefinedValue());
+ thisObject ? *thisObject : Value::undefinedValue(),
+ Value::undefinedValue());
gp->cppFrame.push();
@@ -134,7 +134,7 @@ void GeneratorPrototype::init(ExecutionEngine *engine, Object *ctor)
ScopedObject ctorProto(scope, engine->newObject(engine->newInternalClass(Object::staticVTable(), engine->functionPrototype())));
- ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(1));
+ ctor->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(1));
ctor->defineReadonlyProperty(engine->id_prototype(), ctorProto);
ctorProto->defineDefaultProperty(QStringLiteral("constructor"), (v = ctor), Attr_ReadOnly_ButConfigurable);
@@ -158,9 +158,9 @@ ReturnedValue GeneratorPrototype::method_next(const FunctionObject *f, const Val
Heap::GeneratorObject *gp = g->d();
if (gp->state == GeneratorState::Completed)
- return IteratorPrototype::createIterResultObject(engine, Primitive::undefinedValue(), true);
+ return IteratorPrototype::createIterResultObject(engine, Value::undefinedValue(), true);
- return g->resume(engine, argc ? argv[0] : Primitive::undefinedValue());
+ return g->resume(engine, argc ? argv[0] : Value::undefinedValue());
}
ReturnedValue GeneratorPrototype::method_return(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
@@ -176,13 +176,13 @@ ReturnedValue GeneratorPrototype::method_return(const FunctionObject *f, const V
gp->state = GeneratorState::Completed;
if (gp->state == GeneratorState::Completed)
- return IteratorPrototype::createIterResultObject(engine, argc ? argv[0] : Primitive::undefinedValue(), true);
+ return IteratorPrototype::createIterResultObject(engine, argc ? argv[0] : Value::undefinedValue(), true);
// the bytecode interpreter interprets an exception with empty value as
// a yield called with return()
- engine->throwError(Primitive::emptyValue());
+ engine->throwError(Value::emptyValue());
- return g->resume(engine, argc ? argv[0]: Primitive::undefinedValue());
+ return g->resume(engine, argc ? argv[0]: Value::undefinedValue());
}
ReturnedValue GeneratorPrototype::method_throw(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
@@ -194,14 +194,14 @@ ReturnedValue GeneratorPrototype::method_throw(const FunctionObject *f, const Va
Heap::GeneratorObject *gp = g->d();
- engine->throwError(argc ? argv[0]: Primitive::undefinedValue());
+ engine->throwError(argc ? argv[0]: Value::undefinedValue());
if (gp->state == GeneratorState::SuspendedStart || gp->state == GeneratorState::Completed) {
gp->state = GeneratorState::Completed;
return Encode::undefined();
}
- return g->resume(engine, Primitive::undefinedValue());
+ return g->resume(engine, Value::undefinedValue());
}
ReturnedValue GeneratorObject::resume(ExecutionEngine *engine, const Value &arg) const