diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2012-05-20 19:59:47 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2012-05-21 09:52:55 +0200 |
commit | 945c988b4526c2363d80f530770d1595062518a2 (patch) | |
tree | f92ca48c811b7dd6477cd98ef2decdd0955a2d4c /qv4array.cpp | |
parent | e8bd50dd950f9f7a4bfb892cae0e12934419aca3 (diff) |
Initial support for Array objects.
Diffstat (limited to 'qv4array.cpp')
-rw-r--r-- | qv4array.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qv4array.cpp b/qv4array.cpp new file mode 100644 index 0000000000..9cdd06b23a --- /dev/null +++ b/qv4array.cpp @@ -0,0 +1,20 @@ + +#include "qv4array_p.h" +#include "qmljs_objects.h" + +using namespace QQmlJS::VM; + +bool ArrayElementLessThan::operator()(const Value &v1, const Value &v2) const +{ + if (v1.isUndefined()) + return false; + if (v2.isUndefined()) + return true; + if (!m_comparefn.isUndefined()) { + Value args[] = { v1, v2 }; + Value result; + __qmljs_call_value(m_context, &result, 0, &m_comparefn, args, 2); + return result.toNumber(m_context) <= 0; + } + return v1.toString(m_context)->toQString() < v2.toString(m_context)->toQString(); +} |