diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-09-11 15:10:15 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-09-22 08:55:48 (GMT) |
commit | 36d83b1dbc4c8aa25745174bd2f1212af3e544f0 (patch) | |
tree | e5ad17f4585350a1aed359298cef1a38275c4722 /src/script/api/qscriptvalue.cpp | |
parent | 0ae3db6460628c0908ce15b1c96e80df096ad737 (diff) | |
download | Qt-36d83b1dbc4c8aa25745174bd2f1212af3e544f0.zip Qt-36d83b1dbc4c8aa25745174bd2f1212af3e544f0.tar.gz Qt-36d83b1dbc4c8aa25745174bd2f1212af3e544f0.tar.bz2 |
Fix QScriptValue constructors without a QScriptEngine
Don't create JSC types as the conversion back to a string now
requires an ExecState.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 1d73a8f..a1f5878 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -560,13 +560,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, int val) if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); - } else { - JSC::JSValue immediate = JSC::JSImmediate::from(val); - if (immediate) - d_ptr->initFrom(immediate); - else - d_ptr->initFrom(val); - } + } else + d_ptr->initFrom(val); } /*! @@ -582,13 +577,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, uint val) if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); - } else { - JSC::JSValue immediate = JSC::JSImmediate::from(val); - if (immediate) - d_ptr->initFrom(immediate); - else - d_ptr->initFrom(val); - } + } else + d_ptr->initFrom(val); } /*! @@ -604,13 +594,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val) if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); - } else { - JSC::JSValue immediate = JSC::JSImmediate::from(val); - if (immediate) - d_ptr->initFrom(immediate); - else - d_ptr->initFrom(val); - } + } else + d_ptr->initFrom(val); } /*! @@ -689,11 +674,7 @@ QScriptValue::QScriptValue(bool value) QScriptValue::QScriptValue(int value) : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - JSC::JSValue immediate = JSC::JSImmediate::from(value); - if (immediate) - d_ptr->initFrom(immediate); - else - d_ptr->initFrom(value); + d_ptr->initFrom(value); } /*! @@ -704,11 +685,7 @@ QScriptValue::QScriptValue(int value) QScriptValue::QScriptValue(uint value) : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - JSC::JSValue immediate = JSC::JSImmediate::from(value); - if (immediate) - d_ptr->initFrom(immediate); - else - d_ptr->initFrom(value); + d_ptr->initFrom(value); } /*! @@ -719,11 +696,7 @@ QScriptValue::QScriptValue(uint value) QScriptValue::QScriptValue(qsreal value) : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - JSC::JSValue immediate = JSC::JSImmediate::from(value); - if (immediate) - d_ptr->initFrom(immediate); - else - d_ptr->initFrom(value); + d_ptr->initFrom(value); } /*! |