summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativecompiler.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-06-25 03:11:09 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-06-25 03:11:09 (GMT)
commit2426502f372f1c1a33ccaba3549dc0eda2a754de (patch)
tree8a9ec929e44395703bdb15d290ce170e69f800ab /src/declarative/qml/qdeclarativecompiler.cpp
parentcfa9eee32081dc49ab0697b1f483db01c8aee7cd (diff)
downloadQt-2426502f372f1c1a33ccaba3549dc0eda2a754de.zip
Qt-2426502f372f1c1a33ccaba3549dc0eda2a754de.tar.gz
Qt-2426502f372f1c1a33ccaba3549dc0eda2a754de.tar.bz2
Disallow global object properties as property names
QTBUG-11605
Diffstat (limited to 'src/declarative/qml/qdeclarativecompiler.cpp')
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 80a1093..60128b7 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -2199,6 +2199,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
if (QString::fromUtf8(prop.name).at(0).isUpper())
COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter"));
+
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name))
+ COMPILE_EXCEPTION(&prop, tr("Illegal property name"));
+
propNames.insert(prop.name);
}
@@ -2208,6 +2212,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
COMPILE_EXCEPTION(obj, tr("Duplicate signal name"));
if (QString::fromUtf8(name).at(0).isUpper())
COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter"));
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name))
+ COMPILE_EXCEPTION(obj, tr("Illegal signal name"));
methodNames.insert(name);
}
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
@@ -2216,6 +2222,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
COMPILE_EXCEPTION(obj, tr("Duplicate method name"));
if (QString::fromUtf8(name).at(0).isUpper())
COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter"));
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name))
+ COMPILE_EXCEPTION(obj, tr("Illegal method name"));
methodNames.insert(name);
}