summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-11-12 03:44:06 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-11-12 03:57:39 (GMT)
commitf809dc1b16d6a56c1a2d57997748bddb313f7f4c (patch)
tree06110acd887582bb04833b27eeca0276d314bf90 /src/script/bridge
parentaf60542fc4214cc716ffb1bdc46e2e7f6b5a6b8a (diff)
downloadQt-f809dc1b16d6a56c1a2d57997748bddb313f7f4c.zip
Qt-f809dc1b16d6a56c1a2d57997748bddb313f7f4c.tar.gz
Qt-f809dc1b16d6a56c1a2d57997748bddb313f7f4c.tar.bz2
Small optimization of enum detection in script.
Reviewed-by: Martin Jones
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptdeclarativeclass.cpp8
-rw-r--r--src/script/bridge/qscriptdeclarativeclass_p.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
index 8080b9f..92248a0 100644
--- a/src/script/bridge/qscriptdeclarativeclass.cpp
+++ b/src/script/bridge/qscriptdeclarativeclass.cpp
@@ -468,6 +468,14 @@ QString QScriptDeclarativeClass::toString(const Identifier &identifier)
return QString((QChar *)r->data(), r->size());
}
+bool QScriptDeclarativeClass::startsWithUpper(const Identifier &identifier)
+{
+ JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
+ if (r->size() < 1)
+ return false;
+ return QChar::category(r->data()[0]) == QChar::Letter_Uppercase;
+}
+
quint32 QScriptDeclarativeClass::toArrayIndex(const Identifier &identifier, bool *ok)
{
JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h
index 420b133..fe38eeb 100644
--- a/src/script/bridge/qscriptdeclarativeclass_p.h
+++ b/src/script/bridge/qscriptdeclarativeclass_p.h
@@ -126,6 +126,7 @@ public:
PersistentIdentifier createPersistentIdentifier(const Identifier &);
QString toString(const Identifier &);
+ bool startsWithUpper(const Identifier &);
quint32 toArrayIndex(const Identifier &, bool *ok);
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,