Commit a7f78991 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Move commonly used functions to qmlutils.h.

Change-Id: I22376d96fe575bc00a55094c06af80e32a5587e6
Reviewed-on: http://codereview.qt-project.org/6238


Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 737aaf02
......@@ -34,7 +34,7 @@
#include "ui_contextpanewidgetrectangle.h"
#include "contextpanewidget.h"
#include <qmljs/qmljspropertyreader.h>
#include <qmljs/qmljscheck.h>
#include <qmljs/qmljsutils.h>
#include <customcolordialog.h>
#include <QtCore/QDebug>
......
......@@ -30,7 +30,8 @@ HEADERS += \
$$PWD/qmljsscopeastpath.h \
$$PWD/qmljsvalueowner.h \
$$PWD/qmljscontext.h \
$$PWD/qmljsscopechain.h
$$PWD/qmljsscopechain.h \
$$PWD/qmljsutils.h
SOURCES += \
$$PWD/qmljsbind.cpp \
......@@ -52,7 +53,8 @@ SOURCES += \
$$PWD/qmljsscopeastpath.cpp \
$$PWD/qmljsvalueowner.cpp \
$$PWD/qmljscontext.cpp \
$$PWD/qmljsscopechain.cpp
$$PWD/qmljsscopechain.cpp \
$$PWD/qmljsutils.cpp
RESOURCES += \
$$PWD/qmljs.qrc
......
......@@ -32,7 +32,7 @@
#include "parser/qmljsast_p.h"
#include "qmljsbind.h"
#include "qmljscheck.h"
#include "qmljsutils.h"
#include "qmljsdocument.h"
#include <languageutils/componentversion.h>
......@@ -141,20 +141,6 @@ ObjectValue *Bind::switchObjectValue(ObjectValue *newObjectValue)
return oldObjectValue;
}
QString Bind::toString(UiQualifiedId *qualifiedId, QChar delimiter)
{
QString result;
for (UiQualifiedId *iter = qualifiedId; iter; iter = iter->next) {
if (iter != qualifiedId)
result += delimiter;
result += iter->name;
}
return result;
}
ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer)
{
ObjectValue *parentObjectValue = 0;
......
......@@ -69,8 +69,6 @@ public:
ObjectValue *findAttachedJSScope(AST::Node *node) const;
bool isGroupedPropertyBinding(AST::Node *node) const;
static QString toString(AST::UiQualifiedId *qualifiedId, QChar delimiter = QChar('.'));
protected:
using AST::Visitor::visit;
......
......@@ -34,6 +34,7 @@
#include "qmljsbind.h"
#include "qmljscontext.h"
#include "qmljsevaluate.h"
#include "qmljsutils.h"
#include "parser/qmljsast_p.h"
#include <QtCore/QDebug>
......@@ -44,93 +45,6 @@
using namespace QmlJS;
using namespace QmlJS::AST;
QColor QmlJS::toQColor(const QString &qmlColorString)
{
QColor color;
if (qmlColorString.size() == 9 && qmlColorString.at(0) == QLatin1Char('#')) {
bool ok;
const int alpha = qmlColorString.mid(1, 2).toInt(&ok, 16);
if (ok) {
QString name(qmlColorString.at(0));
name.append(qmlColorString.right(6));
if (QColor::isValidColor(name)) {
color.setNamedColor(name);
color.setAlpha(alpha);
}
}
} else {
if (QColor::isValidColor(qmlColorString))
color.setNamedColor(qmlColorString);
}
return color;
}
SourceLocation QmlJS::locationFromRange(const SourceLocation &start,
const SourceLocation &end)
{
return SourceLocation(start.offset,
end.end() - start.begin(),
start.startLine,
start.startColumn);
}
SourceLocation QmlJS::fullLocationForQualifiedId(AST::UiQualifiedId *qualifiedId)
{
SourceLocation start = qualifiedId->identifierToken;
SourceLocation end = qualifiedId->identifierToken;
for (UiQualifiedId *iter = qualifiedId; iter; iter = iter->next) {
if (iter->identifierToken.isValid())
end = iter->identifierToken;
}
return locationFromRange(start, end);
}
DiagnosticMessage QmlJS::errorMessage(const AST::SourceLocation &loc, const QString &message)
{
return DiagnosticMessage(DiagnosticMessage::Error, loc, message);
}
namespace {
class SharedData
{
public:
SharedData()
{
validBuiltinPropertyNames.insert(QLatin1String("action"));
validBuiltinPropertyNames.insert(QLatin1String("bool"));
validBuiltinPropertyNames.insert(QLatin1String("color"));
validBuiltinPropertyNames.insert(QLatin1String("date"));
validBuiltinPropertyNames.insert(QLatin1String("double"));
validBuiltinPropertyNames.insert(QLatin1String("enumeration"));
validBuiltinPropertyNames.insert(QLatin1String("font"));
validBuiltinPropertyNames.insert(QLatin1String("int"));
validBuiltinPropertyNames.insert(QLatin1String("list"));
validBuiltinPropertyNames.insert(QLatin1String("point"));
validBuiltinPropertyNames.insert(QLatin1String("real"));
validBuiltinPropertyNames.insert(QLatin1String("rect"));
validBuiltinPropertyNames.insert(QLatin1String("size"));
validBuiltinPropertyNames.insert(QLatin1String("string"));
validBuiltinPropertyNames.insert(QLatin1String("time"));
validBuiltinPropertyNames.insert(QLatin1String("url"));
validBuiltinPropertyNames.insert(QLatin1String("var"));
validBuiltinPropertyNames.insert(QLatin1String("variant")); // obsolete in Qt 5
validBuiltinPropertyNames.insert(QLatin1String("vector3d"));
validBuiltinPropertyNames.insert(QLatin1String("alias"));
}
QSet<QString> validBuiltinPropertyNames;
};
} // anonymous namespace
Q_GLOBAL_STATIC(SharedData, sharedData)
bool QmlJS::isValidBuiltinPropertyType(const QString &name)
{
return sharedData()->validBuiltinPropertyNames.contains(name);
}
namespace {
class AssignmentCheck : public ValueVisitor
......@@ -666,7 +580,7 @@ void Check::endVisit(UiObjectInitializer *)
void Check::checkProperty(UiQualifiedId *qualifiedId)
{
const QString id = Bind::toString(qualifiedId);
const QString id = toString(qualifiedId);
if (id.at(0).isLower()) {
if (m_propertyStack.top().contains(id)) {
error(fullLocationForQualifiedId(qualifiedId),
......@@ -723,7 +637,7 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
dynamic_cast<const QmlPrototypeReference *>(lastPrototype->prototype())) {
error(typeErrorLocation,
Check::tr("could not resolve the prototype %1 of %2").arg(
Bind::toString(ref->qmlTypeName()), lastPrototype->className()));
toString(ref->qmlTypeName()), lastPrototype->className()));
} else {
error(typeErrorLocation,
Check::tr("could not resolve the prototype of %1").arg(
......
......@@ -151,27 +151,6 @@ private:
QStack<StringSet> m_propertyStack;
};
QMLJS_EXPORT QColor toQColor(const QString &qmlColorString);
QMLJS_EXPORT AST::SourceLocation locationFromRange(const AST::SourceLocation &start,
const AST::SourceLocation &end);
QMLJS_EXPORT AST::SourceLocation fullLocationForQualifiedId(AST::UiQualifiedId *);
QMLJS_EXPORT DiagnosticMessage errorMessage(const AST::SourceLocation &loc,
const QString &message);
QMLJS_EXPORT bool isValidBuiltinPropertyType(const QString &name);
template <class T>
DiagnosticMessage errorMessage(const T *node, const QString &message)
{
return DiagnosticMessage(DiagnosticMessage::Error,
locationFromRange(node->firstSourceLocation(),
node->lastSourceLocation()),
message);
}
} // namespace QmlJS
#endif // QMLJSCHECK_H
......@@ -31,6 +31,7 @@
**************************************************************************/
#include "qmljsdelta.h"
#include "qmljsutils.h"
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/parser/qmljsastvisitor_p.h>
......@@ -168,14 +169,8 @@ struct Map {
static QList<UiObjectMember *> children(UiObjectMember *ast)
{
QList<UiObjectMember *> ret;
if (UiObjectDefinition* foo = cast<UiObjectDefinition *>(ast)) {
UiObjectMemberList* list = foo->initializer->members;
while (list) {
ret.append(list->member);
list = list->next;
}
} else if(UiObjectBinding *foo = cast<UiObjectBinding *>(ast)) {
UiObjectMemberList* list = foo->initializer->members;
if (UiObjectInitializer * foo = QmlJS::initializerOfObject(ast)) {
UiObjectMemberList* list = foo->members;
while (list) {
ret.append(list->member);
list = list->next;
......@@ -308,10 +303,8 @@ static QString _methodName(UiSourceElement *source)
static UiObjectMemberList *objectMembers(UiObjectMember *object)
{
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(object))
return def->initializer->members;
else if (UiObjectBinding *binding = cast<UiObjectBinding *>(object))
return binding->initializer->members;
if (UiObjectInitializer *init = QmlJS::initializerOfObject(object))
return init->members;
return 0;
}
......
......@@ -35,7 +35,7 @@
#include "parser/qmljsast_p.h"
#include "qmljsdocument.h"
#include "qmljsbind.h"
#include "qmljscheck.h"
#include "qmljsutils.h"
#include "qmljsmodelmanagerinterface.h"
#include <QtCore/QFileInfo>
......@@ -94,8 +94,6 @@ public:
QHash<QString, QList<DiagnosticMessage> > *allDiagnosticMessages;
static AST::UiQualifiedId *qualifiedTypeNameId(AST::Node *node);
Context::ImportsPerDocument linkImports();
void populateImportedTypes(Imports *imports, Document::Ptr doc);
......@@ -446,16 +444,6 @@ bool LinkPrivate::importLibrary(Document::Ptr doc,
return true;
}
UiQualifiedId *LinkPrivate::qualifiedTypeNameId(Node *node)
{
if (UiObjectBinding *binding = AST::cast<UiObjectBinding *>(node))
return binding->qualifiedTypeNameId;
else if (UiObjectDefinition *binding = AST::cast<UiObjectDefinition *>(node))
return binding->qualifiedTypeNameId;
else
return 0;
}
void LinkPrivate::error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message)
{
appendDiagnostic(doc, DiagnosticMessage(DiagnosticMessage::Error, loc, message));
......
......@@ -85,7 +85,7 @@ public:
// whether trying to run qmldump makes sense
bool tryQmlDump;
QString qmlDumpPath;
Utils::Environment qmlDumpEnvironment;
::Utils::Environment qmlDumpEnvironment;
QString qtImportsPath;
QString qtVersionString;
......
......@@ -33,7 +33,7 @@
#include "qmljspropertyreader.h"
#include "qmljsdocument.h"
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljscheck.h>
#include <qmljs/qmljsutils.h>
#include <QtGui/QLinearGradient>
......@@ -126,22 +126,6 @@ static inline int propertyType(const QString &typeName)
return -1;
}
static inline QString flatten(UiQualifiedId *qualifiedId)
{
QString result;
for (UiQualifiedId *iter = qualifiedId; iter; iter = iter->next) {
if (iter->name.isEmpty())
continue;
if (!result.isEmpty())
result.append(QLatin1Char('.'));
result.append(iter->name);
}
return result;
}
static bool isEnum(AST::Statement *ast);
bool isEnum(AST::ExpressionNode *ast)
......@@ -192,7 +176,7 @@ PropertyReader::PropertyReader(Document::Ptr doc, AST::UiObjectInitializer *ast)
if (UiScriptBinding *property = AST::cast<UiScriptBinding *>(member)) {
if (!property->qualifiedId)
continue; // better safe than sorry.
const QString propertyName = flatten(property->qualifiedId);
const QString propertyName = toString(property->qualifiedId);
const QString astValue = cleanupSemicolon(textAt(doc,
property->statement->firstSourceLocation(),
property->statement->lastSourceLocation()));
......@@ -208,7 +192,7 @@ PropertyReader::PropertyReader(Document::Ptr doc, AST::UiObjectInitializer *ast)
for (UiObjectMemberList *iter = objectDefinition->initializer->members; iter; iter = iter->next) {
UiObjectMember *objectMember = iter->member;
if (UiScriptBinding *property = cast<UiScriptBinding *>(objectMember)) {
const QString propertyNamePart2 = flatten(property->qualifiedId);
const QString propertyNamePart2 = toString(property->qualifiedId);
const QString astValue = cleanupSemicolon(textAt(doc,
property->statement->firstSourceLocation(),
property->statement->lastSourceLocation()));
......
......@@ -34,6 +34,7 @@
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/parser/qmljsengine_p.h>
#include <qmljs/qmljsutils.h>
#include <utils/changeset.h>
// ### FIXME: remove these includes:
......@@ -160,11 +161,11 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
if (cast<UiObjectDefinition*>(member))
lastObjectDef = iter;
else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
idx = propertyOrder.indexOf(flatten(arrayBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId));
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
idx = propertyOrder.indexOf(flatten(objectBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId));
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
idx = propertyOrder.indexOf(flatten(scriptBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId));
else if (cast<UiPublicMember*>(member))
idx = propertyOrder.indexOf(QLatin1String("property"));
......@@ -193,11 +194,11 @@ UiArrayMemberList *Rewriter::searchMemberToInsertAfter(UiArrayMemberList *member
if (cast<UiObjectDefinition*>(member))
lastObjectDef = iter;
else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
idx = propertyOrder.indexOf(flatten(arrayBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId));
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
idx = propertyOrder.indexOf(flatten(objectBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId));
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
idx = propertyOrder.indexOf(flatten(scriptBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId));
else if (cast<UiPublicMember*>(member))
idx = propertyOrder.indexOf(QLatin1String("property"));
......@@ -224,13 +225,13 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
UiObjectMember *member = iter->member;
if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
orderedMembers[flatten(arrayBinding->qualifiedId)] = iter;
orderedMembers[toString(arrayBinding->qualifiedId)] = iter;
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
orderedMembers[flatten(objectBinding->qualifiedId)] = iter;
orderedMembers[toString(objectBinding->qualifiedId)] = iter;
else if (cast<UiObjectDefinition*>(member))
orderedMembers[QString::null] = iter;
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
orderedMembers[flatten(scriptBinding->qualifiedId)] = iter;
orderedMembers[toString(scriptBinding->qualifiedId)] = iter;
else if (cast<UiPublicMember*>(member))
orderedMembers[QLatin1String("property")] = iter;
}
......@@ -251,20 +252,6 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
return 0;
}
QString Rewriter::flatten(UiQualifiedId *first)
{
QString flatId;
for (UiQualifiedId* current = first; current; current = current->next) {
if (current != first)
flatId += '.';
flatId += current->name;
}
return flatId;
}
void Rewriter::changeBinding(UiObjectInitializer *ast,
const QString &propertyName,
const QString &newValue,
......@@ -304,7 +291,7 @@ void Rewriter::changeBinding(UiObjectInitializer *ast,
// for grouped properties:
else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (flatten(def->qualifiedTypeNameId) == prefix) {
if (toString(def->qualifiedTypeNameId) == prefix) {
changeBinding(def->initializer, suffix, newValue, binding);
}
}
......@@ -358,11 +345,11 @@ bool Rewriter::isMatchingPropertyMember(const QString &propertyName,
if (UiPublicMember *publicMember = cast<UiPublicMember*>(member))
return publicMember->name == propertyName;
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
return flatten(objectBinding->qualifiedId) == propertyName;
return toString(objectBinding->qualifiedId) == propertyName;
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
return flatten(scriptBinding->qualifiedId) == propertyName;
return toString(scriptBinding->qualifiedId) == propertyName;
else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
return flatten(arrayBinding->qualifiedId) == propertyName;
return toString(arrayBinding->qualifiedId) == propertyName;
else
return false;
}
......@@ -410,7 +397,7 @@ void Rewriter::removeBindingByName(UiObjectInitializer *ast, const QString &prop
// check for grouped properties:
else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (flatten(def->qualifiedTypeNameId) == prefix) {
if (toString(def->qualifiedTypeNameId) == prefix) {
removeGroupedProperty(def, propertyName);
}
}
......@@ -558,11 +545,11 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
if (cast<UiObjectDefinition*>(member))
lastObjectDef = iter;
else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
idx = propertyOrder.indexOf(flatten(arrayBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId));
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
idx = propertyOrder.indexOf(flatten(objectBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId));
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
idx = propertyOrder.indexOf(flatten(scriptBinding->qualifiedId));
idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId));
else if (cast<UiPublicMember*>(member))
idx = propertyOrder.indexOf(QLatin1String("property"));
......@@ -587,13 +574,13 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
UiObjectMember *member = iter->member;
if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
orderedMembers[flatten(arrayBinding->qualifiedId)] = iter;
orderedMembers[toString(arrayBinding->qualifiedId)] = iter;
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
orderedMembers[flatten(objectBinding->qualifiedId)] = iter;
orderedMembers[toString(objectBinding->qualifiedId)] = iter;
else if (cast<UiObjectDefinition*>(member))
orderedMembers[QString::null] = iter;
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
orderedMembers[flatten(scriptBinding->qualifiedId)] = iter;
orderedMembers[toString(scriptBinding->qualifiedId)] = iter;
else if (cast<UiPublicMember*>(member))
orderedMembers[QLatin1String("property")] = iter;
}
......
......@@ -88,7 +88,6 @@ public:
static AST::UiObjectMemberList *searchMemberToInsertAfter(AST::UiObjectMemberList *members, const QStringList &propertyOrder);
static AST::UiArrayMemberList *searchMemberToInsertAfter(AST::UiArrayMemberList *members, const QStringList &propertyOrder);
static AST::UiObjectMemberList *searchMemberToInsertAfter(AST::UiObjectMemberList *members, const QString &propertyName, const QStringList &propertyOrder);
static QString flatten(AST::UiQualifiedId *first);
static bool includeSurroundingWhitespace(const QString &source, int &start, int &end);
static void includeLeadingEmptyLine(const QString &source, int &start);
......
......@@ -36,6 +36,7 @@
#include "qmljscontext.h"
#include "qmljsevaluate.h"
#include "qmljsscopechain.h"
#include "qmljsutils.h"
#include "parser/qmljsast_p.h"
#include <utils/qtcassert.h>
......@@ -174,11 +175,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
prototype = isPropertyChangesObject(_scopeChain->context(), prototype);
// find the target script binding
if (prototype) {
UiObjectInitializer *initializer = 0;
if (UiObjectDefinition *definition = cast<UiObjectDefinition *>(node))
initializer = definition->initializer;
if (UiObjectBinding *binding = cast<UiObjectBinding *>(node))
initializer = binding->initializer;
UiObjectInitializer *initializer = initializerOfObject(node);
if (initializer) {
for (UiObjectMemberList *m = initializer->members; m; m = m->next) {
if (UiScriptBinding *scriptBinding = cast<UiScriptBinding *>(m->member)) {
......
......@@ -40,6 +40,7 @@
#include "qmljsbind.h"
#include "qmljsinterpreter.h"
#include "qmljsutils.h"
#include <QtCore/QIODevice>
#include <QtCore/QBuffer>
......@@ -104,7 +105,7 @@ void TypeDescriptionReader::readDocument(UiProgram *ast)
}
UiImport *import = ast->imports->import;
if (Bind::toString(import->importUri) != QLatin1String("QtQuick.tooling")) {
if (toString(import->importUri) != QLatin1String("QtQuick.tooling")) {
addError(import->importToken, "Expected import of QtQuick.tooling");
return;
}
......@@ -132,7 +133,7 @@ void TypeDescriptionReader::readDocument(UiProgram *ast)
return;
}
if (Bind::toString(module->qualifiedTypeNameId) != "Module") {
if (toString(module->qualifiedTypeNameId) != "Module") {
addError(SourceLocation(), "Expected document to contain a Module {} member");
return;
}
......@@ -145,7 +146,7 @@ void TypeDescriptionReader::readModule(UiObjectDefinition *ast)
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
if (!component || Bind::toString(component->qualifiedTypeNameId) != "Component") {
if (!component || toString(component->qualifiedTypeNameId) != "Component") {
addWarning(member->firstSourceLocation(), "Expected only 'Component' object definitions");
continue;
}
......@@ -179,7 +180,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (component) {
QString name = Bind::toString(component->qualifiedTypeNameId);
QString name = toString(component->qualifiedTypeNameId);
if (name == "Property") {
readProperty(component, fmo);
} else if (name == "Method" || name == "Signal") {
......@@ -190,7 +191,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
addWarning(component->firstSourceLocation(), "Expected only Property, Method, Signal and Enum object definitions");
}
} else if (script) {
QString name = Bind::toString(script->qualifiedId);
QString name = toString(script->qualifiedId);
if (name == "name") {
fmo->setClassName(readStringBinding(script));
} else if (name == "prototype") {
......@@ -237,14 +238,14 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (component) {
QString name = Bind::toString(component->qualifiedTypeNameId);
QString name = toString(component->qualifiedTypeNameId);
if (name == "Parameter") {
readParameter(component, &fmm);
} else {
addWarning(component->firstSourceLocation(), "Expected only Parameter object definitions");
}
} else if (script) {
QString name = Bind::toString(script->qualifiedId);
QString name = toString(script->qualifiedId);
if (name == "name") {
fmm.setMethodName(readStringBinding(script));
} else if (name == "type") {
......@@ -285,7 +286,7 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject
continue;
}
QString id = Bind::toString(script->qualifiedId);
QString id = toString(script->qualifiedId);
if (id == "name") {
name = readStringBinding(script);
} else if (id == "type") {
......@@ -323,7 +324,7 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt
continue;
}
QString name = Bind::toString(script->qualifiedId);
QString name = toString(script->qualifiedId);
if (name == "name") {
fme.setName(readStringBinding(script));
} else if