forked from qt-creator/qt-creator
qmldump: Bump to QtQuick.tooling 1.1, make parser more permissive.
The qmltypes file reader now ignores unknown bindings and components to allow for better forward-compatibility. Change-Id: I2e31c17344dc8fdcd301a62c8d08e98c29ef53ee Reviewed-on: http://codereview.qt.nokia.com/202 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
committed by
Kai Koehne
parent
3adc021f4b
commit
715cee76a9
@@ -1,4 +1,4 @@
|
|||||||
import QtQuick.tooling 1.0
|
import QtQuick.tooling 1.1
|
||||||
|
|
||||||
// This file describes the plugin-supplied types contained in the library.
|
// This file describes the plugin-supplied types contained in the library.
|
||||||
// It is used for QML tooling purposes only.
|
// It is used for QML tooling purposes only.
|
||||||
|
@@ -562,7 +562,7 @@ int main(int argc, char *argv[])
|
|||||||
QmlStreamWriter qml(&bytes);
|
QmlStreamWriter qml(&bytes);
|
||||||
|
|
||||||
qml.writeStartDocument();
|
qml.writeStartDocument();
|
||||||
qml.writeLibraryImport(QLatin1String("QtQuick.tooling"), 1, 0);
|
qml.writeLibraryImport(QLatin1String("QtQuick.tooling"), 1, 1);
|
||||||
qml.write("\n"
|
qml.write("\n"
|
||||||
"// This file describes the plugin-supplied types contained in the library.\n"
|
"// This file describes the plugin-supplied types contained in the library.\n"
|
||||||
"// It is used for QML tooling purposes only.\n"
|
"// It is used for QML tooling purposes only.\n"
|
||||||
|
@@ -97,6 +97,16 @@ bool operator<=(const ComponentVersion &lhs, const ComponentVersion &rhs)
|
|||||||
|| (lhs.majorVersion() == rhs.majorVersion() && lhs.minorVersion() <= rhs.minorVersion());
|
|| (lhs.majorVersion() == rhs.majorVersion() && lhs.minorVersion() <= rhs.minorVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator>(const ComponentVersion &lhs, const ComponentVersion &rhs)
|
||||||
|
{
|
||||||
|
return rhs < lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator>=(const ComponentVersion &lhs, const ComponentVersion &rhs)
|
||||||
|
{
|
||||||
|
return rhs <= lhs;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const ComponentVersion &lhs, const ComponentVersion &rhs)
|
bool operator==(const ComponentVersion &lhs, const ComponentVersion &rhs)
|
||||||
{
|
{
|
||||||
return lhs.majorVersion() == rhs.majorVersion() && lhs.minorVersion() == rhs.minorVersion();
|
return lhs.majorVersion() == rhs.majorVersion() && lhs.minorVersion() == rhs.minorVersion();
|
||||||
|
@@ -62,6 +62,8 @@ public:
|
|||||||
|
|
||||||
bool LANGUAGEUTILS_EXPORT operator<(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
bool LANGUAGEUTILS_EXPORT operator<(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
||||||
bool LANGUAGEUTILS_EXPORT operator<=(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
bool LANGUAGEUTILS_EXPORT operator<=(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
||||||
|
bool LANGUAGEUTILS_EXPORT operator>(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
||||||
|
bool LANGUAGEUTILS_EXPORT operator>=(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
||||||
bool LANGUAGEUTILS_EXPORT operator==(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
bool LANGUAGEUTILS_EXPORT operator==(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
||||||
bool LANGUAGEUTILS_EXPORT operator!=(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
bool LANGUAGEUTILS_EXPORT operator!=(const ComponentVersion &lhs, const ComponentVersion &rhs);
|
||||||
|
|
||||||
|
@@ -114,8 +114,8 @@ void TypeDescriptionReader::readDocument(UiProgram *ast)
|
|||||||
version = ComponentVersion(versionString.left(dotIdx).toInt(),
|
version = ComponentVersion(versionString.left(dotIdx).toInt(),
|
||||||
versionString.mid(dotIdx + 1).toInt());
|
versionString.mid(dotIdx + 1).toInt());
|
||||||
}
|
}
|
||||||
if (version != ComponentVersion(1, 0)) {
|
if (version > ComponentVersion(1, 1)) {
|
||||||
addError(import->versionToken, "Expected version 1.0");
|
addError(import->versionToken, "Expected version 1.1 or higher");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,8 +144,8 @@ void TypeDescriptionReader::readModule(UiObjectDefinition *ast)
|
|||||||
UiObjectMember *member = it->member;
|
UiObjectMember *member = it->member;
|
||||||
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
|
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
|
||||||
if (!component || Bind::toString(component->qualifiedTypeNameId) != "Component") {
|
if (!component || Bind::toString(component->qualifiedTypeNameId) != "Component") {
|
||||||
addError(member->firstSourceLocation(), "Expected only 'Component' object definitions");
|
//addError(member->firstSourceLocation(), "Expected only 'Component' object definitions");
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
readComponent(component);
|
readComponent(component);
|
||||||
@@ -177,8 +177,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
|
|||||||
} else if (name == "Enum") {
|
} else if (name == "Enum") {
|
||||||
readEnum(component, fmo);
|
readEnum(component, fmo);
|
||||||
} else {
|
} else {
|
||||||
addError(component->firstSourceLocation(), "Expected only Property, Method, Signal and Enum object definitions");
|
//addError(component->firstSourceLocation(), "Expected only Property, Method, Signal and Enum object definitions");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else if (script) {
|
} else if (script) {
|
||||||
QString name = Bind::toString(script->qualifiedId);
|
QString name = Bind::toString(script->qualifiedId);
|
||||||
@@ -193,12 +192,10 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
|
|||||||
} else if (name == "attachedType") {
|
} else if (name == "attachedType") {
|
||||||
fmo->setAttachedTypeName(readStringBinding(script));
|
fmo->setAttachedTypeName(readStringBinding(script));
|
||||||
} else {
|
} else {
|
||||||
addError(script->firstSourceLocation(), "Expected only name, prototype, defaultProperty, attachedType and exports script bindings");
|
//addError(script->firstSourceLocation(), "Expected only name, prototype, defaultProperty, attachedType and exports script bindings");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addError(member->firstSourceLocation(), "Expected only script bindings and object definitions");
|
//addError(member->firstSourceLocation(), "Expected only script bindings and object definitions");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,8 +227,7 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM
|
|||||||
if (name == "Parameter") {
|
if (name == "Parameter") {
|
||||||
readParameter(component, &fmm);
|
readParameter(component, &fmm);
|
||||||
} else {
|
} else {
|
||||||
addError(component->firstSourceLocation(), "Expected only Parameter object definitions");
|
//addError(component->firstSourceLocation(), "Expected only Parameter object definitions");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else if (script) {
|
} else if (script) {
|
||||||
QString name = Bind::toString(script->qualifiedId);
|
QString name = Bind::toString(script->qualifiedId);
|
||||||
@@ -242,13 +238,11 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM
|
|||||||
} else if (name == "revision") {
|
} else if (name == "revision") {
|
||||||
fmm.setRevision(readIntBinding(script));
|
fmm.setRevision(readIntBinding(script));
|
||||||
} else {
|
} else {
|
||||||
addError(script->firstSourceLocation(), "Expected only name and type script bindings");
|
//addError(script->firstSourceLocation(), "Expected only name and type script bindings");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
addError(member->firstSourceLocation(), "Expected only script bindings and object definitions");
|
//addError(member->firstSourceLocation(), "Expected only script bindings and object definitions");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,8 +267,8 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject
|
|||||||
UiObjectMember *member = it->member;
|
UiObjectMember *member = it->member;
|
||||||
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
|
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
|
||||||
if (!script) {
|
if (!script) {
|
||||||
addError(member->firstSourceLocation(), "Expected script binding");
|
//addError(member->firstSourceLocation(), "Expected script binding");
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString id = Bind::toString(script->qualifiedId);
|
QString id = Bind::toString(script->qualifiedId);
|
||||||
@@ -291,8 +285,7 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject
|
|||||||
} else if (id == "revision") {
|
} else if (id == "revision") {
|
||||||
revision = readIntBinding(script);
|
revision = readIntBinding(script);
|
||||||
} else {
|
} else {
|
||||||
addError(script->firstSourceLocation(), "Expected only type, name, revision, isPointer, isReadonly and isList script bindings");
|
//addError(script->firstSourceLocation(), "Expected only type, name, revision, isPointer, isReadonly and isList script bindings");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,8 +305,8 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt
|
|||||||
UiObjectMember *member = it->member;
|
UiObjectMember *member = it->member;
|
||||||
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
|
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
|
||||||
if (!script) {
|
if (!script) {
|
||||||
addError(member->firstSourceLocation(), "Expected script binding");
|
//addError(member->firstSourceLocation(), "Expected script binding");
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString name = Bind::toString(script->qualifiedId);
|
QString name = Bind::toString(script->qualifiedId);
|
||||||
@@ -322,8 +315,7 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt
|
|||||||
} else if (name == "values") {
|
} else if (name == "values") {
|
||||||
readEnumValues(script, &fme);
|
readEnumValues(script, &fme);
|
||||||
} else {
|
} else {
|
||||||
addError(script->firstSourceLocation(), "Expected only name and values script bindings");
|
//addError(script->firstSourceLocation(), "Expected only name and values script bindings");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,8 +331,8 @@ void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMetho
|
|||||||
UiObjectMember *member = it->member;
|
UiObjectMember *member = it->member;
|
||||||
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
|
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
|
||||||
if (!script) {
|
if (!script) {
|
||||||
addError(member->firstSourceLocation(), "Expected script binding");
|
//addError(member->firstSourceLocation(), "Expected script binding");
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString id = Bind::toString(script->qualifiedId);
|
QString id = Bind::toString(script->qualifiedId);
|
||||||
@@ -355,8 +347,7 @@ void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMetho
|
|||||||
} else if (id == "isList") {
|
} else if (id == "isList") {
|
||||||
// ### unhandled
|
// ### unhandled
|
||||||
} else {
|
} else {
|
||||||
addError(script->firstSourceLocation(), "Expected only name and type script bindings");
|
//addError(script->firstSourceLocation(), "Expected only name and type script bindings");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user