diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-22 07:26:45 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-22 07:26:45 (GMT) |
commit | 6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930 (patch) | |
tree | 31616634bec2095cf16e82df9109cd6beda59460 /src/declarative/qml/qmlscriptparser.cpp | |
parent | c4c12f947b0480fd0695e1885ebec9ab496f6bf4 (diff) | |
download | Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.zip Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.tar.gz Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.tar.bz2 |
Preliminary support for object and list synthesized property types
Diffstat (limited to 'src/declarative/qml/qmlscriptparser.cpp')
-rw-r--r-- | src/declarative/qml/qmlscriptparser.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 136b247..09efc90 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -524,6 +524,32 @@ bool ProcessAST::visit(AST::UiPublicMember *node) } } + if (!typeFound && memberType.at(0).isUpper()) { + QString typemodifier; + if(node->typeModifier) + typemodifier = node->typeModifier->asString(); + if (typemodifier == QString()) { + type = Object::DynamicProperty::Custom; + } else if(typemodifier == QLatin1String("list")) { + type = Object::DynamicProperty::CustomList; + } else { + QmlError error; + error.setDescription(QCoreApplication::translate("QmlParser","Invalid property type modifier")); + error.setLine(node->typeModifierToken.startLine); + error.setColumn(node->typeModifierToken.startColumn); + _parser->_errors << error; + return false; + } + typeFound = true; + } else if (node->typeModifier) { + QmlError error; + error.setDescription(QCoreApplication::translate("QmlParser","Unexpected property type modifier")); + error.setLine(node->typeModifierToken.startLine); + error.setColumn(node->typeModifierToken.startColumn); + _parser->_errors << error; + return false; + } + if(!typeFound) { QmlError error; error.setDescription(QCoreApplication::translate("QmlParser","Expected property type")); @@ -545,6 +571,12 @@ bool ProcessAST::visit(AST::UiPublicMember *node) Object::DynamicProperty property; property.isDefaultProperty = node->isDefaultMember; property.type = type; + if (type >= Object::DynamicProperty::Custom) { + QmlScriptParser::TypeReference *typeRef = + _parser->findOrCreateType(memberType); + typeRef->refObjects.append(_stateStack.top().object); + property.customType = memberType.toUtf8(); + } property.name = name.toUtf8(); property.location = location(node->firstSourceLocation(), node->lastSourceLocation()); |