diff options
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 6633435668..f40c765327 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -66,6 +66,8 @@ static int indent = 0; #endif +DEFINE_MANAGED_VTABLE(JsonObject); + class JsonParser { public: @@ -288,8 +290,7 @@ bool JsonParser::parseMember(ObjectRef o) if (idx < UINT_MAX) { o->putIndexed(idx, val); } else { - Property *p = o->insertMember(s, Attr_Data); - p->value = val.asReturnedValue(); + o->insertMember(s, val); } END; @@ -337,7 +338,7 @@ ReturnedValue JsonParser::parseArray() } } - DEBUG << "size =" << array->arrayLength(); + DEBUG << "size =" << array->getLength(); END; --nestingLevel; @@ -853,7 +854,7 @@ QString Stringify::JA(ArrayObjectRef a) indent += gap; QStringList partial; - uint len = a->arrayLength(); + uint len = a->getLength(); ScopedValue v(scope); for (uint i = 0; i < len; ++i) { bool exists; @@ -884,12 +885,10 @@ QString Stringify::JA(ArrayObjectRef a) } -JsonObject::JsonObject(ExecutionEngine *engine) - : Object(engine) +JsonObject::JsonObject(InternalClass *ic) + : Object(ic) { - type = Type_JSONObject; - - Scope scope(engine); + Scope scope(ic->engine); ScopedObject protectThis(scope, this); defineDefaultProperty(QStringLiteral("parse"), method_parse, 2); @@ -925,7 +924,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx) if (o) { stringify.replacerFunction = o->asFunctionObject(); if (o->isArrayObject()) { - uint arrayLen = o->arrayLength(); + uint arrayLen = o->getLength(); ScopedValue v(scope); for (uint i = 0; i < arrayLen; ++i) { v = o->getIndexed(i); @@ -1057,9 +1056,10 @@ QV4::ReturnedValue JsonObject::fromJsonArray(ExecutionEngine *engine, const QJso int size = array.size(); Scoped<ArrayObject> a(scope, engine->newArrayObject()); a->arrayReserve(size); + ScopedValue v(scope); for (int i = 0; i < size; i++) { - a->arrayData[i].value = fromJsonValue(engine, array.at(i)); - a->arrayDataLen = i + 1; + a->arrayData->put(i, (v = fromJsonValue(engine, array.at(i)))); + a->arrayData->setLength(i + 1); } a->setArrayLengthUnchecked(size); return a.asReturnedValue(); @@ -1083,7 +1083,7 @@ QJsonArray JsonObject::toJsonArray(ArrayObjectRef a, V4ObjectSet &visitedObjects visitedObjects.insert(a); ScopedValue v(scope); - quint32 length = a->arrayLength(); + quint32 length = a->getLength(); for (quint32 i = 0; i < length; ++i) { v = a->getIndexed(i); if (v->asFunctionObject()) |