aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4string.cpp110
-rw-r--r--src/qml/jsruntime/qv4string_p.h11
2 files changed, 2 insertions, 119 deletions
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 795a6dfdc4..de5c7ffa24 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -94,24 +94,7 @@ static uint toArrayIndex(const char *ch, const char *end)
}
-const ObjectVTable String::static_vtbl =
-{
- DEFINE_MANAGED_VTABLE_INT(String, 0),
- 0,
- 0,
- get,
- getIndexed,
- put,
- putIndexed,
- query,
- queryIndexed,
- deleteProperty,
- deleteIndexedProperty,
- 0 /*getLookup*/,
- 0 /*setLookup*/,
- 0,
- 0 /*advanceIterator*/,
-};
+DEFINE_MANAGED_VTABLE(String);
void String::markObjects(Heap::Base *that, ExecutionEngine *e)
{
@@ -122,97 +105,6 @@ void String::markObjects(Heap::Base *that, ExecutionEngine *e)
}
}
-ReturnedValue String::get(Managed *m, String *name, bool *hasProperty)
-{
- ExecutionEngine *v4 = m->engine();
- Scope scope(v4);
- ScopedString that(scope, static_cast<String *>(m));
-
- if (name->equals(v4->id_length)) {
- if (hasProperty)
- *hasProperty = true;
- return Primitive::fromInt32(that->d()->text->size).asReturnedValue();
- }
- PropertyAttributes attrs;
- Property *pd = v4->stringPrototype.asObject()->__getPropertyDescriptor__(name, &attrs);
- if (!pd || attrs.isGeneric()) {
- if (hasProperty)
- *hasProperty = false;
- return Primitive::undefinedValue().asReturnedValue();
- }
- if (hasProperty)
- *hasProperty = true;
- return v4->stringPrototype.asObject()->getValue(that, pd, attrs);
-}
-
-ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty)
-{
- ExecutionEngine *engine = m->engine();
- Scope scope(engine);
- ScopedString that(scope, static_cast<String *>(m));
-
- if (index < static_cast<uint>(that->d()->text->size)) {
- if (hasProperty)
- *hasProperty = true;
- return Encode(engine->newString(that->toQString().mid(index, 1)));
- }
- PropertyAttributes attrs;
- Property *pd = engine->stringPrototype.asObject()->__getPropertyDescriptor__(index, &attrs);
- if (!pd || attrs.isGeneric()) {
- if (hasProperty)
- *hasProperty = false;
- return Primitive::undefinedValue().asReturnedValue();
- }
- if (hasProperty)
- *hasProperty = true;
- return engine->stringPrototype.asObject()->getValue(that, pd, attrs);
-}
-
-void String::put(Managed *m, String *name, const ValueRef value)
-{
- Scope scope(m->engine());
- if (scope.hasException())
- return;
- ScopedString that(scope, static_cast<String *>(m));
- ScopedObject o(scope, that->engine()->newStringObject(that));
- o->put(name, value);
-}
-
-void String::putIndexed(Managed *m, uint index, const ValueRef value)
-{
- Scope scope(m->engine());
- if (scope.hasException())
- return;
-
- ScopedString that(scope, static_cast<String *>(m));
- ScopedObject o(scope, that->engine()->newStringObject(that));
- o->putIndexed(index, value);
-}
-
-PropertyAttributes String::query(const Managed *m, String *name)
-{
- uint idx = name->asArrayIndex();
- if (idx != UINT_MAX)
- return queryIndexed(m, idx);
- return Attr_Invalid;
-}
-
-PropertyAttributes String::queryIndexed(const Managed *m, uint index)
-{
- const String *that = static_cast<const String *>(m);
- return (index < static_cast<uint>(that->d()->text->size)) ? Attr_NotConfigurable|Attr_NotWritable : Attr_Invalid;
-}
-
-bool String::deleteProperty(Managed *, String *)
-{
- return false;
-}
-
-bool String::deleteIndexedProperty(Managed *, uint)
-{
- return false;
-}
-
bool String::isEqualTo(Managed *t, Managed *o)
{
if (t == o)
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 3af945fc1d..e70af2462a 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -116,8 +116,7 @@ private:
struct Q_QML_PRIVATE_EXPORT String : public Managed {
#ifndef V4_BOOTSTRAP
- // ### FIXME: Should this be a V4_OBJECT
- V4_OBJECT2(String, Managed)
+ V4_MANAGED(String, Managed)
Q_MANAGED_TYPE(String)
V4_NEEDS_DESTROY
enum {
@@ -177,14 +176,6 @@ struct Q_QML_PRIVATE_EXPORT String : public Managed {
protected:
static void markObjects(Heap::Base *that, ExecutionEngine *e);
- static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
- static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
- static void putIndexed(Managed *m, uint index, const ValueRef value);
- static PropertyAttributes query(const Managed *m, String *name);
- static PropertyAttributes queryIndexed(const Managed *m, uint index);
- static bool deleteProperty(Managed *, String *);
- static bool deleteIndexedProperty(Managed *m, uint index);
static bool isEqualTo(Managed *that, Managed *o);
static uint getLength(const Managed *m);
#endif