diff options
-rw-r--r-- | src/script/api/qscriptengine.cpp | 15 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 13 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 739b3fc..33104c9 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -393,6 +393,21 @@ qsreal ToInteger(qsreal n) return sign * ::floor(::fabs(n)); } +#ifdef Q_CC_MSVC +// MSVC2008 crashes if these are inlined. + +QString ToString(qsreal value) +{ + return JSC::UString::from(value); +} + +qsreal ToNumber(const QString &value) +{ + return ((JSC::UString)value).toDouble(); +} + +#endif + void GlobalClientData::mark(JSC::MarkStack& markStack) { engine->mark(markStack); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index eff34af..f69e537 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -106,12 +106,18 @@ namespace QScript inline bool ToBool(qsreal); inline bool ToBool(const QString &); - inline qsreal ToNumber(const QString &); inline qint32 ToInt32(const QString &); inline quint32 ToUInt32(const QString &); inline quint16 ToUInt16(const QString &); inline qsreal ToInteger(const QString &); +#ifdef Q_CC_MSVC + // MSVC2008 crashes if these are inlined. + qsreal ToNumber(const QString &); + QString ToString(qsreal); +#else + inline qsreal ToNumber(const QString &); inline QString ToString(qsreal); +#endif //some conversion helper functions inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec); @@ -463,6 +469,9 @@ inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec) return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine; } +#ifndef Q_CC_MSVC +// MSVC2008 crashes if these are inlined. + inline QString ToString(qsreal value) { return JSC::UString::from(value); @@ -473,6 +482,8 @@ inline qsreal ToNumber(const QString &value) return ((JSC::UString)value).toDouble(); } +#endif + inline qint32 ToInt32(const QString &value) { return ToInt32(ToNumber(value)); |