diff options
| author | Lars Knoll <lars.knoll@digia.com> | 2014-05-09 14:14:02 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:18 +0200 |
| commit | 0fd24cf96e79bea3fb625563ddd3ce6f1ca8bd4b (patch) | |
| tree | 6dc96a61c65b8c6ecf1c2f362510630af56e2d60 /src/qml/jsruntime/qv4stringobject.cpp | |
| parent | dba56a752c932670c0e9461f106d2bc084276b6f (diff) | |
Convert most simple objects to the new constructor scheme
Change-Id: I90042037bc0555771bd98233977c7d2b735bb718
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index c47e1ae5b9..3f683495cd 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -77,35 +77,29 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(StringObject); -StringObject::StringObject(InternalClass *ic) - : Object(ic) +StringObject::Data::Data(InternalClass *ic) + : Object::Data(ic) { - Q_ASSERT(internalClass()->vtable == staticVTable()); + Q_ASSERT(internalClass->vtable == staticVTable()); + value = ic->engine->newString(QStringLiteral(""))->asReturnedValue(); + tmpProperty.value = Primitive::undefinedValue(); - Scope scope(engine()); - ScopedObject protectThis(scope, this); - - d()->value = ic->engine->newString(QStringLiteral(""))->asReturnedValue(); - - d()->tmpProperty.value = Primitive::undefinedValue(); - - defineReadonlyProperty(ic->engine->id_length, Primitive::fromInt32(0)); + Scope scope(ic->engine); + ScopedObject s(scope, this); + s->defineReadonlyProperty(ic->engine->id_length, Primitive::fromInt32(0)); } -StringObject::StringObject(ExecutionEngine *engine, const ValueRef val) - : Object(engine->stringObjectClass) +StringObject::Data::Data(ExecutionEngine *engine, const ValueRef val) + : Object::Data(engine->stringObjectClass) { + value = val; + Q_ASSERT(value.isString()); + tmpProperty.value = Primitive::undefinedValue(); setVTable(staticVTable()); Scope scope(engine); - ScopedObject protectThis(scope, this); - - d()->value = *val; - - d()->tmpProperty.value = Primitive::undefinedValue(); - - assert(d()->value.isString()); - defineReadonlyProperty(engine->id_length, Primitive::fromUInt32(d()->value.stringValue()->toQString().length())); + ScopedObject s(scope, this); + s->defineReadonlyProperty(engine->id_length, Primitive::fromUInt32(value.stringValue()->toQString().length())); } Property *StringObject::getIndex(uint index) const |
