aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stringobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-11 14:36:01 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 13:13:21 +0200
commit002e6105f61269f1474de878ccdb26205e5b226e (patch)
treeead1d10b7d8aa2537e7073327d9d0d9ce591c995 /src/qml/jsruntime/qv4stringobject.cpp
parent1a2a83f80ba4ecc28eba72af57c81bd43a45946c (diff)
Require a ValueScope for ScopedCallData as well
This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index b66ee6c180..d3a5f68aeb 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -357,7 +357,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
Value regexp = context->argumentCount ? context->arguments[0] : Value::undefinedValue();
RegExpObject *rx = regexp.as<RegExpObject>();
if (!rx) {
- ScopedCallData callData(context->engine, 1);
+ ScopedCallData callData(scope, 1);
callData->args[0] = regexp;
rx = context->engine->regExpCtor.asFunctionObject()->construct(callData).as<RegExpObject>();
}
@@ -371,7 +371,7 @@ Value StringPrototype::method_match(SimpleCallContext *context)
// ### use the standard builtin function, not the one that might be redefined in the proto
FunctionObject *exec = context->engine->regExpClass->prototype->get(context->engine->newString(QStringLiteral("exec")), 0).asFunctionObject();
- ScopedCallData callData(context->engine, 1);
+ ScopedCallData callData(scope, 1);
callData->thisObject = Value::fromObject(rx);
callData->args[0] = Value::fromString(s);
if (!global)
@@ -514,7 +514,7 @@ Value StringPrototype::method_replace(SimpleCallContext *ctx)
ScopedValue replacement(scope);
if (FunctionObject* searchCallback = replaceValue.asFunctionObject()) {
result.reserve(string.length() + 10*numStringMatches);
- ScopedCallData callData(ctx->engine, numCaptures + 2);
+ ScopedCallData callData(scope, numCaptures + 2);
callData->thisObject = Value::undefinedValue();
int lastEnd = 0;
for (int i = 0; i < numStringMatches; ++i) {
@@ -566,6 +566,7 @@ Value StringPrototype::method_replace(SimpleCallContext *ctx)
Value StringPrototype::method_search(SimpleCallContext *ctx)
{
+ ValueScope scope(ctx);
QString string;
if (StringObject *thisString = ctx->thisObject.asStringObject())
string = thisString->value.stringValue()->toQString();
@@ -575,7 +576,7 @@ Value StringPrototype::method_search(SimpleCallContext *ctx)
Value regExpValue = ctx->argument(0);
RegExpObject *regExp = regExpValue.as<RegExpObject>();
if (!regExp) {
- ScopedCallData callData(ctx->engine, 1);
+ ScopedCallData callData(scope, 1);
callData->args[0] = regExpValue;
regExpValue = ctx->engine->regExpCtor.asFunctionObject()->construct(callData);
regExp = regExpValue.as<RegExpObject>();