summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-02 07:00:14 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-02 07:00:14 (GMT)
commit5455a16f49e8d36e604705c14c842c8a4e1b4f1f (patch)
tree60e0fbdb2d2ab5109fb3327968b84681d433b73a /src/declarative
parent2fc0161b46597bf64a8f88f027f3b98a021a8242 (diff)
downloadQt-5455a16f49e8d36e604705c14c842c8a4e1b4f1f.zip
Qt-5455a16f49e8d36e604705c14c842c8a4e1b4f1f.tar.gz
Qt-5455a16f49e8d36e604705c14c842c8a4e1b4f1f.tar.bz2
Disallow using typenames as ids
This is now illegal: import Qt 4.6 Item { id: Item } as is import Qt 4.6 Item { id: Text }
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 070add7..c0f7bfd 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1452,10 +1452,13 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
if (!isValidId(val))
COMPILE_EXCEPTION(prop, val << "is not a valid object id");
- // We disallow id's that conflict with import prefixes
+ // We disallow id's that conflict with import prefixes and types
QmlEnginePrivate::ImportedNamespace *ns = 0;
+ QmlType *type = 0;
QmlEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(),
- 0, 0, 0, 0, &ns);
+ &type, 0, 0, 0, &ns);
+ if (type)
+ COMPILE_EXCEPTION(idValue, "id conflicts with type name");
if (ns)
COMPILE_EXCEPTION(idValue, "id conflicts with namespace prefix");