aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jsonobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-11-12 14:17:12 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-15 13:16:41 +0100
commit3965ebb3ffc60957108d6c6f3a41eed08c4280a0 (patch)
tree7be39663a0d9de24993bea8fb07b317e004b48e2 /src/qml/jsruntime/qv4jsonobject.cpp
parentb3c00b7df3fc5cec968b8b9eb65a03b9dc0cb7dc (diff)
Fix usage of ExecutionContext in the json parser
Change-Id: I9b2d1389dd66ad74507dd16c4bdf7b57491c1cfb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index de5ffb5b86..e7490d2214 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -65,7 +65,7 @@ DEFINE_OBJECT_VTABLE(JsonObject);
class JsonParser
{
public:
- JsonParser(ExecutionContext *context, const QChar *json, int length);
+ JsonParser(ExecutionEngine *engine, const QChar *json, int length);
ReturnedValue parse(QJsonParseError *error);
@@ -80,7 +80,7 @@ private:
bool parseValue(ValueRef val);
bool parseNumber(ValueRef val);
- ExecutionContext *context;
+ ExecutionEngine *engine;
const QChar *head;
const QChar *json;
const QChar *end;
@@ -92,8 +92,8 @@ private:
static const int nestingLimit = 1024;
-JsonParser::JsonParser(ExecutionContext *context, const QChar *json, int length)
- : context(context), head(json), json(json), nestingLevel(0), lastError(QJsonParseError::NoError)
+JsonParser::JsonParser(ExecutionEngine *engine, const QChar *json, int length)
+ : engine(engine), head(json), json(json), nestingLevel(0), lastError(QJsonParseError::NoError)
{
end = json + length;
}
@@ -189,7 +189,7 @@ ReturnedValue JsonParser::parse(QJsonParseError *error)
eatSpace();
- Scope scope(context);
+ Scope scope(engine);
ScopedValue v(scope);
if (!parseValue(v)) {
#ifdef PARSER_DEBUG
@@ -229,9 +229,9 @@ ReturnedValue JsonParser::parseObject()
}
BEGIN << "parseObject pos=" << json;
- Scope scope(context);
+ Scope scope(engine);
- ScopedObject o(scope, context->d()->engine->newObject());
+ ScopedObject o(scope, engine->newObject());
QChar token = nextToken();
while (token == Quote) {
@@ -265,7 +265,7 @@ ReturnedValue JsonParser::parseObject()
bool JsonParser::parseMember(Object *o)
{
BEGIN << "parseMember";
- Scope scope(context);
+ Scope scope(engine);
QString key;
if (!parseString(&key))
@@ -279,7 +279,7 @@ bool JsonParser::parseMember(Object *o)
if (!parseValue(val))
return false;
- ScopedString s(scope, context->d()->engine->newIdentifier(key));
+ ScopedString s(scope, engine->newIdentifier(key));
uint idx = s->asArrayIndex();
if (idx < UINT_MAX) {
o->putIndexed(idx, val);
@@ -296,9 +296,9 @@ bool JsonParser::parseMember(Object *o)
*/
ReturnedValue JsonParser::parseArray()
{
- Scope scope(context);
+ Scope scope(engine);
BEGIN << "parseArray";
- Scoped<ArrayObject> array(scope, context->d()->engine->newArrayObject());
+ Scoped<ArrayObject> array(scope, engine->newArrayObject());
if (++nestingLevel > nestingLimit) {
lastError = QJsonParseError::DeepNesting;
@@ -401,7 +401,7 @@ bool JsonParser::parseValue(ValueRef val)
return false;
DEBUG << "value: string";
END;
- val = Value::fromHeapObject(context->d()->engine->newString(value));
+ val = Value::fromHeapObject(engine->newString(value));
return true;
}
case BeginArray: {
@@ -895,7 +895,7 @@ ReturnedValue JsonObject::method_parse(CallContext *ctx)
QString jtext = v->toQString();
DEBUG << "parsing source = " << jtext;
- JsonParser parser(ctx, jtext.constData(), jtext.length());
+ JsonParser parser(scope.engine, jtext.constData(), jtext.length());
QJsonParseError error;
ScopedValue result(scope, parser.parse(&error));
if (error.error != QJsonParseError::NoError) {