diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-11 11:07:32 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-17 07:47:09 +0000 |
commit | 1dac47c1418b44cf4a56b42bfca2b277795fd213 (patch) | |
tree | 26727943c30628340662a66d7cbe9f52d75c5b58 /src/qml/jsruntime/qv4mapobject.cpp | |
parent | d89d5cffe79bd060a1b04a2c47a3d728bffbe195 (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/qv4mapobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4mapobject.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4mapobject.cpp b/src/qml/jsruntime/qv4mapobject.cpp index c598814fb6..7d53b36fcd 100644 --- a/src/qml/jsruntime/qv4mapobject.cpp +++ b/src/qml/jsruntime/qv4mapobject.cpp @@ -137,7 +137,7 @@ void WeakMapPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); - ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(0)); + ctor->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(0)); ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); defineDefaultProperty(engine->id_constructor(), (o = ctor)); @@ -155,7 +155,7 @@ void MapPrototype::init(ExecutionEngine *engine, Object *ctor) { Scope scope(engine); ScopedObject o(scope); - ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(0)); + ctor->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(0)); ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); ctor->addSymbolSpecies(); defineDefaultProperty(engine->id_constructor(), (o = ctor)); @@ -249,7 +249,7 @@ ReturnedValue WeakMapPrototype::method_set(const FunctionObject *b, const Value (!argc || !argv[0].isObject())) return scope.engine->throwTypeError(); - that->d()->esTable->set(argv[0], argc > 1 ? argv[1] : Primitive::undefinedValue()); + that->d()->esTable->set(argv[0], argc > 1 ? argv[1] : Value::undefinedValue()); return that.asReturnedValue(); } @@ -272,7 +272,7 @@ ReturnedValue MapPrototype::method_delete(const FunctionObject *b, const Value * if (!that || that->d()->isWeakMap) return scope.engine->throwTypeError(); - return Encode(that->d()->esTable->remove(argc ? argv[0] : Primitive::undefinedValue())); + return Encode(that->d()->esTable->remove(argc ? argv[0] : Value::undefinedValue())); } ReturnedValue MapPrototype::method_entries(const FunctionObject *b, const Value *thisObject, const Value *, int) @@ -298,7 +298,7 @@ ReturnedValue MapPrototype::method_forEach(const FunctionObject *b, const Value if (!callbackfn) return scope.engine->throwTypeError(); - ScopedValue thisArg(scope, Primitive::undefinedValue()); + ScopedValue thisArg(scope, Value::undefinedValue()); if (argc > 1) thisArg = ScopedValue(scope, argv[1]); @@ -320,7 +320,7 @@ ReturnedValue MapPrototype::method_get(const FunctionObject *b, const Value *thi if (!that || that->d()->isWeakMap) return scope.engine->throwTypeError(); - return that->d()->esTable->get(argc ? argv[0] : Primitive::undefinedValue()); + return that->d()->esTable->get(argc ? argv[0] : Value::undefinedValue()); } ReturnedValue MapPrototype::method_has(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) @@ -330,7 +330,7 @@ ReturnedValue MapPrototype::method_has(const FunctionObject *b, const Value *thi if (!that || that->d()->isWeakMap) return scope.engine->throwTypeError(); - return Encode(that->d()->esTable->has(argc ? argv[0] : Primitive::undefinedValue())); + return Encode(that->d()->esTable->has(argc ? argv[0] : Value::undefinedValue())); } ReturnedValue MapPrototype::method_keys(const FunctionObject *b, const Value *thisObject, const Value *, int) @@ -352,7 +352,7 @@ ReturnedValue MapPrototype::method_set(const FunctionObject *b, const Value *thi if (!that || that->d()->isWeakMap) return scope.engine->throwTypeError(); - that->d()->esTable->set(argc ? argv[0] : Primitive::undefinedValue(), argc > 1 ? argv[1] : Primitive::undefinedValue()); + that->d()->esTable->set(argc ? argv[0] : Value::undefinedValue(), argc > 1 ? argv[1] : Value::undefinedValue()); return that.asReturnedValue(); } |