aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-07 13:27:38 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:18:41 +0000
commitfee680b24a41c177a23f82fc7334ab593931afea (patch)
tree23aa05e538b287ec25830bc3b000c9641cfd9699 /src/qml/jsruntime/qv4context.cpp
parent2ad213cc02094e003802530757fa4010720a22e6 (diff)
Don't throw errors from the internal put methods anymore
Instead do it in the VME, where we can then easily separate into throwing and non throwing versions by bytecode. Change-Id: Ie63bd5b3610bb85f26fb8979179b2e239876cd97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 8678529916..add007fdfb 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -280,7 +280,7 @@ ReturnedValue QV4::ExecutionContext::simpleCall(ExecutionEngine *engine, CallDat
return res;
}
-void ExecutionContext::setProperty(String *name, const Value &value)
+bool ExecutionContext::setProperty(String *name, const Value &value)
{
name->makeIdentifier();
Identifier *id = name->identifier();
@@ -294,7 +294,7 @@ void ExecutionContext::setProperty(String *name, const Value &value)
Heap::CatchContext *c = static_cast<Heap::CatchContext *>(ctx);
if (c->exceptionVarName->isEqualTo(name->d())) {
c->exceptionValue.set(v4, value);
- return;
+ return true;
}
break;
}
@@ -302,10 +302,8 @@ void ExecutionContext::setProperty(String *name, const Value &value)
// the semantics are different from the setProperty calls of other activations
Scope scope(v4);
ScopedObject w(scope, ctx->activation);
- if (w->hasProperty(name)) {
- w->put(name, value);
- return;
- }
+ if (w->hasProperty(name))
+ return w->put(name, value);
break;
}
case Heap::ExecutionContext::Type_CallContext:
@@ -321,7 +319,7 @@ void ExecutionContext::setProperty(String *name, const Value &value)
index -= c->v4Function->nFormals;
static_cast<Heap::CallContext *>(c)->locals.set(v4, index, value);
}
- return;
+ return true;
}
}
}
@@ -332,26 +330,22 @@ void ExecutionContext::setProperty(String *name, const Value &value)
if (member < UINT_MAX) {
Scope scope(v4);
ScopedObject a(scope, ctx->activation);
- a->putValue(member, value);
- return;
+ return a->putValue(member, value);
}
}
break;
case Heap::ExecutionContext::Type_QmlContext: {
Scope scope(v4);
ScopedObject activation(scope, ctx->activation);
- activation->put(name, value);
- return;
+ return activation->put(name, value);
}
}
}
- if (d()->strictMode) {
- engine()->throwReferenceError(*name);
- return;
- }
- engine()->globalObject->put(name, value);
+ if (d()->strictMode)
+ return false;
+ return engine()->globalObject->put(name, value);
}
ReturnedValue ExecutionContext::getProperty(String *name)