diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-18 14:30:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 01:06:20 +0200 |
commit | 1aa618970a9bed46123d0648500e957688d725ec (patch) | |
tree | 1235d0de9aacc2e01b41f06b3bb50ddab7c3d39b /src/qml/jsapi | |
parent | 3c325823a778e1a6542eb746e047d5d7bfb43566 (diff) |
Use StringRef for most methods in Object
Change-Id: I8e2dad0e9e34c5a549952bc0765cd57f6aa8aadf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r-- | src/qml/jsapi/qjsvalue.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index 6b3d15df59..87c45e4779 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -974,12 +974,16 @@ bool QJSValue::deleteProperty(const QString &name) */ bool QJSValue::hasProperty(const QString &name) const { - Object *o = d->value.asObject(); + ExecutionEngine *engine = d->engine; + if (!engine) + return false; + + Scope scope(engine); + ScopedObject o(scope, d->value); if (!o) return false; - ExecutionEngine *engine = d->engine; - String *s = engine->newIdentifier(name); + ScopedString s(scope, engine->newIdentifier(name)); return o->__hasProperty__(s); } @@ -991,12 +995,16 @@ bool QJSValue::hasProperty(const QString &name) const */ bool QJSValue::hasOwnProperty(const QString &name) const { - Object *o = d->value.asObject(); + ExecutionEngine *engine = d->engine; + if (!engine) + return false; + + Scope scope(engine); + ScopedObject o(scope, d->value); if (!o) return false; - ExecutionEngine *engine = d->engine; - String *s = engine->newIdentifier(name); + ScopedString s(scope, engine->newIdentifier(name)); return o->__getOwnProperty__(s); } |