aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-05-31 15:53:08 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-06-27 10:04:32 +0000
commite62826fd6a40f2c41e8c252181bf3ab7d460bc50 (patch)
treeb19379fe26bb36453f72b89e6db888b17dda64c1 /src/qml/jsruntime/qv4runtime.cpp
parent0ec2c4720c47282109b618370bf8397bb1d13a56 (diff)
Simplify storeProperty runtime API
We can do the isStrict() check and throwTypeError() call in the runtime function instead of doing it twice on the two call sites. Change-Id: I5689babe4873c0bc3e7c85ca2d15a33f8ccb8794 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index bcedfa06b5..23170ace92 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -577,14 +577,14 @@ QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionEngine *engine, const Valu
return Encode(x + y);
}
-bool Runtime::method_storeProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value)
+void Runtime::method_storeProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value)
{
Scope scope(engine);
- ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]);
+ QV4::Function *v4Function = engine->currentStackFrame->v4Function;
+ ScopedString name(scope, v4Function->compilationUnit->runtimeStrings[nameIndex]);
ScopedObject o(scope, object.toObject(engine));
- if (!o)
- return false;
- return o->put(name, value);
+ if ((!o || !o->put(name, value)) && v4Function->isStrict())
+ engine->throwTypeError();
}
static Q_NEVER_INLINE ReturnedValue getElementIntFallback(ExecutionEngine *engine, const Value &object, uint idx)