Commit 953f0daa authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Add a check to disallow recursive type definitions in xml file.

At least direct recursion with name="Foo" extends="Foo" is detected
and rejected.

Done-with: Erik Verbruggen
parent cb04bea9
......@@ -384,6 +384,7 @@ private:
const QLatin1String tag("type");
Q_ASSERT(_xml.isStartElement() && _xml.name() == tag);
bool doInsert = true;
QString name, defaultPropertyName;
int major = -1, minor = -1;
QString extends;
......@@ -423,6 +424,11 @@ private:
} else if (attr.name() == QLatin1String("extends")) {
if (! attr.value().isEmpty())
extends = attr.value().toString();
if (extends == name) {
invalidAttr(extends, QLatin1String("extends"), tag);
doInsert = false;
}
} else {
ignoreAttr(attr);
}
......@@ -450,7 +456,10 @@ private:
unexpectedElement(_xml.name(), tag);
}
_objects->insert(name, metaObject);
if (doInsert)
_objects->insert(name, metaObject);
else
delete metaObject;
}
bool split(const QString &name, QString *packageName, QString *className) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment