aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-07 11:46:41 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:18:26 +0000
commit026ec5feee4d6fac4d7b0530fce6da649a1ee27d (patch)
treeaddc54b9e8697334dd732891404c898dd7a85cd5 /src
parent475f4559d97dca4e85e6601f77593b354193393d (diff)
Reduce usage of the strictMode flag in ExecutionContext
The goal is to completely get rid of it, and replace it by calling strict/sloppy versions of runtime functions in the generated code. Change-Id: Icd516d924136109abaf0dc9f3ef0e771a709485d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsapi/qjsengine.cpp2
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp6
3 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index 1c7540778b..6eede17ab4 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -446,7 +446,7 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in
QV4::ScopedValue result(scope);
QV4::Script script(ctx, program, fileName, lineNumber);
- script.strictMode = ctx->d()->strictMode;
+ script.strictMode = ctx->d()->v4Function->isStrict();
script.inheritContext = true;
script.parse();
if (!scope.engine->hasException)
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 10118ea403..f314d02912 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -420,7 +420,7 @@ void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function
Q_ASSERT(internalClass && internalClass->find(s.engine->id_length()) == Index_Length);
setProperty(s.engine, Index_Length, Primitive::fromInt32(f->formalParameterCount()));
- if (scope->d()->strictMode) {
+ if (function->isStrict()) {
ScopedProperty pd(s);
pd->value = s.engine->thrower();
pd->set = s.engine->thrower();
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 71140e5386..179c4120ae 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -360,10 +360,10 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) const
return callData->args[0].asReturnedValue();
const QString code = scode->toQString();
- bool inheritContext = !ctx->d()->strictMode;
+ bool inheritContext = !ctx->d()->v4Function->isStrict();
Script script(ctx, code, QStringLiteral("eval code"));
- script.strictMode = (directCall && currentContext->d()->strictMode);
+ script.strictMode = (directCall && currentContext->d()->v4Function->isStrict());
script.inheritContext = inheritContext;
script.parse();
if (v4->hasException)
@@ -373,7 +373,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) const
if (!function)
return Encode::undefined();
- if (function->isStrict() || (ctx->d()->strictMode)) {
+ if (function->isStrict() || (ctx->d()->v4Function->isStrict())) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedCallData callData(scope, 0);
callData->thisObject = ctx->thisObject();