diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-03-10 11:07:19 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-03-10 16:21:13 (GMT) |
commit | 36dd6c9aea86da5cbba73669116e9d2aa49eac2b (patch) | |
tree | 1cc8eabc197eb206ad6ceb3a526ee9ebbe81a911 /src | |
parent | caadecbf027b9f7978d89b4127c0bfb8e13efb4b (diff) | |
download | Qt-36dd6c9aea86da5cbba73669116e9d2aa49eac2b.zip Qt-36dd6c9aea86da5cbba73669116e9d2aa49eac2b.tar.gz Qt-36dd6c9aea86da5cbba73669116e9d2aa49eac2b.tar.bz2 |
Move method implementation to private class
In preparation of being able to call toStringHandle()
directly on a JSC::Identifier in QScriptValueIterator
implementation.
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 15 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 6adb3de..bef7a3e 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1795,6 +1795,15 @@ QScriptValue::PropertyFlags QScriptEnginePrivate::propertyFlags(JSC::ExecState * return result; } +QScriptString QScriptEnginePrivate::toStringHandle(const JSC::Identifier &name) +{ + QScriptString result; + QScriptStringPrivate *p = new QScriptStringPrivate(this, name, QScriptStringPrivate::HeapAllocated); + QScriptStringPrivate::init(result, p); + registerScriptString(p); + return result; +} + #ifdef QT_NO_QOBJECT QScriptEngine::QScriptEngine() @@ -4054,11 +4063,7 @@ QScriptEngineAgent *QScriptEngine::agent() const QScriptString QScriptEngine::toStringHandle(const QString &str) { Q_D(QScriptEngine); - QScriptString result; - QScriptStringPrivate *p = new QScriptStringPrivate(d, JSC::Identifier(d->currentFrame, str), QScriptStringPrivate::HeapAllocated); - QScriptStringPrivate::init(result, p); - d->registerScriptString(p); - return result; + return d->toStringHandle(JSC::Identifier(d->currentFrame, str)); } /*! diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 8265599..63457af 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -279,6 +279,7 @@ public: inline void registerScriptString(QScriptStringPrivate *value); inline void unregisterScriptString(QScriptStringPrivate *value); void detachAllRegisteredScriptStrings(); + QScriptString toStringHandle(const JSC::Identifier &name); static inline JSC::JSValue newArray(JSC::ExecState *, uint length); static inline JSC::JSValue newDate(JSC::ExecState *, qsreal value); |