aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4string.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-12 13:48:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-12 14:52:52 +0100
commit3373f67d47a3f0e2a191dec4d7d97cc0a1b02e2d (patch)
treec714c58f2daa193f5ad932f5853a409ae37fc618 /src/qml/jsruntime/qv4string.cpp
parent447844aa25754db7e868469de4537af4331709ac (diff)
QV4::String is not an Object
Remove all the code related to Object vtable's in here. This code never got called anyway, as it would require casting to an Object to call it (which would of course fail for Strings). Change-Id: Ib62bb1b10999304cb65f6030d805698b9f60700d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4string.cpp')
-rw-r--r--src/qml/jsruntime/qv4string.cpp110
1 files changed, 1 insertions, 109 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)