diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-08-08 12:47:49 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-08-08 13:21:28 +0200 |
commit | 0e54183d4d31dc34fc742503c6e0956dd1737133 (patch) | |
tree | 5afeed4c2c52fa17314369e59cdcf034139c43a7 /src/plugins/qmldesigner | |
parent | ff092f79b33e48847c7a475eb7362ffb9649aa49 (diff) | |
download | qt-creator-0e54183d4d31dc34fc742503c6e0956dd1737133.tar.gz |
QmlJS: Remove Interpreter namespace.
The distinction between QmlJS and QmlJS::Interpreter has always been
weak and the extra namespace just added an unnecessary complication.
Change-Id: I4db8ef4bd91b5f6bf610a9d23fdbf55bd60250fc
Reviewed-on: http://codereview.qt.nokia.com/2743
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
Diffstat (limited to 'src/plugins/qmldesigner')
6 files changed, 95 insertions, 97 deletions
diff --git a/src/plugins/qmldesigner/designercore/include/rewriterview.h b/src/plugins/qmldesigner/designercore/include/rewriterview.h index 88ac534c1e..d4ee5cccb2 100644 --- a/src/plugins/qmldesigner/designercore/include/rewriterview.h +++ b/src/plugins/qmldesigner/designercore/include/rewriterview.h @@ -51,10 +51,8 @@ namespace QmlJS { class DiagnosticMessage; class LookupContext; class Document; -namespace Interpreter { class ScopeChain; } -} namespace QmlDesigner { @@ -189,7 +187,7 @@ public: bool renameId(const QString& oldId, const QString& newId); - const QmlJS::Interpreter::ScopeChain &scopeChain() const; + const QmlJS::ScopeChain &scopeChain() const; QmlJS::Document *document() const; QString convertTypeToImportAlias(const QString &type) const; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 561b4e782c..5f348bb204 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -91,23 +91,23 @@ using namespace QmlJS; typedef QPair<QString, QString> PropertyInfo; -class PropertyMemberProcessor : public Interpreter::MemberProcessor +class PropertyMemberProcessor : public MemberProcessor { public: - virtual bool processProperty(const QString &name, const Interpreter::Value *value) + virtual bool processProperty(const QString &name, const Value *value) { - const Interpreter::ASTPropertyReference *ref = dynamic_cast<const Interpreter::ASTPropertyReference*>(value); + const ASTPropertyReference *ref = dynamic_cast<const ASTPropertyReference*>(value); if (ref) { QString type = "unknown"; if (ref->ast()->memberType) type = ref->ast()->memberType->asString(); m_properties.append(qMakePair(name, type)); } else { - if (const Interpreter::QmlObjectValue * ov = dynamic_cast<const Interpreter::QmlObjectValue *>(value)) { + if (const QmlObjectValue * ov = dynamic_cast<const QmlObjectValue *>(value)) { QString qualifiedTypeName = ov->packageName().isEmpty() ? ov->className() : ov->packageName() + '.' + ov->className(); m_properties.append(qMakePair(name, qualifiedTypeName)); } else { - Interpreter::TypeId typeId; + TypeId typeId; QString typeName = typeId(value); if (typeName == QLatin1String("number")) { if (value->asRealValue()) { @@ -135,26 +135,26 @@ static inline bool isValueType(const QString &type) return objectValuesList.contains(type); } -const Interpreter::QmlObjectValue *findQmlPrototype(const Interpreter::ObjectValue *ov, const Interpreter::ContextPtr &context) +const QmlObjectValue *findQmlPrototype(const ObjectValue *ov, const ContextPtr &context) { if (!ov) return 0; - const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov); + const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(ov); if (qmlValue) return qmlValue; return findQmlPrototype(ov->prototype(context), context); } -QStringList prototypes(const Interpreter::ObjectValue *ov, const Interpreter::ContextPtr &context, bool versions = false) +QStringList prototypes(const ObjectValue *ov, const ContextPtr &context, bool versions = false) { QStringList list; if (!ov) return list; ov = ov->prototype(context); while (ov) { - const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov); + const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(ov); if (qmlValue) { if (versions) { list << qmlValue->packageName() + '.' + qmlValue->className() + @@ -175,9 +175,9 @@ QStringList prototypes(const Interpreter::ObjectValue *ov, const Interpreter::Co return list; } -QList<PropertyInfo> getObjectTypes(const Interpreter::ObjectValue *ov, const Interpreter::ContextPtr &context, bool local = false); +QList<PropertyInfo> getObjectTypes(const ObjectValue *ov, const ContextPtr &context, bool local = false); -QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, const Interpreter::ContextPtr &context, bool local = false) +QList<PropertyInfo> getQmlTypes(const QmlObjectValue *ov, const ContextPtr &context, bool local = false) { QList<PropertyInfo> list; if (!ov) @@ -192,7 +192,7 @@ QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, const Int QString name = property.first; if (!ov->isWritable(name) && ov->isPointer(name)) { //dot property - const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov->lookupMember(name, context)); + const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(ov->lookupMember(name, context)); if (qmlValue) { QList<PropertyInfo> dotProperties = getQmlTypes(qmlValue, context); foreach (const PropertyInfo &propertyInfo, dotProperties) { @@ -204,7 +204,7 @@ QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, const Int } } if (isValueType(ov->propertyType(name))) { - const Interpreter::ObjectValue *dotObjectValue = dynamic_cast<const Interpreter::ObjectValue *>(ov->lookupMember(name, context)); + const ObjectValue *dotObjectValue = dynamic_cast<const ObjectValue *>(ov->lookupMember(name, context)); if (dotObjectValue) { QList<PropertyInfo> dotProperties = getObjectTypes(dotObjectValue, context); foreach (const PropertyInfo &propertyInfo, dotProperties) { @@ -222,9 +222,9 @@ QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, const Int } if (!local) { - const Interpreter::ObjectValue* prototype = ov->prototype(context); + const ObjectValue* prototype = ov->prototype(context); - const Interpreter::QmlObjectValue * qmlObjectValue = dynamic_cast<const Interpreter::QmlObjectValue *>(prototype); + const QmlObjectValue * qmlObjectValue = dynamic_cast<const QmlObjectValue *>(prototype); if (qmlObjectValue) { list << getQmlTypes(qmlObjectValue, context); @@ -236,11 +236,11 @@ QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, const Int return list; } -QList<PropertyInfo> getTypes(const Interpreter::ObjectValue *ov, const Interpreter::ContextPtr &context, bool local = false) +QList<PropertyInfo> getTypes(const ObjectValue *ov, const ContextPtr &context, bool local = false) { QList<PropertyInfo> list; - const Interpreter::QmlObjectValue * qmlObjectValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov); + const QmlObjectValue * qmlObjectValue = dynamic_cast<const QmlObjectValue *>(ov); if (qmlObjectValue) { list << getQmlTypes(qmlObjectValue, context, local); @@ -251,7 +251,7 @@ QList<PropertyInfo> getTypes(const Interpreter::ObjectValue *ov, const Interpret return list; } -QList<PropertyInfo> getObjectTypes(const Interpreter::ObjectValue *ov, const Interpreter::ContextPtr &context, bool local) +QList<PropertyInfo> getObjectTypes(const ObjectValue *ov, const ContextPtr &context, bool local) { QList<PropertyInfo> list; if (!ov) @@ -262,9 +262,9 @@ QList<PropertyInfo> getObjectTypes(const Interpreter::ObjectValue *ov, const Int list << processor.properties(); if (!local) { - const Interpreter::ObjectValue* prototype = ov->prototype(context); + const ObjectValue* prototype = ov->prototype(context); - const Interpreter::QmlObjectValue * qmlObjectValue = dynamic_cast<const Interpreter::QmlObjectValue *>(prototype); + const QmlObjectValue * qmlObjectValue = dynamic_cast<const QmlObjectValue *>(prototype); if (qmlObjectValue) { list << getQmlTypes(qmlObjectValue, context); @@ -358,13 +358,13 @@ public: private: NodeMetaInfoPrivate(Model *model, QString type, int maj = -1, int min = -1); - const QmlJS::Interpreter::QmlObjectValue *getQmlObjectValue() const; - const QmlJS::Interpreter::ObjectValue *getObjectValue() const; + const QmlJS::QmlObjectValue *getQmlObjectValue() const; + const QmlJS::ObjectValue *getObjectValue() const; void setupPropertyInfo(QList<PropertyInfo> propertyInfos); void setupLocalPropertyInfo(QList<PropertyInfo> propertyInfos); QString lookupName() const; QStringList lookupNameComponent() const; - const QmlJS::Interpreter::QmlObjectValue *getNearestQmlObjectValue() const; + const QmlJS::QmlObjectValue *getNearestQmlObjectValue() const; QString fullQualifiedImportAliasType() const; QString m_qualfiedTypeName; @@ -381,7 +381,7 @@ private: QSet<QString> m_prototypeCacheNegatives; //storing the pointer would not be save - QmlJS::Interpreter::ContextPtr context() const; + QmlJS::ContextPtr context() const; QmlJS::Document *document() const; QPointer<Model> m_model; @@ -424,7 +424,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in m_model(model) { if (context()) { - const Interpreter::QmlObjectValue *objectValue = getQmlObjectValue(); + const QmlObjectValue *objectValue = getQmlObjectValue(); if (objectValue) { setupPropertyInfo(getTypes(objectValue, context())); setupLocalPropertyInfo(getTypes(objectValue, context(), true)); @@ -432,9 +432,9 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in setupPrototypes(); m_isValid = true; } else { - const Interpreter::ObjectValue *objectValue = getObjectValue(); + const ObjectValue *objectValue = getObjectValue(); if (objectValue) { - const Interpreter::QmlObjectValue *qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(objectValue); + const QmlObjectValue *qmlValue = dynamic_cast<const QmlObjectValue *>(objectValue); if (qmlValue) { m_majorVersion = qmlValue->version().majorVersion(); m_minorVersion = qmlValue->version().minorVersion(); @@ -464,9 +464,9 @@ static inline QString getUrlFromType(const QString& typeName) return result; } -const QmlJS::Interpreter::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue() const +const QmlJS::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue() const { - QmlJS::Interpreter::QmlObjectValue * value = context()->valueOwner()->cppQmlTypes().typeByQualifiedName(lookupName()); + QmlJS::QmlObjectValue * value = context()->valueOwner()->cppQmlTypes().typeByQualifiedName(lookupName()); if (value) return value; @@ -490,14 +490,14 @@ const QmlJS::Interpreter::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue LanguageUtils::ComponentVersion version(9999, 9999); //get the correct version - Interpreter::ImportInfo importInfo = context()->imports(document())->info(fullQualifiedImportAliasType(), context().data()); + ImportInfo importInfo = context()->imports(document())->info(fullQualifiedImportAliasType(), context().data()); if (importInfo.isValid()) version = importInfo.version(); - QList<Interpreter::QmlObjectValue *> qmlObjectValues = context()->valueOwner()->cppQmlTypes().typesForImport(package, version); - const Interpreter::QmlObjectValue *qmlValue = 0; - foreach (Interpreter::QmlObjectValue *value, qmlObjectValues) { + QList<QmlObjectValue *> qmlObjectValues = context()->valueOwner()->cppQmlTypes().typesForImport(package, version); + const QmlObjectValue *qmlValue = 0; + foreach (QmlObjectValue *value, qmlObjectValues) { if (value->className() == type) qmlValue = value; } @@ -521,17 +521,17 @@ const QmlJS::Interpreter::QmlObjectValue *NodeMetaInfoPrivate::getQmlObjectValue return qmlValue; } -const QmlJS::Interpreter::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const +const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const { return context()->lookupType(document(), lookupNameComponent()); } -QmlJS::Interpreter::ContextPtr NodeMetaInfoPrivate::context() const +QmlJS::ContextPtr NodeMetaInfoPrivate::context() const { if (m_model && m_model->rewriterView()) { return m_model->rewriterView()->scopeChain().context(); } - return QmlJS::Interpreter::ContextPtr(0); + return QmlJS::ContextPtr(0); } QmlJS::Document *NodeMetaInfoPrivate::document() const @@ -579,7 +579,7 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const QString &propertyName) const return true; } - const QmlJS::Interpreter::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const QmlJS::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); if (!qmlObjectValue) return true; if (qmlObjectValue->hasProperty(propertyName)) @@ -611,7 +611,7 @@ bool NodeMetaInfoPrivate::isPropertyList(const QString &propertyName) const return true; } - const QmlJS::Interpreter::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const QmlJS::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); if (!qmlObjectValue) return false; return qmlObjectValue->isListProperty(propertyName); @@ -639,7 +639,7 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const QString &propertyName) const return true; } - const QmlJS::Interpreter::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); + const QmlJS::QmlObjectValue *qmlObjectValue = getNearestQmlObjectValue(); if (!qmlObjectValue) return false; return qmlObjectValue->isPointer(propertyName); @@ -667,12 +667,12 @@ bool NodeMetaInfoPrivate::isPropertyEnum(const QString &propertyName) const return false; } - QList<const Interpreter::ObjectValue *> objects; - objects = Interpreter::PrototypeIterator(getNearestQmlObjectValue(), context()).all(); + QList<const ObjectValue *> objects; + objects = PrototypeIterator(getNearestQmlObjectValue(), context()).all(); //We have to run the prototype chain - foreach (const Interpreter::ObjectValue *ov, objects) { - if (const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov)) { + foreach (const ObjectValue *ov, objects) { + if (const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(ov)) { if (qmlValue->getEnum(propertyType(propertyName)).isValid()) return true; } @@ -703,12 +703,12 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const QString &propertyName) cons return QString(); } - QList<const Interpreter::ObjectValue *> objects; - objects = Interpreter::PrototypeIterator(getNearestQmlObjectValue(), context()).all(); + QList<const ObjectValue *> objects; + objects = PrototypeIterator(getNearestQmlObjectValue(), context()).all(); //We have to run the prototype chain - foreach (const Interpreter::ObjectValue *ov, objects) { - if (const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov)) { + foreach (const ObjectValue *ov, objects) { + if (const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(ov)) { if (qmlValue->getEnum(propertyType(propertyName)).isValid()) return qmlValue->className(); } @@ -797,7 +797,7 @@ QString NodeMetaInfoPrivate::packageName() const QString NodeMetaInfoPrivate::componentSource() const { if (isComponent()) { - const Interpreter::ASTObjectValue * astObjectValue = dynamic_cast<const Interpreter::ASTObjectValue *>(getObjectValue()); + const ASTObjectValue * astObjectValue = dynamic_cast<const ASTObjectValue *>(getObjectValue()); if (astObjectValue) return astObjectValue->document()->source().mid(astObjectValue->typeName()->identifierToken.begin(), astObjectValue->initializer()->rbraceToken.end()); @@ -808,7 +808,7 @@ QString NodeMetaInfoPrivate::componentSource() const QString NodeMetaInfoPrivate::componentFileName() const { if (isComponent()) { - const Interpreter::ASTObjectValue * astObjectValue = dynamic_cast<const Interpreter::ASTObjectValue *>(getObjectValue()); + const ASTObjectValue * astObjectValue = dynamic_cast<const ASTObjectValue *>(getObjectValue()); if (astObjectValue) { QString fileName; int line; @@ -832,7 +832,7 @@ QString NodeMetaInfoPrivate::lookupName() const packageName = packageClassName.join(QLatin1String(".")); } - return Interpreter::CppQmlTypes::qualifiedName( + return CppQmlTypes::qualifiedName( packageName, className, LanguageUtils::ComponentVersion(m_majorVersion, m_minorVersion)); @@ -859,17 +859,17 @@ QString NodeMetaInfoPrivate::propertyType(const QString &propertyName) const void NodeMetaInfoPrivate::setupPrototypes() { - QList<const Interpreter::ObjectValue *> objects; + QList<const ObjectValue *> objects; if (m_isComponent) - objects = Interpreter::PrototypeIterator(getObjectValue(), context()).all(); + objects = PrototypeIterator(getObjectValue(), context()).all(); else - objects = Interpreter::PrototypeIterator(getQmlObjectValue(), context()).all(); - foreach (const Interpreter::ObjectValue *ov, objects) { + objects = PrototypeIterator(getQmlObjectValue(), context()).all(); + foreach (const ObjectValue *ov, objects) { TypeDescription description; description.className = ov->className(); description.minorVersion = -1; description.majorVersion = -1; - if (const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov)) { + if (const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(ov)) { description.minorVersion = qmlValue->version().minorVersion(); description.majorVersion = qmlValue->version().majorVersion(); if (!qmlValue->packageName().isEmpty()) @@ -888,7 +888,7 @@ QList<TypeDescription> NodeMetaInfoPrivate::prototypes() const return m_prototypes; } -const QmlJS::Interpreter::QmlObjectValue *NodeMetaInfoPrivate::getNearestQmlObjectValue() const +const QmlJS::QmlObjectValue *NodeMetaInfoPrivate::getNearestQmlObjectValue() const { if (m_isComponent) return findQmlPrototype(getObjectValue(), context()); diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index 095135a0f7..e3e5f7b6e1 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -624,7 +624,7 @@ bool RewriterView::renameId(const QString& oldId, const QString& newId) return false; } -const QmlJS::Interpreter::ScopeChain &RewriterView::scopeChain() const +const QmlJS::ScopeChain &RewriterView::scopeChain() const { return textToModelMerger()->scopeChain(); } diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index eab0799b90..110cdd5fe0 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -357,10 +357,10 @@ public: void lookup(UiQualifiedId *astTypeNode, QString &typeName, int &majorVersion, int &minorVersion, QString &defaultPropertyName) { - const Interpreter::ObjectValue *value = m_context->lookupType(m_doc.data(), astTypeNode); + const ObjectValue *value = m_context->lookupType(m_doc.data(), astTypeNode); defaultPropertyName = m_context->defaultPropertyName(value); - const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(value); + const QmlObjectValue * qmlValue = dynamic_cast<const QmlObjectValue *>(value); if (qmlValue) { typeName = fixUpPackeNameForQt(qmlValue->packageName()) + QLatin1String(".") + qmlValue->className(); @@ -383,14 +383,14 @@ public: majorVersion = ComponentVersion::NoVersion; minorVersion = ComponentVersion::NoVersion; - const Interpreter::Imports *imports = m_context->imports(m_doc.data()); - Interpreter::ImportInfo importInfo = imports->info(fullTypeName, m_context.data()); - if (importInfo.isValid() && importInfo.type() == Interpreter::ImportInfo::LibraryImport) { + const Imports *imports = m_context->imports(m_doc.data()); + ImportInfo importInfo = imports->info(fullTypeName, m_context.data()); + if (importInfo.isValid() && importInfo.type() == ImportInfo::LibraryImport) { QString name = importInfo.name().replace("\\", "."); majorVersion = importInfo.version().majorVersion(); minorVersion = importInfo.version().minorVersion(); typeName.prepend(name + "."); - } else if (importInfo.isValid() && importInfo.type() == Interpreter::ImportInfo::DirectoryImport) { + } else if (importInfo.isValid() && importInfo.type() == ImportInfo::DirectoryImport) { QString path = importInfo.name(); QDir dir(m_doc->path()); QString relativeDir = dir.relativeFilePath(path); @@ -404,9 +404,9 @@ public: /// When something is changed here, also change Check::checkScopeObjectMember in /// qmljscheck.cpp /// ### Maybe put this into the context as a helper method. - bool lookupProperty(const QString &prefix, const UiQualifiedId *id, const Interpreter::Value **property = 0, const Interpreter::ObjectValue **parentObject = 0, QString *name = 0) + bool lookupProperty(const QString &prefix, const UiQualifiedId *id, const Value **property = 0, const ObjectValue **parentObject = 0, QString *name = 0) { - QList<const Interpreter::ObjectValue *> scopeObjects = m_scopeChain.qmlScopeObjects(); + QList<const ObjectValue *> scopeObjects = m_scopeChain.qmlScopeObjects(); if (scopeObjects.isEmpty()) return false; @@ -432,7 +432,7 @@ public: bool isAttachedProperty = false; if (! propertyName.isEmpty() && propertyName[0].isUpper()) { isAttachedProperty = true; - if (const Interpreter::ObjectValue *qmlTypes = m_scopeChain.qmlTypes()) + if (const ObjectValue *qmlTypes = m_scopeChain.qmlTypes()) scopeObjects += qmlTypes; } @@ -440,8 +440,8 @@ public: return false; // global lookup for first part of id - const Interpreter::ObjectValue *objectValue = 0; - const Interpreter::Value *value = 0; + const ObjectValue *objectValue = 0; + const Value *value = 0; for (int i = scopeObjects.size() - 1; i >= 0; --i) { objectValue = scopeObjects[i]; value = objectValue->lookupMember(propertyName, m_context); @@ -460,7 +460,7 @@ public: return false; // resolve references - if (const Interpreter::Reference *ref = value->asReference()) + if (const Reference *ref = value->asReference()) value = m_context->lookupReference(ref); // member lookup @@ -468,7 +468,7 @@ public: if (prefix.isEmpty()) idPart = idPart->next; for (; idPart; idPart = idPart->next) { - objectValue = Interpreter::value_cast<const Interpreter::ObjectValue *>(value); + objectValue = value_cast<const ObjectValue *>(value); if (! objectValue) { // if (idPart->name) // qDebug() << idPart->name->asString() << "has no property named" @@ -503,20 +503,20 @@ public: return true; } - bool isArrayProperty(const Interpreter::Value *value, const Interpreter::ObjectValue *containingObject, const QString &name) + bool isArrayProperty(const Value *value, const ObjectValue *containingObject, const QString &name) { if (!value) return false; - const Interpreter::ObjectValue *objectValue = value->asObjectValue(); + const ObjectValue *objectValue = value->asObjectValue(); if (objectValue && objectValue->prototype(m_context) == m_context->valueOwner()->arrayPrototype()) return true; - Interpreter::PrototypeIterator iter(containingObject, m_context); + PrototypeIterator iter(containingObject, m_context); while (iter.hasNext()) { - const Interpreter::ObjectValue *proto = iter.next(); + const ObjectValue *proto = iter.next(); if (proto->lookupMember(name, m_context) == m_context->valueOwner()->arrayPrototype()) return true; - if (const Interpreter::QmlObjectValue *qmlIter = dynamic_cast<const Interpreter::QmlObjectValue *>(proto)) { + if (const QmlObjectValue *qmlIter = dynamic_cast<const QmlObjectValue *>(proto)) { if (qmlIter->isListProperty(name)) return true; } @@ -528,8 +528,8 @@ public: { const bool hasQuotes = astValue.trimmed().left(1) == QLatin1String("\"") && astValue.trimmed().right(1) == QLatin1String("\""); const QString cleanedValue = fixEscapedUnicodeChar(deEscape(stripQuotes(astValue.trimmed()))); - const Interpreter::Value *property = 0; - const Interpreter::ObjectValue *containingObject = 0; + const Value *property = 0; + const ObjectValue *containingObject = 0; QString name; if (!lookupProperty(propertyPrefix, propertyId, &property, &containingObject, &name)) { qWarning() << "Unknown property" << propertyPrefix + QLatin1Char('.') + flatten(propertyId) @@ -541,7 +541,7 @@ public: if (containingObject) containingObject->lookupMember(name, m_context, &containingObject); - if (const Interpreter::QmlObjectValue * qmlObject = dynamic_cast<const Interpreter::QmlObjectValue *>(containingObject)) { + if (const QmlObjectValue * qmlObject = dynamic_cast<const QmlObjectValue *>(containingObject)) { const QString typeName = qmlObject->propertyType(name); if (qmlObject->getEnum(typeName).isValid()) { return QVariant(cleanedValue); @@ -577,7 +577,7 @@ public: if (!eStmt || !eStmt->expression) return QVariant(); - const Interpreter::ObjectValue *containingObject = 0; + const ObjectValue *containingObject = 0; QString name; if (!lookupProperty(propertyPrefix, propertyId, 0, &containingObject, &name)) { return QVariant(); @@ -585,12 +585,12 @@ public: if (containingObject) containingObject->lookupMember(name, m_context, &containingObject); - const Interpreter::QmlObjectValue * lhsQmlObject = dynamic_cast<const Interpreter::QmlObjectValue *>(containingObject); + const QmlObjectValue * lhsQmlObject = dynamic_cast<const QmlObjectValue *>(containingObject); if (!lhsQmlObject) return QVariant(); const QString lhsPropertyTypeName = lhsQmlObject->propertyType(name); - const Interpreter::ObjectValue *rhsValueObject = 0; + const ObjectValue *rhsValueObject = 0; QString rhsValueName; if (IdentifierExpression *idExp = cast<IdentifierExpression *>(eStmt->expression)) { if (!m_scopeChain.qmlScopeObjects().isEmpty()) @@ -599,7 +599,7 @@ public: rhsValueName = idExp->name->asString(); } else if (FieldMemberExpression *memberExp = cast<FieldMemberExpression *>(eStmt->expression)) { Evaluate evaluate(&m_scopeChain); - const Interpreter::Value *result = evaluate(memberExp->base); + const Value *result = evaluate(memberExp->base); rhsValueObject = result->asObjectValue(); if (memberExp->name) @@ -609,7 +609,7 @@ public: if (rhsValueObject) rhsValueObject->lookupMember(rhsValueName, m_context, &rhsValueObject); - const Interpreter::QmlObjectValue *rhsQmlObjectValue = dynamic_cast<const Interpreter::QmlObjectValue *>(rhsValueObject); + const QmlObjectValue *rhsQmlObjectValue = dynamic_cast<const QmlObjectValue *>(rhsValueObject); if (!rhsQmlObjectValue) return QVariant(); @@ -620,7 +620,7 @@ public: } - const Interpreter::ScopeChain &scopeChain() const + const ScopeChain &scopeChain() const { return m_scopeChain; } QList<DiagnosticMessage> diagnosticLinkMessages() const @@ -631,8 +631,8 @@ private: Document::Ptr m_doc; Link m_link; QList<DiagnosticMessage> m_diagnosticLinkMessages; - Interpreter::ContextPtr m_context; - Interpreter::ScopeChain m_scopeChain; + ContextPtr m_context; + ScopeChain m_scopeChain; ScopeBuilder m_scopeBuilder; }; @@ -764,8 +764,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH } snapshot.insert(doc); ReadingContext ctxt(snapshot, doc, importPaths); - m_scopeChain = QSharedPointer<const Interpreter::ScopeChain>( - new Interpreter::ScopeChain(ctxt.scopeChain())); + m_scopeChain = QSharedPointer<const ScopeChain>( + new ScopeChain(ctxt.scopeChain())); m_document = doc; QList<RewriterView::Error> errors; @@ -927,8 +927,8 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, if (binding->hasOnToken) { // skip value sources } else { - const Interpreter::Value *propertyType = 0; - const Interpreter::ObjectValue *containingObject = 0; + const Value *propertyType = 0; + const ObjectValue *containingObject = 0; QString name; if (context->lookupProperty(QString(), binding->qualifiedId, &propertyType, &containingObject, &name) || isPropertyChangesType(typeName)) { AbstractProperty modelProperty = modelNode.property(astPropertyName); diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h index 939825fb60..92b298dfd5 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h @@ -68,7 +68,7 @@ public: RewriterView *view() const { return m_rewriterView; } - const QmlJS::Interpreter::ScopeChain &scopeChain() const + const QmlJS::ScopeChain &scopeChain() const { return *m_scopeChain; } QmlJS::Document *document() const @@ -140,7 +140,7 @@ private: private: RewriterView *m_rewriterView; bool m_isActive; - QSharedPointer<const QmlJS::Interpreter::ScopeChain> m_scopeChain; + QSharedPointer<const QmlJS::ScopeChain> m_scopeChain; QmlJS::Document::Ptr m_document; QTimer m_setupTimer; QSet<ModelNode> m_setupComponentList; diff --git a/src/plugins/qmldesigner/qmlcontextpane.cpp b/src/plugins/qmldesigner/qmlcontextpane.cpp index 447a69fbe3..fa1122059f 100644 --- a/src/plugins/qmldesigner/qmlcontextpane.cpp +++ b/src/plugins/qmldesigner/qmlcontextpane.cpp @@ -116,7 +116,7 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document: m_blockWriting = true; LookupContext::Ptr lookupContext = LookupContext::create(doc, snapshot, QList<Node*>()); - const Interpreter::ObjectValue *scopeObject = doc->bind()->findQmlObject(node); + const ObjectValue *scopeObject = doc->bind()->findQmlObject(node); QStringList prototypes; while (scopeObject) { @@ -213,7 +213,7 @@ bool QmlContextPane::isAvailable(TextEditor::BaseTextEditorEditable *, Document: return false; LookupContext::Ptr lookupContext = LookupContext::create(doc, snapshot, QList<Node*>()); - const Interpreter::ObjectValue *scopeObject = doc->bind()->findQmlObject(node); + const ObjectValue *scopeObject = doc->bind()->findQmlObject(node); QStringList prototypes; |