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 | |
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')
42 files changed, 308 insertions, 344 deletions
diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 4349f3b99b..c7a2437ac0 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -44,7 +44,6 @@ using namespace LanguageUtils; using namespace QmlJS; using namespace QmlJS::AST; -using namespace QmlJS::Interpreter; /*! \class QmlJS::Bind @@ -54,7 +53,7 @@ using namespace QmlJS::Interpreter; Each QmlJS::Document owns a instance of Bind. It provides access to data that can be derived by looking at the document in isolation. If you need information that goes beyond that, you need to create a - \l{QmlJS::Interpreter::Context} using \l{QmlJS::Link}. + \l{QmlJS::Context} using \l{QmlJS::Link}. The document's imports are classified and available through imports(). @@ -81,17 +80,17 @@ QList<ImportInfo> Bind::imports() const return _imports; } -Interpreter::ObjectValue *Bind::idEnvironment() const +ObjectValue *Bind::idEnvironment() const { return _idEnvironment; } -Interpreter::ObjectValue *Bind::rootObjectValue() const +ObjectValue *Bind::rootObjectValue() const { return _rootObjectValue; } -Interpreter::ObjectValue *Bind::findQmlObject(AST::Node *node) const +ObjectValue *Bind::findQmlObject(AST::Node *node) const { return _qmlObjects.value(node); } @@ -171,7 +170,7 @@ bool Bind::usesQmlPrototype(ObjectValue *prototype, return false; } -Interpreter::ObjectValue *Bind::findAttachedJSScope(AST::Node *node) const +ObjectValue *Bind::findAttachedJSScope(AST::Node *node) const { return _attachedJSScopes.value(node); } @@ -317,7 +316,7 @@ bool Bind::visit(UiObjectDefinition *ast) _qmlObjects.insert(ast, value); } else { _groupedPropertyBindings.insert(ast); - Interpreter::ObjectValue *oldObjectValue = switchObjectValue(0); + ObjectValue *oldObjectValue = switchObjectValue(0); accept(ast->initializer); switchObjectValue(oldObjectValue); } diff --git a/src/libs/qmljs/qmljsbind.h b/src/libs/qmljs/qmljsbind.h index 6e7f7e65d8..0703d815b8 100644 --- a/src/libs/qmljs/qmljsbind.h +++ b/src/libs/qmljs/qmljsbind.h @@ -55,16 +55,16 @@ public: Bind(Document *doc, QList<DiagnosticMessage> *messages); virtual ~Bind(); - QList<Interpreter::ImportInfo> imports() const; + QList<ImportInfo> imports() const; - Interpreter::ObjectValue *idEnvironment() const; - Interpreter::ObjectValue *rootObjectValue() const; + ObjectValue *idEnvironment() const; + ObjectValue *rootObjectValue() const; - Interpreter::ObjectValue *findQmlObject(AST::Node *node) const; - bool usesQmlPrototype(Interpreter::ObjectValue *prototype, - const Interpreter::ContextPtr &context) const; + ObjectValue *findQmlObject(AST::Node *node) const; + bool usesQmlPrototype(ObjectValue *prototype, + const ContextPtr &context) const; - Interpreter::ObjectValue *findAttachedJSScope(AST::Node *node) const; + ObjectValue *findAttachedJSScope(AST::Node *node) const; bool isGroupedPropertyBinding(AST::Node *node) const; static QString toString(AST::UiQualifiedId *qualifiedId, QChar delimiter = QChar('.')); @@ -90,23 +90,23 @@ protected: virtual bool visit(AST::FunctionExpression *ast); virtual bool visit(AST::VariableDeclaration *ast); - Interpreter::ObjectValue *switchObjectValue(Interpreter::ObjectValue *newObjectValue); - Interpreter::ObjectValue *bindObject(AST::UiQualifiedId *qualifiedTypeNameId, AST::UiObjectInitializer *initializer); + ObjectValue *switchObjectValue(ObjectValue *newObjectValue); + ObjectValue *bindObject(AST::UiQualifiedId *qualifiedTypeNameId, AST::UiObjectInitializer *initializer); private: Document *_doc; - Interpreter::ValueOwner _valueOwner; + ValueOwner _valueOwner; - Interpreter::ObjectValue *_currentObjectValue; - Interpreter::ObjectValue *_idEnvironment; - Interpreter::ObjectValue *_rootObjectValue; + ObjectValue *_currentObjectValue; + ObjectValue *_idEnvironment; + ObjectValue *_rootObjectValue; - QHash<AST::Node *, Interpreter::ObjectValue *> _qmlObjects; + QHash<AST::Node *, ObjectValue *> _qmlObjects; QSet<AST::Node *> _groupedPropertyBindings; - QHash<AST::Node *, Interpreter::ObjectValue *> _attachedJSScopes; + QHash<AST::Node *, ObjectValue *> _attachedJSScopes; QStringList _includedScripts; - QList<Interpreter::ImportInfo> _imports; + QList<ImportInfo> _imports; QList<DiagnosticMessage> *_diagnosticMessages; }; diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index dbc75cad04..38d14eda5c 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -43,7 +43,6 @@ using namespace QmlJS; using namespace QmlJS::AST; -using namespace QmlJS::Interpreter; QColor QmlJS::toQColor(const QString &qmlColorString) { @@ -102,8 +101,8 @@ public: DiagnosticMessage operator()( const Document::Ptr &document, const SourceLocation &location, - const Interpreter::Value *lhsValue, - const Interpreter::Value *rhsValue, + const Value *lhsValue, + const Value *rhsValue, ExpressionNode *ast) { _doc = document; diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h index 72c84fc7d3..392fc6c0e1 100644 --- a/src/libs/qmljs/qmljscheck.h +++ b/src/libs/qmljs/qmljscheck.h @@ -54,7 +54,7 @@ class QMLJS_EXPORT Check: protected AST::Visitor public: // prefer taking root scope chain? - Check(Document::Ptr doc, const Interpreter::ContextPtr &context); + Check(Document::Ptr doc, const ContextPtr &context); virtual ~Check(); QList<DiagnosticMessage> operator()(); @@ -116,7 +116,7 @@ protected: private: void visitQmlObject(AST::Node *ast, AST::UiQualifiedId *typeId, AST::UiObjectInitializer *initializer); - const Interpreter::Value *checkScopeObjectMember(const AST::UiQualifiedId *id); + const Value *checkScopeObjectMember(const AST::UiQualifiedId *id); void checkAssignInCondition(AST::ExpressionNode *condition); void checkEndsWithControlFlow(AST::StatementList *statements, AST::SourceLocation errorLoc); void checkProperty(QmlJS::AST::UiQualifiedId *); @@ -128,15 +128,15 @@ private: Document::Ptr _doc; - Interpreter::ContextPtr _context; - Interpreter::ScopeChain _scopeChain; + ContextPtr _context; + ScopeChain _scopeChain; ScopeBuilder _scopeBuilder; QList<DiagnosticMessage> _messages; Options _options; - const Interpreter::Value *_lastValue; + const Value *_lastValue; QList<AST::Node *> _chain; QStack<StringSet> m_idStack; QStack<StringSet> m_propertyStack; diff --git a/src/libs/qmljs/qmljscontext.cpp b/src/libs/qmljs/qmljscontext.cpp index 7e9fc62de0..60112e5e40 100644 --- a/src/libs/qmljs/qmljscontext.cpp +++ b/src/libs/qmljs/qmljscontext.cpp @@ -36,7 +36,6 @@ using namespace QmlJS; using namespace QmlJS::AST; -using namespace QmlJS::Interpreter; ContextPtr Context::create(const QmlJS::Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports) { diff --git a/src/libs/qmljs/qmljscontext.h b/src/libs/qmljs/qmljscontext.h index c33674e27f..adf4964421 100644 --- a/src/libs/qmljs/qmljscontext.h +++ b/src/libs/qmljs/qmljscontext.h @@ -42,9 +42,6 @@ namespace QmlJS { class Document; class Snapshot; - -namespace Interpreter { - class Context; typedef QSharedPointer<const Context> ContextPtr; @@ -100,8 +97,6 @@ private: QList<const Reference *> m_references; }; - -} // namespace Interpreter } // namespace QmlJS #endif // QMLJS_CONTEXT_H diff --git a/src/libs/qmljs/qmljsevaluate.cpp b/src/libs/qmljs/qmljsevaluate.cpp index 973144fbd5..5c3ecfa1d4 100644 --- a/src/libs/qmljs/qmljsevaluate.cpp +++ b/src/libs/qmljs/qmljsevaluate.cpp @@ -38,7 +38,6 @@ #include <QtCore/QDebug> using namespace QmlJS; -using namespace QmlJS::Interpreter; Evaluate::Evaluate(const ScopeChain *scopeChain) : _valueOwner(scopeChain->context()->valueOwner()), @@ -53,12 +52,12 @@ Evaluate::~Evaluate() { } -const Interpreter::Value *Evaluate::operator()(AST::Node *ast) +const Value *Evaluate::operator()(AST::Node *ast) { return value(ast); } -const Interpreter::Value *Evaluate::value(AST::Node *ast) +const Value *Evaluate::value(AST::Node *ast) { const Value *result = reference(ast); @@ -71,7 +70,7 @@ const Interpreter::Value *Evaluate::value(AST::Node *ast) return result; } -const Interpreter::Value *Evaluate::reference(AST::Node *ast) +const Value *Evaluate::reference(AST::Node *ast) { // save the result const Value *previousResult = switchResult(0); @@ -83,16 +82,16 @@ const Interpreter::Value *Evaluate::reference(AST::Node *ast) return switchResult(previousResult); } -const Interpreter::Value *Evaluate::switchResult(const Interpreter::Value *result) +const Value *Evaluate::switchResult(const Value *result) { - const Interpreter::Value *previousResult = _result; + const Value *previousResult = _result; _result = result; return previousResult; } -const Interpreter::ObjectValue *Evaluate::switchScope(const Interpreter::ObjectValue *scope) +const ObjectValue *Evaluate::switchScope(const ObjectValue *scope) { - const Interpreter::ObjectValue *previousScope = _scope; + const ObjectValue *previousScope = _scope; _scope = scope; return previousScope; } @@ -311,8 +310,8 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast) if (! ast->name) return false; - if (const Interpreter::Value *base = _valueOwner->convertToObject(value(ast->base))) { - if (const Interpreter::ObjectValue *obj = base->asObjectValue()) { + if (const Value *base = _valueOwner->convertToObject(value(ast->base))) { + if (const ObjectValue *obj = base->asObjectValue()) { _result = obj->lookupMember(ast->name->asString(), _context); } } @@ -338,8 +337,8 @@ bool Evaluate::visit(AST::NewExpression *ast) bool Evaluate::visit(AST::CallExpression *ast) { - if (const Interpreter::Value *base = value(ast->base)) { - if (const Interpreter::FunctionValue *obj = base->asFunctionValue()) { + if (const Value *base = value(ast->base)) { + if (const FunctionValue *obj = base->asFunctionValue()) { _result = obj->returnValue(); } } diff --git a/src/libs/qmljs/qmljsevaluate.h b/src/libs/qmljs/qmljsevaluate.h index 3d65e31d97..a328946560 100644 --- a/src/libs/qmljs/qmljsevaluate.h +++ b/src/libs/qmljs/qmljsevaluate.h @@ -39,34 +39,32 @@ namespace QmlJS { -namespace Interpreter { - class ValueOwner; - class Context; - class Value; - class ObjectValue; - class FunctionValue; -} // namespace Interpreter +class ValueOwner; +class Context; +class Value; +class ObjectValue; +class FunctionValue; class QMLJS_EXPORT Evaluate: protected AST::Visitor { public: - Evaluate(const Interpreter::ScopeChain *scopeChain); + Evaluate(const ScopeChain *scopeChain); virtual ~Evaluate(); // same as value() - const Interpreter::Value *operator()(AST::Node *ast); + const Value *operator()(AST::Node *ast); // evaluate ast in the given context, resolving references - const Interpreter::Value *value(AST::Node *ast); + const Value *value(AST::Node *ast); // evaluate, but stop when encountering a Reference - const Interpreter::Value *reference(AST::Node *ast); + const Value *reference(AST::Node *ast); protected: void accept(AST::Node *node); - const Interpreter::Value *switchResult(const Interpreter::Value *result); - const Interpreter::ObjectValue *switchScope(const Interpreter::ObjectValue *scope); + const Value *switchResult(const Value *result); + const ObjectValue *switchScope(const ObjectValue *scope); // Ui virtual bool visit(AST::UiProgram *ast); @@ -164,11 +162,11 @@ protected: private: QmlJS::Document::Ptr _doc; - Interpreter::ValueOwner *_valueOwner; - Interpreter::ContextPtr _context; - const Interpreter::ScopeChain *_scopeChain; - const Interpreter::ObjectValue *_scope; - const Interpreter::Value *_result; + ValueOwner *_valueOwner; + ContextPtr _context; + const ScopeChain *_scopeChain; + const ObjectValue *_scope; + const Value *_result; }; } // namespace Qml diff --git a/src/libs/qmljs/qmljsicontextpane.h b/src/libs/qmljs/qmljsicontextpane.h index 3a05e7d04c..26e6759e39 100644 --- a/src/libs/qmljs/qmljsicontextpane.h +++ b/src/libs/qmljs/qmljsicontextpane.h @@ -46,9 +46,7 @@ class BaseTextEditor; namespace QmlJS { -namespace Interpreter { class ScopeChain; -} class QMLJS_EXPORT IContextPane : public QObject { @@ -57,7 +55,7 @@ class QMLJS_EXPORT IContextPane : public QObject public: IContextPane(QObject *parent = 0) : QObject(parent) {} virtual ~IContextPane() {} - virtual void apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const Interpreter::ScopeChain *scopeChain, AST::Node *node, bool update, bool force = false) = 0; + virtual void apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force = false) = 0; virtual void setEnabled(bool) = 0; virtual bool isAvailable(TextEditor::BaseTextEditor *editor, Document::Ptr document, AST::Node *node) = 0; virtual QWidget* widget() = 0; diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 711bcc0465..5546597bf6 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -55,7 +55,7 @@ #include <QtCore/QDebug> using namespace LanguageUtils; -using namespace QmlJS::Interpreter; +using namespace QmlJS; using namespace QmlJS::AST; namespace { @@ -1176,7 +1176,7 @@ CppQmlTypesLoader::BuiltinObjects CppQmlTypesLoader::loadQmlTypes(const QFileInf QString contents = QString::fromUtf8(file.readAll()); file.close(); - QmlJS::TypeDescriptionReader reader(contents); + TypeDescriptionReader reader(contents); if (!reader(&newObjects)) error = reader.errorMessage(); warning = reader.warningMessage(); @@ -1205,7 +1205,7 @@ void CppQmlTypesLoader::parseQmlTypeDescriptions(const QByteArray &xml, { errorMessage->clear(); warningMessage->clear(); - QmlJS::TypeDescriptionReader reader(QString::fromUtf8(xml)); + TypeDescriptionReader reader(QString::fromUtf8(xml)); if (!reader(newObjects)) { if (reader.errorMessage().isEmpty()) { *errorMessage = QLatin1String("unknown error"); @@ -1631,7 +1631,7 @@ void TypeId::visit(const AnchorLineValue *) ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName, UiObjectInitializer *initializer, - const QmlJS::Document *doc, + const Document *doc, ValueOwner *valueOwner) : ObjectValue(valueOwner), _typeName(typeName), _initializer(initializer), _doc(doc), _defaultPropertyRef(0) { @@ -1701,12 +1701,12 @@ UiQualifiedId *ASTObjectValue::typeName() const return _typeName; } -const QmlJS::Document *ASTObjectValue::document() const +const Document *ASTObjectValue::document() const { return _doc; } -ASTVariableReference::ASTVariableReference(VariableDeclaration *ast, const QmlJS::Document *doc, ValueOwner *valueOwner) +ASTVariableReference::ASTVariableReference(VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner) , _ast(ast) , _doc(doc) @@ -1724,14 +1724,14 @@ const Value *ASTVariableReference::value(const ReferenceContext *referenceContex Document::Ptr doc = _doc->ptr(); ScopeChain scopeChain(doc, referenceContext->context()); - QmlJS::ScopeBuilder builder(&scopeChain); - builder.push(QmlJS::ScopeAstPath(doc)(_ast->expression->firstSourceLocation().begin())); + ScopeBuilder builder(&scopeChain); + builder.push(ScopeAstPath(doc)(_ast->expression->firstSourceLocation().begin())); - QmlJS::Evaluate evaluator(&scopeChain); + Evaluate evaluator(&scopeChain); return evaluator(_ast->expression); } -ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const QmlJS::Document *doc, ValueOwner *valueOwner) +ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const Document *doc, ValueOwner *valueOwner) : FunctionValue(valueOwner), _ast(ast), _doc(doc) { setPrototype(valueOwner->functionPrototype()); @@ -1787,7 +1787,7 @@ bool ASTFunctionValue::getSourceLocation(QString *fileName, int *line, int *colu return true; } -QmlPrototypeReference::QmlPrototypeReference(UiQualifiedId *qmlTypeName, const QmlJS::Document *doc, +QmlPrototypeReference::QmlPrototypeReference(UiQualifiedId *qmlTypeName, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner), _qmlTypeName(qmlTypeName), @@ -1809,7 +1809,7 @@ const Value *QmlPrototypeReference::value(const ReferenceContext *referenceConte return referenceContext->context()->lookupType(_doc, _qmlTypeName); } -ASTPropertyReference::ASTPropertyReference(UiPublicMember *ast, const QmlJS::Document *doc, ValueOwner *valueOwner) +ASTPropertyReference::ASTPropertyReference(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner), _ast(ast), _doc(doc) { const QString propertyName = ast->name->asString(); @@ -1840,14 +1840,14 @@ const Value *ASTPropertyReference::value(const ReferenceContext *referenceContex // Adjust the context for the current location - expensive! // ### Improve efficiency by caching the 'use chain' constructed in ScopeBuilder. - QmlJS::Document::Ptr doc = _doc->ptr(); + Document::Ptr doc = _doc->ptr(); ScopeChain scopeChain(doc, referenceContext->context()); - QmlJS::ScopeBuilder builder(&scopeChain); + ScopeBuilder builder(&scopeChain); int offset = _ast->statement->firstSourceLocation().begin(); builder.push(ScopeAstPath(doc)(offset)); - QmlJS::Evaluate evaluator(&scopeChain); + Evaluate evaluator(&scopeChain); return evaluator(_ast->statement); } @@ -1857,7 +1857,7 @@ const Value *ASTPropertyReference::value(const ReferenceContext *referenceContex return valueOwner()->undefinedValue(); } -ASTSignalReference::ASTSignalReference(UiPublicMember *ast, const QmlJS::Document *doc, ValueOwner *valueOwner) +ASTSignalReference::ASTSignalReference(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner), _ast(ast), _doc(doc) { const QString signalName = ast->name->asString(); diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 0bd1d35718..e34f306227 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -51,8 +51,6 @@ namespace QmlJS { class NameId; class Document; -namespace Interpreter { - //////////////////////////////////////////////////////////////////////////////// // Forward declarations //////////////////////////////////////////////////////////////////////////////// @@ -573,10 +571,10 @@ public: static const QLatin1String cppPackage; template <typename T> - QList<QmlObjectValue *> load(Interpreter::ValueOwner *interpreter, const T &objects); + QList<QmlObjectValue *> load(ValueOwner *interpreter, const T &objects); - QList<Interpreter::QmlObjectValue *> typesForImport(const QString &prefix, LanguageUtils::ComponentVersion version) const; - Interpreter::QmlObjectValue *typeByCppName(const QString &cppName) const; + QList<QmlObjectValue *> typesForImport(const QString &prefix, LanguageUtils::ComponentVersion version) const; + QmlObjectValue *typeByCppName(const QString &cppName) const; bool hasPackage(const QString &package) const; @@ -906,6 +904,6 @@ private: JSImportScope *_jsImportScope; }; -} } // namespace QmlJS::Interpreter +} // namespace QmlJS #endif // QMLJS_INTERPRETER_H diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 9035d7e514..7bbf6abd5f 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -44,14 +44,13 @@ using namespace LanguageUtils; using namespace QmlJS; -using namespace QmlJS::Interpreter; using namespace QmlJS::AST; namespace { class ImportCacheKey { public: - explicit ImportCacheKey(const Interpreter::ImportInfo &info) + explicit ImportCacheKey(const ImportInfo &info) : type(info.type()) , name(info.name()) , majorVersion(info.version().majorVersion()) @@ -84,7 +83,7 @@ class QmlJS::LinkPrivate { public: Snapshot snapshot; - Interpreter::ValueOwner *valueOwner; + ValueOwner *valueOwner; QStringList importPaths; LibraryInfo builtins; @@ -99,7 +98,7 @@ public: /*! \class QmlJS::Link \brief Initializes the Context for a Document. - \sa QmlJS::Document QmlJS::Interpreter::Context + \sa QmlJS::Document QmlJS::Context Initializes a context by resolving imports and building the root scope chain. Currently, this is a expensive operation. @@ -439,7 +438,7 @@ void Link::appendDiagnostic(const Document::Ptr &doc, const DiagnosticMessage &m (*d->allDiagnosticMessages)[doc->fileName()].append(message); } -void Link::loadQmldirComponents(Interpreter::ObjectValue *import, ComponentVersion version, +void Link::loadQmldirComponents(ObjectValue *import, ComponentVersion version, const LibraryInfo &libraryInfo, const QString &libraryPath) { Q_D(Link); diff --git a/src/libs/qmljs/qmljslink.h b/src/libs/qmljs/qmljslink.h index 0a941ed844..f86cc5e1a9 100644 --- a/src/libs/qmljs/qmljslink.h +++ b/src/libs/qmljs/qmljslink.h @@ -58,38 +58,38 @@ public: Link(const Snapshot &snapshot, const QStringList &importPaths, const LibraryInfo &builtins); // Link all documents in snapshot, collecting all diagnostic messages (if messages != 0) - Interpreter::ContextPtr operator()(QHash<QString, QList<DiagnosticMessage> > *messages = 0); + ContextPtr operator()(QHash<QString, QList<DiagnosticMessage> > *messages = 0); // Link all documents in snapshot, appending the diagnostic messages // for 'doc' in 'messages' - Interpreter::ContextPtr operator()(const Document::Ptr &doc, QList<DiagnosticMessage> *messages); + ContextPtr operator()(const Document::Ptr &doc, QList<DiagnosticMessage> *messages); ~Link(); private: static AST::UiQualifiedId *qualifiedTypeNameId(AST::Node *node); - Interpreter::Context::ImportsPerDocument linkImports(); + Context::ImportsPerDocument linkImports(); - void populateImportedTypes(Interpreter::Imports *imports, Document::Ptr doc); - Interpreter::Import importFileOrDirectory( + void populateImportedTypes(Imports *imports, Document::Ptr doc); + Import importFileOrDirectory( Document::Ptr doc, - const Interpreter::ImportInfo &importInfo); - Interpreter::Import importNonFile( + const ImportInfo &importInfo); + Import importNonFile( Document::Ptr doc, - const Interpreter::ImportInfo &importInfo); - void importObject(Bind *bind, const QString &name, Interpreter::ObjectValue *object, NameId *targetNamespace); + const ImportInfo &importInfo); + void importObject(Bind *bind, const QString &name, ObjectValue *object, NameId *targetNamespace); bool importLibrary(Document::Ptr doc, const QString &libraryPath, - Interpreter::Import *import, + Import *import, const QString &importPath = QString()); - void loadQmldirComponents(Interpreter::ObjectValue *import, + void loadQmldirComponents(ObjectValue *import, LanguageUtils::ComponentVersion version, const LibraryInfo &libraryInfo, const QString &libraryPath); - void loadImplicitDirectoryImports(Interpreter::Imports *imports, Document::Ptr doc); - void loadImplicitDefaultImports(Interpreter::Imports *imports); + void loadImplicitDirectoryImports(Imports *imports, Document::Ptr doc); + void loadImplicitDefaultImports(Imports *imports); void error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message); void warning(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message); diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index 476ff2bde7..f7e78f35e9 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -39,7 +39,6 @@ #include "parser/qmljsast_p.h" using namespace QmlJS; -using namespace QmlJS::Interpreter; using namespace QmlJS::AST; ScopeBuilder::ScopeBuilder(ScopeChain *scopeChain) diff --git a/src/libs/qmljs/qmljsscopebuilder.h b/src/libs/qmljs/qmljsscopebuilder.h index b33f3cec34..db789ad548 100644 --- a/src/libs/qmljs/qmljsscopebuilder.h +++ b/src/libs/qmljs/qmljsscopebuilder.h @@ -39,14 +39,12 @@ namespace QmlJS { -namespace Interpreter { class QmlComponentChain; class Context; typedef QSharedPointer<const Context> ContextPtr; class ObjectValue; class Value; class ScopeChain; -} namespace AST { class Node; @@ -55,20 +53,20 @@ namespace AST { class QMLJS_EXPORT ScopeBuilder { public: - ScopeBuilder(Interpreter::ScopeChain *scopeChain); + ScopeBuilder(ScopeChain *scopeChain); ~ScopeBuilder(); void push(AST::Node *node); void push(const QList<AST::Node *> &nodes); void pop(); - static const Interpreter::ObjectValue *isPropertyChangesObject(const Interpreter::ContextPtr &context, const Interpreter::ObjectValue *object); + static const ObjectValue *isPropertyChangesObject(const ContextPtr &context, const ObjectValue *object); private: void setQmlScopeObject(AST::Node *node); - const Interpreter::Value *scopeObjectLookup(AST::UiQualifiedId *id); + const Value *scopeObjectLookup(AST::UiQualifiedId *id); - Interpreter::ScopeChain *_scopeChain; + ScopeChain *_scopeChain; QList<AST::Node *> _nodes; }; diff --git a/src/libs/qmljs/qmljsscopechain.cpp b/src/libs/qmljs/qmljsscopechain.cpp index f415111780..5f605633aa 100644 --- a/src/libs/qmljs/qmljsscopechain.cpp +++ b/src/libs/qmljs/qmljsscopechain.cpp @@ -35,7 +35,6 @@ #include "qmljsevaluate.h" using namespace QmlJS; -using namespace QmlJS::Interpreter; QmlComponentChain::QmlComponentChain(const Document::Ptr &document) : m_document(document) diff --git a/src/libs/qmljs/qmljsscopechain.h b/src/libs/qmljs/qmljsscopechain.h index 430512a085..e55aeaf290 100644 --- a/src/libs/qmljs/qmljsscopechain.h +++ b/src/libs/qmljs/qmljsscopechain.h @@ -41,7 +41,6 @@ #include <QtCore/QSharedPointer> namespace QmlJS { -namespace Interpreter { class ObjectValue; class TypeScope; @@ -122,7 +121,6 @@ private: mutable QList<const ObjectValue *> m_all; }; -} // namespace Interpreter } // namespace QmlJS #endif // QMLJS_SCOPECHAIN_H diff --git a/src/libs/qmljs/qmljstypedescriptionreader.cpp b/src/libs/qmljs/qmljstypedescriptionreader.cpp index d3f392c71b..d0b0480170 100644 --- a/src/libs/qmljs/qmljstypedescriptionreader.cpp +++ b/src/libs/qmljs/qmljstypedescriptionreader.cpp @@ -218,7 +218,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast) } // ### add implicit export into the package of c++ types - fmo->addExport(fmo->className(), QmlJS::Interpreter::CppQmlTypes::cppPackage, ComponentVersion()); + fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion()); _objects->insert(fmo->className(), fmo); } diff --git a/src/libs/qmljs/qmljsvalueowner.cpp b/src/libs/qmljs/qmljsvalueowner.cpp index 96fca88ab3..68c84bec1d 100644 --- a/src/libs/qmljs/qmljsvalueowner.cpp +++ b/src/libs/qmljs/qmljsvalueowner.cpp @@ -33,7 +33,6 @@ #include "qmljsvalueowner.h" using namespace QmlJS; -using namespace QmlJS::Interpreter; namespace { diff --git a/src/libs/qmljs/qmljsvalueowner.h b/src/libs/qmljs/qmljsvalueowner.h index e3e6713279..13c71c3936 100644 --- a/src/libs/qmljs/qmljsvalueowner.h +++ b/src/libs/qmljs/qmljsvalueowner.h @@ -39,7 +39,6 @@ #include <QtCore/QList> namespace QmlJS { -namespace Interpreter { //////////////////////////////////////////////////////////////////////////////// // Forward declarations @@ -194,7 +193,6 @@ private: QMutex _mutex; }; -} // namespace Interpreter } // namespace QmlJS #endif // QMLJS_VALUEOWNER_H 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; diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index 8ce9da59a1..8a775699ff 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -79,18 +79,18 @@ enum CompletionOrder { TypeOrder = -30 }; -class EnumerateProperties: private Interpreter::MemberProcessor +class EnumerateProperties: private MemberProcessor { - QSet<const Interpreter::ObjectValue *> _processed; - QHash<QString, const Interpreter::Value *> _properties; + QSet<const ObjectValue *> _processed; + QHash<QString, const Value *> _properties; bool _globalCompletion; bool _enumerateGeneratedSlots; bool _enumerateSlots; - const Interpreter::ScopeChain *_scopeChain; - const Interpreter::ObjectValue *_currentObject; + const ScopeChain *_scopeChain; + const ObjectValue *_currentObject; public: - EnumerateProperties(const Interpreter::ScopeChain *scopeChain) + EnumerateProperties(const ScopeChain *scopeChain) : _globalCompletion(false), _enumerateGeneratedSlots(false), _enumerateSlots(true), @@ -114,61 +114,61 @@ public: _enumerateSlots = enumerate; } - QHash<QString, const Interpreter::Value *> operator ()(const Interpreter::Value *value) + QHash<QString, const Value *> operator ()(const Value *value) { _processed.clear(); _properties.clear(); - _currentObject = Interpreter::value_cast<const Interpreter::ObjectValue *>(value); + _currentObject = value_cast<const ObjectValue *>(value); enumerateProperties(value); return _properties; } - QHash<QString, const Interpreter::Value *> operator ()() + QHash<QString, const Value *> operator ()() { _processed.clear(); _properties.clear(); _currentObject = 0; - foreach (const Interpreter::ObjectValue *scope, _scopeChain->all()) + foreach (const ObjectValue *scope, _scopeChain->all()) enumerateProperties(scope); return _properties; } private: - void insertProperty(const QString &name, const Interpreter::Value *value) + void insertProperty(const QString &name, const Value *value) { _properties.insert(name, value); } - virtual bool processProperty(const QString &name, const Interpreter::Value *value) + virtual bool processProperty(const QString &name, const Value *value) { insertProperty(name, value); return true; } - virtual bool processEnumerator(const QString &name, const Interpreter::Value *value) + virtual bool processEnumerator(const QString &name, const Value *value) { if (! _globalCompletion) insertProperty(name, value); return true; } - virtual bool processSignal(const QString &, const Interpreter::Value *) + virtual bool processSignal(const QString &, const Value *) { return true; } - virtual bool processSlot(const QString &name, const Interpreter::Value *value) + virtual bool processSlot(const QString &name, const Value *value) { if (_enumerateSlots) insertProperty(name, value); return true; } - virtual bool processGeneratedSlot(const QString &name, const Interpreter::Value *value) + virtual bool processGeneratedSlot(const QString &name, const Value *value) { if (_enumerateGeneratedSlots || (_currentObject && _currentObject->className().endsWith(QLatin1String("Keys")))) { // ### FIXME: add support for attached properties. @@ -177,16 +177,16 @@ private: return true; } - void enumerateProperties(const Interpreter::Value *value) + void enumerateProperties(const Value *value) { if (! value) return; - else if (const Interpreter::ObjectValue *object = value->asObjectValue()) { + else if (const ObjectValue *object = value->asObjectValue()) { enumerateProperties(object); } } - void enumerateProperties(const Interpreter::ObjectValue *object) + void enumerateProperties(const ObjectValue *object) { if (! object || _processed.contains(object)) return; @@ -198,16 +198,16 @@ private: } }; -const Interpreter::Value *getPropertyValue(const Interpreter::ObjectValue *object, +const Value *getPropertyValue(const ObjectValue *object, const QStringList &propertyNames, - const Interpreter::ContextPtr &context) + const ContextPtr &context) { if (propertyNames.isEmpty() || !object) return 0; - const Interpreter::Value *value = object; + const Value *value = object; foreach (const QString &name, propertyNames) { - if (const Interpreter::ObjectValue *objectValue = value->asObjectValue()) { + if (const ObjectValue *objectValue = value->asObjectValue()) { value = objectValue->lookupMember(name, context); if (!value) return 0; @@ -420,8 +420,8 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface isQmlFile = true; const QList<AST::Node *> path = semanticInfo.rangePath(m_interface->position()); - const Interpreter::ContextPtr &context = semanticInfo.context; - const Interpreter::ScopeChain &scopeChain = semanticInfo.scopeChain(path); + const ContextPtr &context = semanticInfo.context; + const ScopeChain &scopeChain = semanticInfo.scopeChain(path); // Search for the operator that triggered the completion. QChar completionOperator; @@ -432,7 +432,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface startPositionCursor.setPosition(m_startPosition); CompletionContextFinder contextFinder(startPositionCursor); - const Interpreter::ObjectValue *qmlScopeType = 0; + const ObjectValue *qmlScopeType = 0; if (contextFinder.isInQmlContext()) { // find the enclosing qml object // ### this should use semanticInfo.declaringMember instead, but that may also return functions @@ -450,15 +450,15 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface AST::UiObjectDefinition *objDef = AST::cast<AST::UiObjectDefinition *>(path[i]); if (!objDef || !document->bind()->isGroupedPropertyBinding(objDef)) break; - const Interpreter::ObjectValue *newScopeType = qmlScopeType; + const ObjectValue *newScopeType = qmlScopeType; for (AST::UiQualifiedId *it = objDef->qualifiedTypeNameId; it; it = it->next) { if (!newScopeType || !it->name) { newScopeType = 0; break; } - const Interpreter::Value *v = newScopeType->lookupMember(it->name->asString(), context); + const Value *v = newScopeType->lookupMember(it->name->asString(), context); v = context->lookupReference(v); - newScopeType = Interpreter::value_cast<const Interpreter::ObjectValue *>(v); + newScopeType = value_cast<const ObjectValue *>(v); } if (!newScopeType) break; @@ -490,7 +490,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface return 0; } - const Interpreter::Value *value = + const Value *value = getPropertyValue(qmlScopeType, contextFinder.bindingPropertyName(), context); if (!value) { // do nothing @@ -550,10 +550,10 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface doQmlKeywordCompletion = false; // complete enum values for enum properties - const Interpreter::Value *value = + const Value *value = getPropertyValue(qmlScopeType, contextFinder.bindingPropertyName(), context); - if (const Interpreter::QmlEnumValue *enumValue = - dynamic_cast<const Interpreter::QmlEnumValue *>(value)) { + if (const QmlEnumValue *enumValue = + dynamic_cast<const QmlEnumValue *>(value)) { foreach (const QString &key, enumValue->keys()) addCompletion(key, m_interface->symbolIcon(), EnumValueOrder, QString("\"%1\"").arg(key)); @@ -564,7 +564,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface doQmlTypeCompletion = true; if (doQmlTypeCompletion) { - if (const Interpreter::ObjectValue *qmlTypes = scopeChain.qmlTypes()) { + if (const ObjectValue *qmlTypes = scopeChain.qmlTypes()) { EnumerateProperties enumerateProperties(&scopeChain); addCompletions(enumerateProperties(qmlTypes), m_interface->symbolIcon(), TypeOrder); } @@ -613,8 +613,8 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface if (expression != 0 && ! isLiteral(expression)) { // Evaluate the expression under cursor. - Interpreter::ValueOwner *interp = context->valueOwner(); - const Interpreter::Value *value = + ValueOwner *interp = context->valueOwner(); + const Value *value = interp->convertToObject(scopeChain.evaluate(expression)); //qDebug() << "type:" << interp->typeId(value); @@ -632,7 +632,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface && completionOperator == QLatin1Char('(') && m_startPosition == m_interface->position()) { // function completion - if (const Interpreter::FunctionValue *f = value->asFunctionValue()) { + if (const FunctionValue *f = value->asFunctionValue()) { QString functionName = expressionUnderCursor.text(); int indexOfDot = functionName.lastIndexOf(QLatin1Char('.')); if (indexOfDot != -1) @@ -767,12 +767,12 @@ bool QmlJSCompletionAssistProcessor::completeUrl(const QString &relativeBasePath } void QmlJSCompletionAssistProcessor::addCompletionsPropertyLhs(const QHash<QString, - const QmlJS::Interpreter::Value *> &newCompletions, + const QmlJS::Value *> &newCompletions, const QIcon &icon, int order, bool afterOn) { - QHashIterator<QString, const Interpreter::Value *> it(newCompletions); + QHashIterator<QString, const Value *> it(newCompletions); while (it.hasNext()) { it.next(); @@ -782,8 +782,8 @@ void QmlJSCompletionAssistProcessor::addCompletionsPropertyLhs(const QHash<QStri postfix = QLatin1String(": "); if (afterOn) postfix = QLatin1String(" {"); - if (const Interpreter::QmlObjectValue *qmlValue = - dynamic_cast<const Interpreter::QmlObjectValue *>(it.value())) { + if (const QmlObjectValue *qmlValue = + dynamic_cast<const QmlObjectValue *>(it.value())) { // to distinguish "anchors." from "gradient:" we check if the right hand side // type is instantiatable or is the prototype of an instantiatable object if (qmlValue->hasChildInPackage()) @@ -815,11 +815,11 @@ void QmlJSCompletionAssistProcessor::addCompletion(const QString &text, } void QmlJSCompletionAssistProcessor::addCompletions(const QHash<QString, - const QmlJS::Interpreter::Value *> &newCompletions, + const QmlJS::Value *> &newCompletions, const QIcon &icon, int order) { - QHashIterator<QString, const Interpreter::Value *> it(newCompletions); + QHashIterator<QString, const Value *> it(newCompletions); while (it.hasNext()) { it.next(); addCompletion(it.key(), icon, order); diff --git a/src/plugins/qmljseditor/qmljscompletionassist.h b/src/plugins/qmljseditor/qmljscompletionassist.h index a56b674989..bf7ed02bda 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.h +++ b/src/plugins/qmljseditor/qmljscompletionassist.h @@ -48,10 +48,8 @@ #include <QtGui/QIcon> namespace QmlJS { -namespace Interpreter { class Value; } -} namespace QmlJSEditor { namespace Internal { @@ -115,12 +113,12 @@ private: const QIcon &icon, int order, const QVariant &data = QVariant()); - void addCompletions(const QHash<QString, const QmlJS::Interpreter::Value *> &newCompletions, + void addCompletions(const QHash<QString, const QmlJS::Value *> &newCompletions, const QIcon &icon, int order); void addCompletions(const QStringList &newCompletions, const QIcon &icon, int order); void addCompletionsPropertyLhs(const QHash<QString, - const QmlJS::Interpreter::Value *> &newCompletions, + const QmlJS::Value *> &newCompletions, const QIcon &icon, int order, bool afterOn); diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 6ba4c67428..1476193d1f 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -547,14 +547,14 @@ QList<AST::Node *> SemanticInfo::rangePath(int cursorPosition) const return path; } -Interpreter::ScopeChain SemanticInfo::scopeChain(const QList<QmlJS::AST::Node *> &path) const +ScopeChain SemanticInfo::scopeChain(const QList<QmlJS::AST::Node *> &path) const { Q_ASSERT(m_rootScopeChain); if (path.isEmpty()) return *m_rootScopeChain; - Interpreter::ScopeChain scope = *m_rootScopeChain; + ScopeChain scope = *m_rootScopeChain; ScopeBuilder builder(&scope); builder.push(path); return scope; @@ -573,7 +573,7 @@ AST::Node *SemanticInfo::nodeUnderCursor(int pos) const const unsigned cursorPosition = pos; - foreach (const Interpreter::ImportInfo &import, document->bind()->imports()) { + foreach (const ImportInfo &import, document->bind()->imports()) { if (importContainsCursor(import.ast(), cursorPosition)) return import.ast(); } @@ -1249,8 +1249,8 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q if (AST::UiImport *importAst = cast<AST::UiImport *>(node)) { // if it's a file import, link to the file - foreach (const Interpreter::ImportInfo &import, semanticInfo.document->bind()->imports()) { - if (import.ast() == importAst && import.type() == Interpreter::ImportInfo::FileImport) { + foreach (const ImportInfo &import, semanticInfo.document->bind()->imports()) { + if (import.ast() == importAst && import.type() == ImportInfo::FileImport) { BaseTextEditorWidget::Link link(import.name()); link.begin = importAst->firstSourceLocation().begin(); link.end = importAst->lastSourceLocation().end(); @@ -1260,9 +1260,9 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q return Link(); } - const Interpreter::ScopeChain scopeChain = semanticInfo.scopeChain(semanticInfo.rangePath(cursorPosition)); + const ScopeChain scopeChain = semanticInfo.scopeChain(semanticInfo.rangePath(cursorPosition)); Evaluate evaluator(&scopeChain); - const Interpreter::Value *value = evaluator.reference(node); + const Value *value = evaluator.reference(node); QString fileName; int line = 0, column = 0; @@ -1317,7 +1317,7 @@ void QmlJSTextEditorWidget::showContextPane() { if (m_contextPane && m_semanticInfo.isValid()) { Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); - Interpreter::ScopeChain scopeChain = m_semanticInfo.scopeChain(m_semanticInfo.rangePath(position())); + ScopeChain scopeChain = m_semanticInfo.scopeChain(m_semanticInfo.rangePath(position())); m_contextPane->apply(editor(), m_semanticInfo.document, &scopeChain, newNode, false, true); diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 1384f39caa..31206b4481 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -118,12 +118,12 @@ public: QList<QmlJS::AST::Node *> rangePath(int cursorPosition) const; // Returns a scopeChain for the given path - QmlJS::Interpreter::ScopeChain scopeChain(const QList<QmlJS::AST::Node *> &path = QList<QmlJS::AST::Node *>()) const; + QmlJS::ScopeChain scopeChain(const QList<QmlJS::AST::Node *> &path = QList<QmlJS::AST::Node *>()) const; public: // attributes QmlJS::Document::Ptr document; QmlJS::Snapshot snapshot; - QmlJS::Interpreter::ContextPtr context; + QmlJS::ContextPtr context; QList<Range> ranges; QHash<QString, QList<QmlJS::AST::SourceLocation> > idLocations; QList<Declaration> declarations; @@ -132,7 +132,7 @@ public: // attributes QList<QmlJS::DiagnosticMessage> semanticMessages; private: - QSharedPointer<const QmlJS::Interpreter::ScopeChain> m_rootScopeChain; + QSharedPointer<const QmlJS::ScopeChain> m_rootScopeChain; friend class Internal::SemanticHighlighter; }; diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 6f08d7a38d..974ea39511 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -65,7 +65,6 @@ #include <functional> using namespace QmlJS; -using namespace QmlJS::Interpreter; using namespace QmlJS::AST; using namespace QmlJSEditor; diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 70b9cbf6a5..085c4c031d 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -55,7 +55,6 @@ using namespace Core; using namespace QmlJS; -using namespace QmlJS::Interpreter; using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; @@ -175,7 +174,7 @@ bool HoverHandler::matchColorItem(const ScopeChain &scopeChain, return false; QString color; - const Interpreter::Value *value = 0; + const Value *value = 0; if (const AST::UiScriptBinding *binding = AST::cast<const AST::UiScriptBinding *>(member)) { if (binding->qualifiedId && posIsInSource(pos, binding->statement)) { value = scopeChain.evaluate(binding->qualifiedId); @@ -189,7 +188,7 @@ bool HoverHandler::matchColorItem(const ScopeChain &scopeChain, AST::cast<const AST::UiPublicMember *>(member)) { if (publicMember->name && posIsInSource(pos, publicMember->statement)) { value = scopeChain.lookup(publicMember->name->asString()); - if (const Interpreter::Reference *ref = value->asReference()) + if (const Reference *ref = value->asReference()) value = scopeChain.context()->lookupReference(ref); color = textAt(qmlDocument, publicMember->statement->firstSourceLocation(), @@ -215,20 +214,20 @@ void HoverHandler::handleOrdinaryMatch(const ScopeChain &scopeChain, AST::Node * { if (node && !(AST::cast<AST::StringLiteral *>(node) != 0 || AST::cast<AST::NumericLiteral *>(node) != 0)) { - const Interpreter::Value *value = scopeChain.evaluate(node); + const Value *value = scopeChain.evaluate(node); prettyPrintTooltip(value, scopeChain.context()); } } void HoverHandler::handleImport(const ScopeChain &scopeChain, AST::UiImport *node) { - const Interpreter::Imports *imports = scopeChain.context()->imports(scopeChain.document().data()); + const Imports *imports = scopeChain.context()->imports(scopeChain.document().data()); if (!imports) return; - foreach (const Interpreter::Import &import, imports->all()) { + foreach (const Import &import, imports->all()) { if (import.info.ast() == node) { - if (import.info.type() == Interpreter::ImportInfo::LibraryImport + if (import.info.type() == ImportInfo::LibraryImport && !import.libraryPath.isEmpty()) { QString msg = tr("Library at %1").arg(import.libraryPath); const LibraryInfo &libraryInfo = scopeChain.context()->snapshot().libraryInfo(import.libraryPath); @@ -270,16 +269,16 @@ void HoverHandler::operateTooltip(TextEditor::ITextEditor *editor, const QPoint } } -void HoverHandler::prettyPrintTooltip(const QmlJS::Interpreter::Value *value, - const QmlJS::Interpreter::ContextPtr &context) +void HoverHandler::prettyPrintTooltip(const QmlJS::Value *value, + const QmlJS::ContextPtr &context) { if (! value) return; - if (const Interpreter::ObjectValue *objectValue = value->asObjectValue()) { - Interpreter::PrototypeIterator iter(objectValue, context); + if (const ObjectValue *objectValue = value->asObjectValue()) { + PrototypeIterator iter(objectValue, context); while (iter.hasNext()) { - const Interpreter::ObjectValue *prototype = iter.next(); + const ObjectValue *prototype = iter.next(); const QString className = prototype->className(); if (! className.isEmpty()) { @@ -287,8 +286,8 @@ void HoverHandler::prettyPrintTooltip(const QmlJS::Interpreter::Value *value, break; } } - } else if (const Interpreter::QmlEnumValue *enumValue = - dynamic_cast<const Interpreter::QmlEnumValue *>(value)) { + } else if (const QmlEnumValue *enumValue = + dynamic_cast<const QmlEnumValue *>(value)) { setToolTip(enumValue->name()); } @@ -300,10 +299,10 @@ void HoverHandler::prettyPrintTooltip(const QmlJS::Interpreter::Value *value, } // if node refers to a property, its name and defining object are returned - otherwise zero -static const Interpreter::ObjectValue *isMember(const ScopeChain &scopeChain, +static const ObjectValue *isMember(const ScopeChain &scopeChain, AST::Node *node, QString *name) { - const Interpreter::ObjectValue *owningObject = 0; + const ObjectValue *owningObject = 0; if (AST::IdentifierExpression *identExp = AST::cast<AST::IdentifierExpression *>(node)) { if (!identExp->name) return 0; @@ -313,7 +312,7 @@ static const Interpreter::ObjectValue *isMember(const ScopeChain &scopeChain, if (!fme->base || !fme->name) return 0; *name = fme->name->asString(); - const Interpreter::Value *base = scopeChain.evaluate(fme->base); + const Value *base = scopeChain.evaluate(fme->base); if (!base) return 0; owningObject = base->asObjectValue(); @@ -323,11 +322,11 @@ static const Interpreter::ObjectValue *isMember(const ScopeChain &scopeChain, if (!qid->name) return 0; *name = qid->name->asString(); - const Interpreter::Value *value = scopeChain.lookup(*name, &owningObject); + const Value *value = scopeChain.lookup(*name, &owningObject); for (AST::UiQualifiedId *it = qid->next; it; it = it->next) { if (!value) return 0; - const Interpreter::ObjectValue *next = value->asObjectValue(); + const ObjectValue *next = value->asObjectValue(); if (!next || !it->name) return 0; *name = it->name->asString(); @@ -341,7 +340,7 @@ TextEditor::HelpItem HoverHandler::qmlHelpItem(const ScopeChain &scopeChain, AST::Node *node) const { QString name; - if (const Interpreter::ObjectValue *scope = isMember(scopeChain, node, &name)) { + if (const ObjectValue *scope = isMember(scopeChain, node, &name)) { // maybe it's a type? if (!name.isEmpty() && name.at(0).isUpper()) { const QString maybeHelpId(QLatin1String("QML.") + name); @@ -350,11 +349,11 @@ TextEditor::HelpItem HoverHandler::qmlHelpItem(const ScopeChain &scopeChain, } // otherwise, it's probably a property - const Interpreter::ObjectValue *lastScope; + const ObjectValue *lastScope; scope->lookupMember(name, scopeChain.context(), &lastScope); - Interpreter::PrototypeIterator iter(scope, scopeChain.context()); + PrototypeIterator iter(scope, scopeChain.context()); while (iter.hasNext()) { - const Interpreter::ObjectValue *cur = iter.next(); + const ObjectValue *cur = iter.next(); const QString className = cur->className(); if (!className.isEmpty()) { diff --git a/src/plugins/qmljseditor/qmljshoverhandler.h b/src/plugins/qmljseditor/qmljshoverhandler.h index 789e443fab..b817eee700 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.h +++ b/src/plugins/qmljseditor/qmljshoverhandler.h @@ -51,13 +51,11 @@ class ITextEditor; } namespace QmlJS { -namespace Interpreter { class ScopeChain; class Context; typedef QSharedPointer<const Context> ContextPtr; class Value; } -} namespace QmlJSEditor { class QmlJSTextEditorWidget; @@ -78,19 +76,19 @@ private: virtual void operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point); bool matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos); - bool matchColorItem(const QmlJS::Interpreter::ScopeChain &lookupContext, + bool matchColorItem(const QmlJS::ScopeChain &lookupContext, const QmlJS::Document::Ptr &qmlDocument, const QList<QmlJS::AST::Node *> &astPath, unsigned pos); - void handleOrdinaryMatch(const QmlJS::Interpreter::ScopeChain &lookupContext, + void handleOrdinaryMatch(const QmlJS::ScopeChain &lookupContext, QmlJS::AST::Node *node); - void handleImport(const QmlJS::Interpreter::ScopeChain &lookupContext, + void handleImport(const QmlJS::ScopeChain &lookupContext, QmlJS::AST::UiImport *node); - void prettyPrintTooltip(const QmlJS::Interpreter::Value *value, - const QmlJS::Interpreter::ContextPtr &context); + void prettyPrintTooltip(const QmlJS::Value *value, + const QmlJS::ContextPtr &context); - TextEditor::HelpItem qmlHelpItem(const QmlJS::Interpreter::ScopeChain &lookupContext, + TextEditor::HelpItem qmlHelpItem(const QmlJS::ScopeChain &lookupContext, QmlJS::AST::Node *node) const; QmlJS::ModelManagerInterface *m_modelManager; diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 32544d9565..ce327575b5 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -137,8 +137,8 @@ SemanticInfo SemanticHighlighter::semanticInfo(const SemanticHighlighterSource & QmlJS::Link link(snapshot, modelManager->importPaths(), modelManager->builtins(doc)); semanticInfo.context = link(doc, &semanticInfo.semanticMessages); - QmlJS::Interpreter::ScopeChain *scopeChain = new QmlJS::Interpreter::ScopeChain(doc, semanticInfo.context); - semanticInfo.m_rootScopeChain = QSharedPointer<const QmlJS::Interpreter::ScopeChain>(scopeChain); + QmlJS::ScopeChain *scopeChain = new QmlJS::ScopeChain(doc, semanticInfo.context); + semanticInfo.m_rootScopeChain = QSharedPointer<const QmlJS::ScopeChain>(scopeChain); QmlJS::Check checker(doc, semanticInfo.context); semanticInfo.semanticMessages.append(checker()); diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index 56974af0d5..63569ec622 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -72,8 +72,8 @@ QVariant QmlOutlineItem::data(int role) const return QVariant(); QList<AST::Node *> astPath = m_outlineModel->m_semanticInfo.rangePath(location.begin()); - Interpreter::ScopeChain scopeChain = m_outlineModel->m_semanticInfo.scopeChain(astPath); - const Interpreter::Value *value = scopeChain.evaluate(uiQualifiedId); + ScopeChain scopeChain = m_outlineModel->m_semanticInfo.scopeChain(astPath); + const Value *value = scopeChain.evaluate(uiQualifiedId); return prettyPrint(value, scopeChain.context()); } @@ -99,12 +99,12 @@ void QmlOutlineItem::setItemData(const QMap<int, QVariant> &roles) } } -QString QmlOutlineItem::prettyPrint(const Interpreter::Value *value, const Interpreter::ContextPtr &context) const +QString QmlOutlineItem::prettyPrint(const Value *value, const ContextPtr &context) const { if (! value) return QString(); - if (const Interpreter::ObjectValue *objectValue = value->asObjectValue()) { + if (const ObjectValue *objectValue = value->asObjectValue()) { const QString className = objectValue->className(); if (!className.isEmpty()) { return className; diff --git a/src/plugins/qmljseditor/qmloutlinemodel.h b/src/plugins/qmljseditor/qmloutlinemodel.h index c0cd9331a8..5cb885218f 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.h +++ b/src/plugins/qmljseditor/qmloutlinemodel.h @@ -41,11 +41,9 @@ #include <QtGui/QStandardItemModel> namespace QmlJS { -namespace Interpreter { class Value; class Context; } -} namespace QmlJSEditor { namespace Internal { @@ -64,7 +62,7 @@ public: void setItemData(const QMap<int, QVariant> &roles); private: - QString prettyPrint(const QmlJS::Interpreter::Value *value, const QmlJS::Interpreter::ContextPtr &context) const; + QString prettyPrint(const QmlJS::Value *value, const QmlJS::ContextPtr &context) const; QmlOutlineModel *m_outlineModel; }; diff --git a/src/plugins/qmljseditor/qmltaskmanager.cpp b/src/plugins/qmljseditor/qmltaskmanager.cpp index 3606147f16..df48b6bc32 100644 --- a/src/plugins/qmljseditor/qmltaskmanager.cpp +++ b/src/plugins/qmljseditor/qmltaskmanager.cpp @@ -73,7 +73,7 @@ void QmlTaskManager::collectMessages(QFutureInterface<FileErrorMessages> &future Snapshot snapshot, QStringList files, QStringList /*importPaths*/) { // ### link and check error messages are disabled for now: too many false-positives! - //Interpreter::Context ctx(snapshot); + //Context ctx(snapshot); //QHash<QString, QList<DiagnosticMessage> > linkMessages; //Link link(&ctx, snapshot, importPaths); //link(&linkMessages); diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp index c2cd62f2eb..b9daf07ce1 100644 --- a/src/plugins/qmljseditor/quicktoolbar.cpp +++ b/src/plugins/qmljseditor/quicktoolbar.cpp @@ -64,7 +64,7 @@ static inline QString textAt(const Document* doc, return doc->source().mid(from.offset, to.end() - from.begin()); } -static inline const Interpreter::ObjectValue * getPropertyChangesTarget(Node *node, const Interpreter::ScopeChain &scopeChain) +static inline const ObjectValue * getPropertyChangesTarget(Node *node, const ScopeChain &scopeChain) { UiObjectInitializer *initializer = 0; if (UiObjectDefinition *definition = cast<UiObjectDefinition *>(node)) @@ -78,8 +78,8 @@ static inline const Interpreter::ObjectValue * getPropertyChangesTarget(Node *no && scriptBinding->qualifiedId->name->asString() == QLatin1String("target") && ! scriptBinding->qualifiedId->next) { Evaluate evaluator(&scopeChain); - const Interpreter::Value *targetValue = evaluator(scriptBinding->statement); - if (const Interpreter::ObjectValue *targetObject = Interpreter::value_cast<const Interpreter::ObjectValue *>(targetValue)) { + const Value *targetValue = evaluator(scriptBinding->statement); + if (const ObjectValue *targetObject = value_cast<const ObjectValue *>(targetValue)) { return targetObject; } else { return 0; @@ -131,7 +131,7 @@ QuickToolBar::~QuickToolBar() m_widget.clear(); } -void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const Interpreter::ScopeChain *scopeChain, AST::Node *node, bool update, bool force) +void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force) { if (!QuickToolBarSettings::get().enableContextPane && !force && !update) { contextWidget()->hide(); @@ -146,24 +146,24 @@ void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr docum m_blockWriting = true; - const Interpreter::ObjectValue *scopeObject = document->bind()->findQmlObject(node); + const ObjectValue *scopeObject = document->bind()->findQmlObject(node); bool isPropertyChanges = false; if (scopeChain && scopeObject) { m_prototypes.clear(); - foreach (const Interpreter::ObjectValue *object, - Interpreter::PrototypeIterator(scopeObject, scopeChain->context()).all()) { + foreach (const ObjectValue *object, + PrototypeIterator(scopeObject, scopeChain->context()).all()) { m_prototypes.append(object->className()); } if (m_prototypes.contains("PropertyChanges")) { isPropertyChanges = true; - const Interpreter::ObjectValue *targetObject = getPropertyChangesTarget(node, *scopeChain); + const ObjectValue *targetObject = getPropertyChangesTarget(node, *scopeChain); m_prototypes.clear(); if (targetObject) { - foreach (const Interpreter::ObjectValue *object, - Interpreter::PrototypeIterator(targetObject, scopeChain->context()).all()) { + foreach (const ObjectValue *object, + PrototypeIterator(targetObject, scopeChain->context()).all()) { m_prototypes.append(object->className()); } } diff --git a/src/plugins/qmljseditor/quicktoolbar.h b/src/plugins/qmljseditor/quicktoolbar.h index 11eeea81bc..a9e9a765db 100644 --- a/src/plugins/qmljseditor/quicktoolbar.h +++ b/src/plugins/qmljseditor/quicktoolbar.h @@ -52,7 +52,7 @@ class QuickToolBar : public QmlJS::IContextPane public: QuickToolBar(QObject *parent = 0); ~QuickToolBar(); - void apply(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, const QmlJS::Interpreter::ScopeChain *scopeChain, QmlJS::AST::Node *node, bool update, bool force = false); + void apply(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, const QmlJS::ScopeChain *scopeChain, QmlJS::AST::Node *node, bool update, bool force = false); bool isAvailable(TextEditor::BaseTextEditor *editor, QmlJS::Document::Ptr document, QmlJS::AST::Node *node); void setProperty(const QString &propertyName, const QVariant &value); void removeProperty(const QString &propertyName); diff --git a/src/plugins/qmljstools/qmljslocatordata.cpp b/src/plugins/qmljstools/qmljslocatordata.cpp index d21dc9dc21..a7f84c9319 100644 --- a/src/plugins/qmljstools/qmljslocatordata.cpp +++ b/src/plugins/qmljstools/qmljslocatordata.cpp @@ -39,7 +39,6 @@ using namespace QmlJSTools::Internal; using namespace QmlJS; -using namespace QmlJS::Interpreter; using namespace QmlJS::AST; LocatorData::LocatorData(QObject *parent) diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 283e13e996..6ec07db623 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -128,16 +128,16 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath) if (qmlTypesFiles.at(i).baseName() == QLatin1String("builtins")) { QFileInfoList list; list.append(qmlTypesFiles.at(i)); - Interpreter::CppQmlTypesLoader::defaultQtObjects = - Interpreter::CppQmlTypesLoader::loadQmlTypes(list, &errors, &warnings); + CppQmlTypesLoader::defaultQtObjects = + CppQmlTypesLoader::loadQmlTypes(list, &errors, &warnings); qmlTypesFiles.removeAt(i); break; } } // load the fallbacks for libraries - Interpreter::CppQmlTypesLoader::defaultLibraryObjects.unite( - Interpreter::CppQmlTypesLoader::loadQmlTypes(qmlTypesFiles, &errors, &warnings)); + CppQmlTypesLoader::defaultLibraryObjects.unite( + CppQmlTypesLoader::loadQmlTypes(qmlTypesFiles, &errors, &warnings)); Core::MessageManager *messageManager = Core::MessageManager::instance(); foreach (const QString &error, errors) @@ -362,12 +362,12 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho QStringList *importedFiles, QSet<QString> *scannedPaths) { // scan files and directories that are explicitly imported - foreach (const Interpreter::ImportInfo &import, doc->bind()->imports()) { + foreach (const ImportInfo &import, doc->bind()->imports()) { const QString &importName = import.name(); - if (import.type() == Interpreter::ImportInfo::FileImport) { + if (import.type() == ImportInfo::FileImport) { if (! snapshot.document(importName)) *importedFiles += importName; - } else if (import.type() == Interpreter::ImportInfo::DirectoryImport) { + } else if (import.type() == ImportInfo::DirectoryImport) { if (snapshot.documentsInDirectory(importName).isEmpty()) { if (! scannedPaths->contains(importName)) { *importedFiles += qmlFilesInDirectory(importName); @@ -473,14 +473,14 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap // scan dir and lib imports const QStringList importPaths = modelManager->importPaths(); - foreach (const Interpreter::ImportInfo &import, doc->bind()->imports()) { - if (import.type() == Interpreter::ImportInfo::DirectoryImport) { + foreach (const ImportInfo &import, doc->bind()->imports()) { + if (import.type() == ImportInfo::DirectoryImport) { const QString targetPath = import.name(); findNewQmlLibraryInPath(targetPath, snapshot, modelManager, importedFiles, scannedPaths, newLibraries); } - if (import.type() == Interpreter::ImportInfo::LibraryImport) { + if (import.type() == ImportInfo::LibraryImport) { if (!import.version().isValid()) continue; foreach (const QString &importPath, importPaths) { diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index 8fc3fa7962..2fcfdd5775 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -229,7 +229,7 @@ static QList<FakeMetaObject::ConstPtr> parseHelper(const QByteArray &qmlTypeDesc { QList<FakeMetaObject::ConstPtr> ret; QHash<QString, FakeMetaObject::ConstPtr> newObjects; - Interpreter::CppQmlTypesLoader::parseQmlTypeDescriptions(qmlTypeDescriptions, &newObjects, + CppQmlTypesLoader::parseQmlTypeDescriptions(qmlTypeDescriptions, &newObjects, error, warning); if (error->isEmpty()) { |