From 39c2575ab3bfef828cf952f99e7a1cc9f60ef732 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Wed, 27 Jan 2010 14:37:24 +0100 Subject: [PATCH] Removed obsolete code Done with: Erik --- src/libs/qmljs/qmljs-lib.pri | 19 +- src/libs/qmljs/qmljsdocument.cpp | 27 -- src/libs/qmljs/qmljsdocument.h | 10 - src/libs/qmljs/qmljsidcollector.cpp | 121 ------- src/libs/qmljs/qmljsidcollector.h | 74 ----- src/libs/qmljs/qmljsmetatypebackend.cpp | 43 --- src/libs/qmljs/qmljsmetatypebackend.h | 60 ---- src/libs/qmljs/qmljspackageinfo.cpp | 39 --- src/libs/qmljs/qmljspackageinfo.h | 61 ---- src/libs/qmljs/qmljssymbol.cpp | 234 -------------- src/libs/qmljs/qmljssymbol.h | 163 ---------- src/libs/qmljs/qmljstypesystem.cpp | 70 ---- src/libs/qmljs/qmljstypesystem.h | 61 ---- .../qmljs/qtdeclarativemetatypebackend.cpp | 181 ----------- src/libs/qmljs/qtdeclarativemetatypebackend.h | 72 ----- src/plugins/qmljseditor/qmlcodecompletion.cpp | 8 +- src/plugins/qmljseditor/qmlcodecompletion.h | 4 +- src/plugins/qmljseditor/qmlhoverhandler.cpp | 13 - src/plugins/qmljseditor/qmljseditor.cpp | 8 +- src/plugins/qmljseditor/qmljseditor.h | 5 - src/plugins/qmljseditor/qmljseditor.pro | 8 +- src/plugins/qmljseditor/qmljseditorplugin.cpp | 4 +- src/plugins/qmljseditor/qmllookupcontext.cpp | 298 ------------------ src/plugins/qmljseditor/qmllookupcontext.h | 82 ----- .../qmljseditor/qmlmodelmanagerinterface.h | 1 - .../qmljseditor/qmlresolveexpression.cpp | 131 -------- .../qmljseditor/qmlresolveexpression.h | 66 ---- 27 files changed, 8 insertions(+), 1855 deletions(-) delete mode 100644 src/libs/qmljs/qmljsidcollector.cpp delete mode 100644 src/libs/qmljs/qmljsidcollector.h delete mode 100644 src/libs/qmljs/qmljsmetatypebackend.cpp delete mode 100644 src/libs/qmljs/qmljsmetatypebackend.h delete mode 100644 src/libs/qmljs/qmljspackageinfo.cpp delete mode 100644 src/libs/qmljs/qmljspackageinfo.h delete mode 100644 src/libs/qmljs/qmljssymbol.cpp delete mode 100644 src/libs/qmljs/qmljssymbol.h delete mode 100644 src/libs/qmljs/qmljstypesystem.cpp delete mode 100644 src/libs/qmljs/qmljstypesystem.h delete mode 100644 src/libs/qmljs/qtdeclarativemetatypebackend.cpp delete mode 100644 src/libs/qmljs/qtdeclarativemetatypebackend.h delete mode 100644 src/plugins/qmljseditor/qmllookupcontext.cpp delete mode 100644 src/plugins/qmljseditor/qmllookupcontext.h delete mode 100644 src/plugins/qmljseditor/qmlresolveexpression.cpp delete mode 100644 src/plugins/qmljseditor/qmlresolveexpression.h diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri index 4d450da21b6..37be93dd0b9 100644 --- a/src/libs/qmljs/qmljs-lib.pri +++ b/src/libs/qmljs/qmljs-lib.pri @@ -16,36 +16,19 @@ HEADERS += \ $$PWD/qmljsbind.h \ $$PWD/qmljscheck.h \ $$PWD/qmljsdocument.h \ - $$PWD/qmljsidcollector.h \ - $$PWD/qmljsmetatypebackend.h \ - $$PWD/qmljspackageinfo.h \ $$PWD/qmljsscanner.h \ - $$PWD/qmljssymbol.h \ - $$PWD/qmljstypesystem.h \ - $$PWD/qmljsinterpreter.h \ - $$PWD/qmljsmetatypesystem.h + $$PWD/qmljsinterpreter.h SOURCES += \ $$PWD/qmljsbind.cpp \ $$PWD/qmljscheck.cpp \ $$PWD/qmljsdocument.cpp \ - $$PWD/qmljsidcollector.cpp \ - $$PWD/qmljsmetatypebackend.cpp \ - $$PWD/qmljspackageinfo.cpp \ $$PWD/qmljsscanner.cpp \ - $$PWD/qmljssymbol.cpp \ - $$PWD/qmljstypesystem.cpp \ $$PWD/qmljsinterpreter.cpp \ $$PWD/qmljsmetatypesystem.cpp contains(QT_CONFIG, declarative) { QT += declarative - - HEADERS += \ - $$PWD/qtdeclarativemetatypebackend.h - - SOURCES += \ - $$PWD/qtdeclarativemetatypebackend.cpp } else { DEFINES += NO_DECLARATIVE_BACKEND } diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index f93480152e2..262d7745e31 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -27,7 +27,6 @@ ** **************************************************************************/ -#include "qmljsidcollector.h" #include "qmljsdocument.h" #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljslexer_p.h> @@ -70,8 +69,6 @@ Document::~Document() if (_pool) delete _pool; - - qDeleteAll(_symbols); } Document::Ptr Document::create(const QString &fileName) @@ -136,7 +133,6 @@ bool Document::parseQml() _engine = new Engine(); _pool = new NodePool(_fileName, _engine); - _ids.clear(); Lexer lexer(_engine); Parser parser(_engine); @@ -147,17 +143,6 @@ bool Document::parseQml() _ast = parser.ast(); _diagnosticMessages = parser.diagnosticMessages(); - if (qmlProgram()) { - for (QmlJS::AST::UiObjectMemberList *iter = qmlProgram()->members; iter; iter = iter->next) - if (iter->member) - _symbols.append(new SymbolFromFile(_fileName, iter->member)); - - Internal::IdCollector collect; - _ids = collect(*this); - if (_diagnosticMessages.isEmpty()) - _diagnosticMessages = collect.diagnosticMessages(); - } - return _parsedCorrectly; } @@ -169,7 +154,6 @@ bool Document::parseJavaScript() _engine = new Engine(); _pool = new NodePool(_fileName, _engine); - _ids.clear(); Lexer lexer(_engine); Parser parser(_engine); @@ -191,7 +175,6 @@ bool Document::parseExpression() _engine = new Engine(); _pool = new NodePool(_fileName, _engine); - _ids.clear(); Lexer lexer(_engine); Parser parser(_engine); @@ -207,16 +190,6 @@ bool Document::parseExpression() return _parsedCorrectly; } -SymbolFromFile *Document::findSymbol(QmlJS::AST::Node *node) const -{ - foreach (Symbol *symbol, _symbols) - if (symbol->isSymbolFromFile()) - if (symbol->asSymbolFromFile()->node() == node) - return symbol->asSymbolFromFile(); - - return 0; -} - Snapshot::Snapshot() { } diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index ac3a9c34e04..4ba69aa7c7a 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -37,7 +37,6 @@ #include "parser/qmljsengine_p.h" #include "qmljs_global.h" -#include "qmljssymbol.h" namespace QmlJS { @@ -46,7 +45,6 @@ class QMLJS_EXPORT Document public: typedef QSharedPointer<Document> Ptr; typedef QList<Document::Ptr> PtrList; - typedef QMap<QString, IdSymbol*> IdTable; protected: Document(const QString &fileName); @@ -76,16 +74,10 @@ public: int documentRevision() const; void setDocumentRevision(int documentRevision); - IdTable ids() const { return _ids; } - QString fileName() const { return _fileName; } QString path() const { return _path; } QString componentName() const { return _componentName; } - QmlJS::SymbolFromFile *findSymbol(QmlJS::AST::Node *node) const; - QmlJS::Symbol::List symbols() const - { return _symbols; } - private: QmlJS::Engine *_engine; QmlJS::NodePool *_pool; @@ -97,8 +89,6 @@ private: QString _path; QString _componentName; QString _source; - IdTable _ids; - QmlJS::Symbol::List _symbols; }; class QMLJS_EXPORT Snapshot diff --git a/src/libs/qmljs/qmljsidcollector.cpp b/src/libs/qmljs/qmljsidcollector.cpp deleted file mode 100644 index 788510cbff3..00000000000 --- a/src/libs/qmljs/qmljsidcollector.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include <QDebug> - -#include <qmljs/parser/qmljsast_p.h> - -#include "qmljsidcollector.h" - -using namespace QmlJS; -using namespace QmlJS::AST; -using namespace QmlJS; -using namespace QmlJS::Internal; - -QMap<QString, IdSymbol*> IdCollector::operator()(QmlJS::Document &doc) -{ - _doc = &doc; - _ids.clear(); - _currentSymbol = 0; - - Node::accept(doc.qmlProgram(), this); - - return _ids; -} - -bool IdCollector::visit(UiArrayBinding *ast) -{ - SymbolFromFile *oldSymbol = switchSymbol(ast); - Node::accept(ast->members, this); - _currentSymbol = oldSymbol; - return false; -} - -bool IdCollector::visit(QmlJS::AST::UiObjectBinding *ast) -{ - SymbolFromFile *oldSymbol = switchSymbol(ast); - Node::accept(ast->initializer, this); - _currentSymbol = oldSymbol; - return false; -} - -bool IdCollector::visit(QmlJS::AST::UiObjectDefinition *ast) -{ - SymbolFromFile *oldSymbol = switchSymbol(ast); - Node::accept(ast->initializer, this); - _currentSymbol = oldSymbol; - return false; -} - -bool IdCollector::visit(QmlJS::AST::UiScriptBinding *ast) -{ - if (!(ast->qualifiedId->next) && ast->qualifiedId->name->asString() == "id") - if (ExpressionStatement *e = cast<ExpressionStatement*>(ast->statement)) - if (IdentifierExpression *i = cast<IdentifierExpression*>(e->expression)) - if (i->name) - addId(i->name->asString(), ast); - - return false; -} - -SymbolFromFile *IdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node) -{ - SymbolFromFile *newSymbol = 0; - - if (_currentSymbol == 0) { - newSymbol = _doc->findSymbol(node); - } else { - newSymbol = _currentSymbol->findMember(node); - } - - SymbolFromFile *oldSymbol = _currentSymbol; - - if (newSymbol) { - _currentSymbol = newSymbol; - } else { - QString filename = _doc->fileName(); - qWarning() << "Scope without symbol @"<<filename<<":"<<node->firstSourceLocation().startLine<<":"<<node->firstSourceLocation().startColumn; - } - - return oldSymbol; -} - -void IdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast) -{ - if (!_currentSymbol) - return; - - if (_ids.contains(id)) { - _diagnosticMessages.append(DiagnosticMessage(DiagnosticMessage::Warning, ast->statement->firstSourceLocation(), "Duplicate ID")); - } else { - if (SymbolFromFile *symbol = _currentSymbol->findMember(ast)) - if (IdSymbol *idSymbol = symbol->asIdSymbol()) - _ids[id] = idSymbol; - } -} diff --git a/src/libs/qmljs/qmljsidcollector.h b/src/libs/qmljs/qmljsidcollector.h deleted file mode 100644 index fbf520938e8..00000000000 --- a/src/libs/qmljs/qmljsidcollector.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QMLIDCOLLECTOR_H -#define QMLIDCOLLECTOR_H - -#include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/parser/qmljsengine_p.h> -#include <qmljs/qmljsdocument.h> -#include <qmljs/qmljssymbol.h> - -#include <QMap> -#include <QPair> -#include <QStack> -#include <QString> - -namespace QmlJS { -namespace Internal { - -class QMLJS_EXPORT IdCollector: protected AST::Visitor -{ -public: - QMap<QString, IdSymbol*> operator()(Document &doc); - - QList<DiagnosticMessage> diagnosticMessages() - { return _diagnosticMessages; } - -protected: - virtual bool visit(AST::UiArrayBinding *ast); - virtual bool visit(AST::UiObjectBinding *ast); - virtual bool visit(AST::UiObjectDefinition *ast); - virtual bool visit(AST::UiScriptBinding *ast); - -private: - SymbolFromFile *switchSymbol(AST::UiObjectMember *node); - void addId(const QString &id, AST::UiScriptBinding *ast); - -private: - Document *_doc; - QMap<QString, IdSymbol*> _ids; - SymbolFromFile *_currentSymbol; - QList<DiagnosticMessage> _diagnosticMessages; -}; - -} // namespace Internal -} // namespace Qml - -#endif // QMLIDCOLLECTOR_H diff --git a/src/libs/qmljs/qmljsmetatypebackend.cpp b/src/libs/qmljs/qmljsmetatypebackend.cpp deleted file mode 100644 index 374bb304aee..00000000000 --- a/src/libs/qmljs/qmljsmetatypebackend.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qmljsmetatypebackend.h" -#include "qmljstypesystem.h" - -using namespace QmlJS; - -MetaTypeBackend::MetaTypeBackend(TypeSystem *typeSystem): - m_typeSystem(typeSystem) -{ - Q_ASSERT(typeSystem); -} - -MetaTypeBackend::~MetaTypeBackend() -{ -} diff --git a/src/libs/qmljs/qmljsmetatypebackend.h b/src/libs/qmljs/qmljsmetatypebackend.h deleted file mode 100644 index d21a105df15..00000000000 --- a/src/libs/qmljs/qmljsmetatypebackend.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QMLMETATYPEBACKEND_H -#define QMLMETATYPEBACKEND_H - -#include <qmljs/qmljs_global.h> -#include <qmljs/qmljspackageinfo.h> -#include <qmljs/qmljssymbol.h> - -namespace QmlJS { - -class TypeSystem; - -class QMLJS_EXPORT MetaTypeBackend -{ -public: - MetaTypeBackend(TypeSystem *typeSystem); - virtual ~MetaTypeBackend() = 0; - - virtual QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion) = 0; - virtual Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages) = 0; - -protected: - TypeSystem *typeSystem() const - { return m_typeSystem; } - -private: - TypeSystem *m_typeSystem; -}; - -} // namespace Qml - -#endif // QMLMETATYPEBACKEND_H diff --git a/src/libs/qmljs/qmljspackageinfo.cpp b/src/libs/qmljs/qmljspackageinfo.cpp deleted file mode 100644 index 0a89a6f917c..00000000000 --- a/src/libs/qmljs/qmljspackageinfo.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qmljspackageinfo.h" - -using namespace QmlJS; - -PackageInfo::PackageInfo(const QString &name, int majorVersion, int minorVersion): - m_name(name), - m_majorVersion(majorVersion), - m_minorVersion(minorVersion) -{ -} diff --git a/src/libs/qmljs/qmljspackageinfo.h b/src/libs/qmljs/qmljspackageinfo.h deleted file mode 100644 index b63cecbb8ec..00000000000 --- a/src/libs/qmljs/qmljspackageinfo.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef PACKAGEINFO_H -#define PACKAGEINFO_H - -#include <qmljs/qmljs_global.h> - -#include <QtCore/QString> - -namespace QmlJS { - -class QMLJS_EXPORT PackageInfo -{ -public: - PackageInfo(const QString &name, int majorVersion, int minorVersion); - - QString name() const - { return m_name; } - - int majorVersion() const - { return m_majorVersion; } - - int minorVersion() const - { return m_minorVersion; } - -private: - QString m_name; - int m_majorVersion; - int m_minorVersion; -}; - -} // namespace Qml - -#endif // PACKAGEINFO_H diff --git a/src/libs/qmljs/qmljssymbol.cpp b/src/libs/qmljs/qmljssymbol.cpp deleted file mode 100644 index ca20e4319a2..00000000000 --- a/src/libs/qmljs/qmljssymbol.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qmljssymbol.h" - -#include <qmljs/parser/qmljsast_p.h> -#include <qmljs/parser/qmljsengine_p.h> - -using namespace QmlJS; -using namespace QmlJS; -using namespace QmlJS::AST; - -Symbol::~Symbol() -{ -} - -bool Symbol::isBuildInSymbol() -{ return asPrimitiveSymbol() != 0; } - -bool Symbol::isSymbolFromFile() -{ return asSymbolFromFile() != 0; } - -bool Symbol::isIdSymbol() -{ return asIdSymbol() != 0; } - -bool Symbol::isPropertyDefinitionSymbol() -{ return asPropertyDefinitionSymbol() != 0; } - -PrimitiveSymbol *Symbol::asPrimitiveSymbol() -{ return 0; } - -SymbolFromFile *Symbol::asSymbolFromFile() -{ return 0; } - -IdSymbol *Symbol::asIdSymbol() -{ return 0; } - -PropertyDefinitionSymbol *Symbol::asPropertyDefinitionSymbol() -{ return 0; } - -PrimitiveSymbol::~PrimitiveSymbol() -{} - -PrimitiveSymbol *PrimitiveSymbol::asPrimitiveSymbol() -{ return this; } - -SymbolWithMembers::~SymbolWithMembers() -{ qDeleteAll(_members); } - -const Symbol::List SymbolWithMembers::members() -{ return _members; } - -SymbolFromFile::SymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node): - _fileName(fileName), - _node(node) -{ - if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(_node)) { - if (objectBinding->initializer) - for (UiObjectMemberList *iter = objectBinding->initializer->members; iter; iter = iter->next) - if (iter->member) - todo.append(iter->member); - } else if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(_node)) { - if (objectDefinition->initializer) - for (UiObjectMemberList *iter = objectDefinition->initializer->members; iter; iter = iter->next) - if (iter->member) - todo.append(iter->member); - } else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(_node)) { - for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next) - if (iter->member) - todo.append(iter->member); - } -} - -SymbolFromFile::~SymbolFromFile() -{} - -SymbolFromFile *SymbolFromFile::asSymbolFromFile() -{ return this; } - -int SymbolFromFile::line() const -{ return _node->firstSourceLocation().startLine; } - -int SymbolFromFile::column() const -{ return _node->firstSourceLocation().startColumn; } - -static inline QString toString(UiQualifiedId *qId) -{ - QString result; - - for (UiQualifiedId *iter = qId; iter; iter = iter->next) { - if (!iter->name) - continue; - - result += iter->name->asString(); - - if (iter->next) - result += '.'; - } - - return result; -} - -const QString SymbolFromFile::name() const -{ - if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(_node)) - return toString(objectBinding->qualifiedId); - else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(_node)) - return toString(scriptBinding->qualifiedId); - else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(_node)) - return toString(arrayBinding->qualifiedId); - else if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(_node)) - return toString(objectDefinition->qualifiedTypeNameId); - else - return QString::null; -} - -const Symbol::List SymbolFromFile::members() -{ - if (!todo.isEmpty()) { - foreach (Node *todoNode, todo) { - if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(todoNode)) - _members.append(new SymbolFromFile(fileName(), objectBinding)); - else if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(todoNode)) - _members.append(new SymbolFromFile(fileName(), objectDefinition)); - else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(todoNode)) - _members.append(new SymbolFromFile(fileName(), arrayBinding)); - else if (UiPublicMember *publicMember = cast<UiPublicMember*>(todoNode)) - _members.append(new PropertyDefinitionSymbol(fileName(), publicMember)); - else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(todoNode)) { - if (scriptBinding->qualifiedId && scriptBinding->qualifiedId->name && scriptBinding->qualifiedId->name->asString() == QLatin1String("id") && !scriptBinding->qualifiedId->next) - _members.append(new IdSymbol(fileName(), scriptBinding, this)); - else - _members.append(new SymbolFromFile(fileName(), scriptBinding)); - } - } - - todo.clear(); - } - - return _members; -} - -bool SymbolFromFile::isProperty() const -{ return cast<UiObjectDefinition*>(_node) == 0; } - -SymbolFromFile *SymbolFromFile::findMember(QmlJS::AST::Node *memberNode) -{ - List symbols = members(); - - foreach (Symbol *symbol, symbols) - if (symbol->isSymbolFromFile()) - if (memberNode == symbol->asSymbolFromFile()->node()) - return symbol->asSymbolFromFile(); - - return 0; -} - -IdSymbol::IdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, SymbolFromFile *parentNode): - SymbolFromFile(fileName, idNode), - _parentNode(parentNode) -{} - -IdSymbol::~IdSymbol() -{} - -IdSymbol *IdSymbol::asIdSymbol() -{ return this; } - -int IdSymbol::line() const -{ return idNode()->statement->firstSourceLocation().startLine; } - -int IdSymbol::column() const -{ return idNode()->statement->firstSourceLocation().startColumn; } - -const QString IdSymbol::id() const -{ - if (ExpressionStatement *e = cast<ExpressionStatement*>(idNode()->statement)) - if (IdentifierExpression *i = cast<IdentifierExpression*>(e->expression)) - if (i->name) - return i->name->asString(); - - return QString(); -} - -QmlJS::AST::UiScriptBinding *IdSymbol::idNode() const -{ return cast<UiScriptBinding*>(node()); } - -PropertyDefinitionSymbol::PropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode): - SymbolFromFile(fileName, propertyNode) -{} - -PropertyDefinitionSymbol::~PropertyDefinitionSymbol() -{} - -PropertyDefinitionSymbol *PropertyDefinitionSymbol::asPropertyDefinitionSymbol() -{ return this; } - -int PropertyDefinitionSymbol::line() const -{ return propertyNode()->identifierToken.startLine; } - -int PropertyDefinitionSymbol::column() const -{ return propertyNode()->identifierToken.startColumn; } - -QmlJS::AST::UiPublicMember *PropertyDefinitionSymbol::propertyNode() const -{ return cast<UiPublicMember*>(node()); } - -const QString PropertyDefinitionSymbol::name() const -{ return propertyNode()->name->asString(); } diff --git a/src/libs/qmljs/qmljssymbol.h b/src/libs/qmljs/qmljssymbol.h deleted file mode 100644 index ebd969bb831..00000000000 --- a/src/libs/qmljs/qmljssymbol.h +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QMLSYMBOL_H -#define QMLSYMBOL_H - -#include <qmljs/parser/qmljsastfwd_p.h> -#include <qmljs/qmljs_global.h> - -#include <QList> -#include <QString> - -namespace QmlJS { - -class QMLJS_EXPORT Symbol -{ -public: - typedef QList<Symbol *> List; - -public: - virtual ~Symbol() = 0; - - virtual const QString name() const = 0; - virtual const List members() = 0; - virtual bool isProperty() const = 0; - - bool isBuildInSymbol(); - bool isSymbolFromFile(); - bool isIdSymbol(); - bool isPropertyDefinitionSymbol(); - - virtual class PrimitiveSymbol *asPrimitiveSymbol(); - virtual class SymbolFromFile *asSymbolFromFile(); - virtual class IdSymbol *asIdSymbol(); - virtual class PropertyDefinitionSymbol *asPropertyDefinitionSymbol(); -}; - -class QMLJS_EXPORT PrimitiveSymbol: public Symbol -{ -public: - virtual ~PrimitiveSymbol() = 0; - - virtual PrimitiveSymbol *asPrimitiveSymbol(); - - virtual PrimitiveSymbol *type() const = 0; - using Symbol::members; - virtual List members(bool includeBaseClassMembers) = 0; -}; - -class QMLJS_EXPORT SymbolWithMembers: public Symbol -{ -public: - virtual ~SymbolWithMembers() = 0; - - virtual const List members(); - -protected: - List _members; -}; - -class QMLJS_EXPORT SymbolFromFile: public SymbolWithMembers -{ -public: - SymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node); - virtual ~SymbolFromFile(); - - virtual SymbolFromFile *asSymbolFromFile(); - - QString fileName() const - { return _fileName; } - - virtual int line() const; - virtual int column() const; - - QmlJS::AST::UiObjectMember *node() const - { return _node; } - - virtual const QString name() const; - virtual const List members(); - virtual bool isProperty() const; - virtual SymbolFromFile *findMember(QmlJS::AST::Node *memberNode); - -private: - void fillTodo(QmlJS::AST::UiObjectMemberList *members); - -private: - QString _fileName; - QmlJS::AST::UiObjectMember *_node; - QList<QmlJS::AST::Node*> todo; -}; - -class QMLJS_EXPORT IdSymbol: public SymbolFromFile -{ -public: - IdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, SymbolFromFile *parentNode); - virtual ~IdSymbol(); - - IdSymbol *asIdSymbol(); - - virtual int line() const; - virtual int column() const; - - SymbolFromFile *parentNode() const - { return _parentNode; } - - virtual const QString name() const - { return "id"; } - - virtual const QString id() const; - -private: - QmlJS::AST::UiScriptBinding *idNode() const; - -private: - SymbolFromFile *_parentNode; -}; - -class QMLJS_EXPORT PropertyDefinitionSymbol: public SymbolFromFile -{ -public: - PropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode); - virtual ~PropertyDefinitionSymbol(); - - PropertyDefinitionSymbol *asPropertyDefinitionSymbol(); - - virtual int line() const; - virtual int column() const; - - virtual const QString name() const; - -private: - QmlJS::AST::UiPublicMember *propertyNode() const; -}; - -} // namespace Qml - -#endif // QMLSYMBOL_H diff --git a/src/libs/qmljs/qmljstypesystem.cpp b/src/libs/qmljs/qmljstypesystem.cpp deleted file mode 100644 index 2a8ca0e68e4..00000000000 --- a/src/libs/qmljs/qmljstypesystem.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qmljsmetatypebackend.h" -#include "qmljstypesystem.h" - -#ifndef NO_DECLARATIVE_BACKEND -# include "qtdeclarativemetatypebackend.h" -#endif // NO_DECLARATIVE_BACKEND - -#include <QDebug> - -using namespace QmlJS; - -TypeSystem::TypeSystem() -{ -#ifndef NO_DECLARATIVE_BACKEND - backends.append(new Internal::QtDeclarativeMetaTypeBackend(this)); -#endif // NO_DECLARATIVE_BACKEND -} - -TypeSystem::~TypeSystem() -{ - qDeleteAll(backends); -} - -QList<Symbol *> TypeSystem::availableTypes(const QString &package, int majorVersion, int minorVersion) -{ - QList<Symbol *> results; - - foreach (MetaTypeBackend *backend, backends) - results.append(backend->availableTypes(package, majorVersion, minorVersion)); - - return results; -} - -Symbol *TypeSystem::resolve(const QString &typeName, const QList<PackageInfo> &packages) -{ - foreach (MetaTypeBackend *backend, backends) - if (Symbol *symbol = backend->resolve(typeName, packages)) - return symbol; - - return 0; -} diff --git a/src/libs/qmljs/qmljstypesystem.h b/src/libs/qmljs/qmljstypesystem.h deleted file mode 100644 index 001da3b7db5..00000000000 --- a/src/libs/qmljs/qmljstypesystem.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QMLTYPESYSTEM_H -#define QMLTYPESYSTEM_H - -#include <qmljs/qmljs_global.h> -#include <qmljs/qmljspackageinfo.h> -#include <qmljs/qmljssymbol.h> - -#include <QtCore/QList> -#include <QtCore/QObject> - -namespace QmlJS { - -class MetaTypeBackend; - -class QMLJS_EXPORT TypeSystem: public QObject -{ - Q_OBJECT - -public: - TypeSystem(); - virtual ~TypeSystem(); - - QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion); - Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages); - -private: - QList<MetaTypeBackend *> backends; -}; - -} // namespace Qml - -#endif // QMLTYPESYSTEM_H diff --git a/src/libs/qmljs/qtdeclarativemetatypebackend.cpp b/src/libs/qmljs/qtdeclarativemetatypebackend.cpp deleted file mode 100644 index b67fa018a01..00000000000 --- a/src/libs/qmljs/qtdeclarativemetatypebackend.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qtdeclarativemetatypebackend.h" - -#include <QDebug> - -namespace QmlJS { -namespace Internal { - -class DeclarativeSymbol: public PrimitiveSymbol -{ -public: - virtual ~DeclarativeSymbol() - {} - -protected: - DeclarativeSymbol(QtDeclarativeMetaTypeBackend* backend): - m_backend(backend) - { Q_ASSERT(backend); } - - QtDeclarativeMetaTypeBackend* backend() const - { return m_backend; } - -private: - QtDeclarativeMetaTypeBackend* m_backend; -}; - -class DeclarativeObjectSymbol: public DeclarativeSymbol -{ - DeclarativeObjectSymbol(const DeclarativeObjectSymbol &); - DeclarativeObjectSymbol &operator=(const DeclarativeObjectSymbol &); - -public: - DeclarativeObjectSymbol(QtDeclarativeMetaTypeBackend* backend): - DeclarativeSymbol(backend) - { - } - - virtual ~DeclarativeObjectSymbol() - { qDeleteAll(m_members); } - - virtual const QString name() const - { return m_name; } - - virtual PrimitiveSymbol *type() const - { return 0; } - - virtual const List members() - { - return m_members; - } - - virtual List members(bool includeBaseClassMembers) - { - List result = members(); - return result; - } - - virtual bool isProperty() const - { return false; } - -public: - static QString key(const QString &typeNameWithPackage, int majorVersion, int minorVersion) - { - return QString(typeNameWithPackage) - + QLatin1Char('@') - + QString::number(majorVersion) - + QLatin1Char('.') - + QString::number(minorVersion); - } - - static QString key(const QString &packageName, const QString &typeName, int majorVersion, int minorVersion) - { - return packageName - + QLatin1Char('/') - + typeName - + QLatin1Char('@') - + QString::number(majorVersion) - + QLatin1Char('.') - + QString::number(minorVersion); - } - -private: - QString m_name; - - bool m_membersToBeDone; - List m_members; -}; - -class DeclarativePropertySymbol: public DeclarativeSymbol -{ - DeclarativePropertySymbol(const DeclarativePropertySymbol &); - DeclarativePropertySymbol &operator=(const DeclarativePropertySymbol &); - -public: - DeclarativePropertySymbol(QtDeclarativeMetaTypeBackend* backend): - DeclarativeSymbol(backend) - { - } - - virtual ~DeclarativePropertySymbol() - {} - - virtual const QString name() const - { return QString(); } - - virtual PrimitiveSymbol *type() const - { return 0; } - - virtual const List members() - { - return List(); - } - - virtual List members(bool /*includeBaseClassMembers*/) - { - return members(); - } - - virtual bool isProperty() const - { return true; } - -private: -}; - -} // namespace Internal -} // namespace Qml - -using namespace QmlJS; -using namespace QmlJS::Internal; - -QtDeclarativeMetaTypeBackend::QtDeclarativeMetaTypeBackend(TypeSystem *typeSystem): - MetaTypeBackend(typeSystem) -{ -} - -QtDeclarativeMetaTypeBackend::~QtDeclarativeMetaTypeBackend() -{ -} - -QList<Symbol *> QtDeclarativeMetaTypeBackend::availableTypes(const QString &package, int majorVersion, int minorVersion) -{ - QList<Symbol *> result; - - return result; -} - -Symbol *QtDeclarativeMetaTypeBackend::resolve(const QString &typeName, const QList<PackageInfo> &packages) -{ - QList<Symbol *> result; - - - return 0; -} diff --git a/src/libs/qmljs/qtdeclarativemetatypebackend.h b/src/libs/qmljs/qtdeclarativemetatypebackend.h deleted file mode 100644 index 5b7cc6a0800..00000000000 --- a/src/libs/qmljs/qtdeclarativemetatypebackend.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QTDECLARATIVEMETATYPEBACKEND_H -#define QTDECLARATIVEMETATYPEBACKEND_H - -#include <qmljs/qmljsmetatypebackend.h> - -#include <QtCore/QList> - -namespace QmlJS { -namespace Internal { - -class DeclarativeSymbol; -class DeclarativeObjectSymbol; -class DeclarativePropertySymbol; - -class QtDeclarativeMetaTypeBackend: public MetaTypeBackend -{ - friend class DeclarativeSymbol; - friend class DeclarativeObjectSymbol; - friend class DeclarativePropertySymbol; - -public: - QtDeclarativeMetaTypeBackend(TypeSystem *typeSystem); - ~QtDeclarativeMetaTypeBackend(); - - virtual QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion); - virtual Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages); - -protected: -// QList<QmlSymbol *> members(const QmlJS::NodeMetaInfo &metaInfo); -// QList<QmlSymbol *> inheritedMembers(const QmlJS::NodeMetaInfo &metaInfo); -// QmlDeclarativeSymbol *typeOf(const QmlJS::PropertyMetaInfo &metaInfo); - -private: -// QmlDeclarativeSymbol *getSymbol(const QmlJS::NodeMetaInfo &metaInfo); - -private: -// QMap<QString, QmlDeclarativeSymbol*> m_symbols; -}; - -} // namespace Internal -} // namespace Qml - -#endif // QTDECLARATIVEMETATYPEBACKEND_H diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index fba3a742ef8..e115fcd1459 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -31,12 +31,10 @@ #include "qmlexpressionundercursor.h" #include "qmljseditor.h" #include "qmlmodelmanagerinterface.h" -#include "qmllookupcontext.h" #include <qmljs/parser/qmljsast_p.h> #include <qmljs/qmljsbind.h> #include <qmljs/qmljsinterpreter.h> -#include <qmljs/qmljssymbol.h> #include <qmljs/qmljsscanner.h> #include <qmljs/qmljscheck.h> @@ -448,16 +446,14 @@ void FunctionArgumentWidget::updateHintText() } } // end of namespace QmlJSEditor::Internal -QmlCodeCompletion::QmlCodeCompletion(QmlModelManagerInterface *modelManager, QmlJS::TypeSystem *typeSystem, QObject *parent) +QmlCodeCompletion::QmlCodeCompletion(QmlModelManagerInterface *modelManager, QObject *parent) : TextEditor::ICompletionCollector(parent), m_modelManager(modelManager), m_editor(0), m_startPosition(0), - m_caseSensitivity(Qt::CaseSensitive), - m_typeSystem(typeSystem) + m_caseSensitivity(Qt::CaseSensitive) { Q_ASSERT(modelManager); - Q_ASSERT(typeSystem); } QmlCodeCompletion::~QmlCodeCompletion() diff --git a/src/plugins/qmljseditor/qmlcodecompletion.h b/src/plugins/qmljseditor/qmlcodecompletion.h index b329f8131b0..57681832a58 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.h +++ b/src/plugins/qmljseditor/qmlcodecompletion.h @@ -30,7 +30,6 @@ #ifndef QMLCODECOMPLETION_H #define QMLCODECOMPLETION_H -#include <qmljs/qmljstypesystem.h> #include <qmljs/qmljsdocument.h> #include <texteditor/icompletioncollector.h> #include <QtCore/QDateTime> @@ -53,7 +52,7 @@ class QmlCodeCompletion: public TextEditor::ICompletionCollector Q_OBJECT public: - QmlCodeCompletion(QmlModelManagerInterface *modelManager, QmlJS::TypeSystem *typeSystem, QObject *parent = 0); + QmlCodeCompletion(QmlModelManagerInterface *modelManager, QObject *parent = 0); virtual ~QmlCodeCompletion(); Qt::CaseSensitivity caseSensitivity() const; @@ -82,7 +81,6 @@ private: int m_startPosition; QList<TextEditor::CompletionItem> m_completions; Qt::CaseSensitivity m_caseSensitivity; - QmlJS::TypeSystem *m_typeSystem; QList<TextEditor::CompletionItem> m_snippets; QDateTime m_snippetFileLastModified; diff --git a/src/plugins/qmljseditor/qmlhoverhandler.cpp b/src/plugins/qmljseditor/qmlhoverhandler.cpp index 1ab41a544fb..9aace5d309d 100644 --- a/src/plugins/qmljseditor/qmlhoverhandler.cpp +++ b/src/plugins/qmljseditor/qmlhoverhandler.cpp @@ -30,15 +30,12 @@ #include "qmljseditor.h" #include "qmlexpressionundercursor.h" #include "qmlhoverhandler.h" -#include "qmllookupcontext.h" -#include "qmlresolveexpression.h" #include <coreplugin/icore.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/editormanager/editormanager.h> #include <debugger/debuggerconstants.h> #include <extensionsystem/pluginmanager.h> -#include <qmljs/qmljssymbol.h> #include <qmljs/qmljsbind.h> #include <qmljs/qmljscheck.h> #include <qmljs/qmljsinterpreter.h> @@ -131,16 +128,6 @@ void QmlHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int p updateHelpIdAndTooltip(editor, pos); } -static QString buildHelpId(Symbol *symbol) -{ - if (!symbol) - return QString(); - - const QString idTemplate(QLatin1String("QML.%1")); - - return idTemplate.arg(symbol->name()); -} - void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos) { m_helpId.clear(); diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 693669521c4..99c8cc8aa7f 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -34,17 +34,13 @@ #include "qmlmodelmanager.h" #include "qmlexpressionundercursor.h" -#include "qmllookupcontext.h" -#include "qmlresolveexpression.h" #include <qmljs/qmljsindenter.h> -#include <qmljs/qmljstypesystem.h> #include <qmljs/parser/qmljsastvisitor_p.h> #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsengine_p.h> #include <qmljs/qmljsdocument.h> -#include <qmljs/qmljsidcollector.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/icore.h> @@ -449,8 +445,7 @@ QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditor *editor) QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : TextEditor::BaseTextEditor(parent), m_methodCombo(0), - m_modelManager(0), - m_typeSystem(0) + m_modelManager(0) { setParenthesesMatchingEnabled(true); setMarksVisible(true); @@ -473,7 +468,6 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : baseTextDocument()->setSyntaxHighlighter(new QmlHighlighter); m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<QmlModelManagerInterface>(); - m_typeSystem = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::TypeSystem>(); if (m_modelManager) { connect(m_modelManager, SIGNAL(documentUpdated(QmlJS::Document::Ptr)), diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 0c2bb282040..4d5aeef54e4 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -43,10 +43,6 @@ namespace Core { class ICore; } -namespace QmlJS { - class TypeSystem; -} - namespace QmlJSEditor { class QmlModelManagerInterface; @@ -174,7 +170,6 @@ private: QTimer *m_updateUsesTimer; QComboBox *m_methodCombo; QmlModelManagerInterface *m_modelManager; - QmlJS::TypeSystem *m_typeSystem; QTextCharFormat m_occurrencesFormat; SemanticInfo m_semanticInfo; diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro index 350a284581e..d2149939f8c 100644 --- a/src/plugins/qmljseditor/qmljseditor.pro +++ b/src/plugins/qmljseditor/qmljseditor.pro @@ -20,10 +20,8 @@ HEADERS += \ qmlfilewizard.h \ qmlhighlighter.h \ qmlhoverhandler.h \ - qmllookupcontext.h \ qmlmodelmanager.h \ - qmlmodelmanagerinterface.h \ - qmlresolveexpression.h + qmlmodelmanagerinterface.h SOURCES += \ qmlcodecompletion.cpp \ @@ -35,10 +33,8 @@ SOURCES += \ qmlfilewizard.cpp \ qmlhighlighter.cpp \ qmlhoverhandler.cpp \ - qmllookupcontext.cpp \ qmlmodelmanager.cpp \ - qmlmodelmanagerinterface.cpp \ - qmlresolveexpression.cpp + qmlmodelmanagerinterface.cpp RESOURCES += qmljseditor.qrc OTHER_FILES += QmlJSEditor.pluginspec QmlJSEditor.mimetypes.xml diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 403d699ab8a..81c800d35e2 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -92,8 +92,6 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e m_modelManager = new QmlModelManager(this); addAutoReleasedObject(m_modelManager); - QmlJS::TypeSystem *typeSystem = new QmlJS::TypeSystem; - addAutoReleasedObject(typeSystem); QList<int> context; context<< core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID); @@ -122,7 +120,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); - m_completion = new QmlCodeCompletion(m_modelManager, typeSystem); + m_completion = new QmlCodeCompletion(m_modelManager); addAutoReleasedObject(m_completion); addAutoReleasedObject(new QmlHoverHandler()); diff --git a/src/plugins/qmljseditor/qmllookupcontext.cpp b/src/plugins/qmljseditor/qmllookupcontext.cpp deleted file mode 100644 index dea7547cf03..00000000000 --- a/src/plugins/qmljseditor/qmllookupcontext.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qmlexpressionundercursor.h" -#include "qmllookupcontext.h" -#include "qmlresolveexpression.h" - -#include <qmljs/parser/qmljsast_p.h> -#include <qmljs/parser/qmljsengine_p.h> -#include <qmljs/qmljstypesystem.h> - -#include <QDebug> - -using namespace QmlJS; -using namespace QmlJSEditor; -using namespace QmlJSEditor::Internal; -using namespace QmlJS::AST; - -QmlLookupContext::QmlLookupContext(const QStack<Symbol *> &scopes, - const Document::Ptr &doc, - const Snapshot &snapshot, - TypeSystem *typeSystem): - _scopes(scopes), - _doc(doc), - _snapshot(snapshot), - m_typeSystem(typeSystem) -{ - Q_ASSERT(typeSystem != 0); -} - -static inline int findFirstQmlObjectScope(const QStack<Symbol*> &scopes, int startIdx) -{ - if (startIdx < 0 || startIdx >= scopes.size()) - return -1; - - for (int i = startIdx; i >= 0; --i) { - Symbol *current = scopes.at(i); - - if (current->isSymbolFromFile()) { - Node *node = current->asSymbolFromFile()->node(); - - if (cast<UiObjectBinding*>(node) || cast<UiObjectDefinition*>(node)) { - return i; - } - } - } - - return -1; -} - -static inline Symbol *resolveParent(const QStack<Symbol*> &scopes) -{ - int idx = findFirstQmlObjectScope(scopes, scopes.size() - 1); - if (idx < 1) - return 0; - - idx = findFirstQmlObjectScope(scopes, idx - 1); - - if (idx < 0) - return 0; - else - return scopes.at(idx); -} - -Symbol *QmlLookupContext::resolve(const QString &name) -{ - // find element type names - if (Symbol *type = resolveType(name)) - return type; - - // find ids - const Document::IdTable ids = _doc->ids(); - if (ids.contains(name)) - return ids[name]; - - if (name == "parent") { - return resolveParent(_scopes); - } - - // find script methods - // ### TODO - - // find properties of the scope object - int scopeObjectIndex = findFirstQmlObjectScope(_scopes, _scopes.size() - 1); - if (scopeObjectIndex != -1) - if (Symbol *propertySymbol = resolveProperty(name, _scopes.at(scopeObjectIndex), _doc->fileName())) - return propertySymbol; - - // find properties of the component's root object - if (!_doc->symbols().isEmpty()) - if (Symbol *propertySymbol = resolveProperty(name, _doc->symbols()[0], _doc->fileName())) - return propertySymbol; - - // component chain - // ### TODO: Might lead to ambiguity. - - // context chain - // ### TODO: ? - - // global object - // ### TODO - - return 0; -} - -Symbol *QmlLookupContext::resolveType(const QString &name, const QString &fileName) -{ - // TODO: handle import-as. - Document::Ptr document = _snapshot.document(fileName); - if (document.isNull()) - return 0; - - UiProgram *prog = document->qmlProgram(); - if (!prog) - return 0; - - UiImportList *imports = prog->imports; - if (!imports) - return 0; - - for (UiImportList *iter = imports; iter; iter = iter->next) { - UiImport *import = iter->import; - if (!import) - continue; - - // TODO: handle Qt imports - - if (!(import->fileName)) - continue; - - const QString path = import->fileName->asString(); - - const QMap<QString, Document::Ptr> importedTypes = _snapshot.componentsDefinedByImportedDocuments(document, path); - if (importedTypes.contains(name)) { - Document::Ptr importedDoc = importedTypes.value(name); - - return importedDoc->symbols().at(0); - } - } - - // TODO: handle Qt imports, hack for now: - return resolveBuildinType(name); -} - -Symbol *QmlLookupContext::resolveBuildinType(const QString &name) -{ - QList<QmlJS::PackageInfo> packages; - // FIXME: - packages.append(PackageInfo("Qt", 4, 6)); - return m_typeSystem->resolve(name, packages); -} - -Symbol *QmlLookupContext::resolveProperty(const QString &name, Symbol *scope, const QString &fileName) -{ - foreach (Symbol *symbol, scope->members()) - if (symbol->isProperty() && symbol->name() == name) - return symbol; - - UiQualifiedId *typeName = 0; - - if (scope->isSymbolFromFile()) { - Node *ast = scope->asSymbolFromFile()->node(); - - if (UiObjectBinding *binding = cast<UiObjectBinding*>(ast)) { - typeName = binding->qualifiedTypeNameId; - } else if (UiObjectDefinition *definition = cast<UiObjectDefinition*>(ast)) { - typeName = definition->qualifiedTypeNameId; - } // TODO: extend this to handle (JavaScript) block scopes. - } - - if (typeName == 0) - return 0; - - Symbol *typeSymbol = resolveType(toString(typeName), fileName); - if (!typeSymbol) - return 0; - - if (typeSymbol->isSymbolFromFile()) { - return resolveProperty(name, typeSymbol->asSymbolFromFile(), typeSymbol->asSymbolFromFile()->fileName()); - } else if (PrimitiveSymbol *builtinSymbol = typeSymbol->asPrimitiveSymbol()) { - foreach (Symbol *member, builtinSymbol->members(true)) { - if (member->isProperty() && member->name() == name) - return member; - } - } - - return 0; -} - -QString QmlLookupContext::toString(UiQualifiedId *id) -{ - QString str; - - for (UiQualifiedId *iter = id; iter; iter = iter->next) { - if (!(iter->name)) - continue; - - str.append(iter->name->asString()); - - if (iter->next) - str.append('.'); - } - - return str; -} - -QList<Symbol*> QmlLookupContext::visibleSymbolsInScope() -{ - QList<Symbol*> result; - - if (!_scopes.isEmpty()) { - Symbol *scope = _scopes.top(); - - // add members defined in this symbol: - result.append(scope->members()); - - // add the members of the type of this scope (= object): - result.append(expandType(scope)); - } - - return result; -} - -QList<Symbol*> QmlLookupContext::visibleTypes() -{ - QList<Symbol*> result; - - UiProgram *program = _doc->qmlProgram(); - if (!program) - return result; - - for (UiImportList *iter = program->imports; iter; iter = iter->next) { - UiImport *import = iter->import; - if (!import) - continue; - - if (!(import->fileName)) - continue; - const QString path = import->fileName->asString(); - - // TODO: handle "import as". - - const QMap<QString, Document::Ptr> types = _snapshot.componentsDefinedByImportedDocuments(_doc, path); - foreach (const Document::Ptr typeDoc, types) { - result.append(typeDoc->symbols().at(0)); - } - } - - result.append(m_typeSystem->availableTypes("Qt", 4, 6)); - - return result; -} - -QList<Symbol*> QmlLookupContext::expandType(QmlJS::Symbol *symbol) -{ - if (symbol == 0) { - return QList<Symbol*>(); - } else if (PrimitiveSymbol *buildInSymbol = symbol->asPrimitiveSymbol()) { - return buildInSymbol->members(true); - } else if (SymbolFromFile *symbolFromFile = symbol->asSymbolFromFile()){ - QList<Symbol*> result; - - if (Symbol *superTypeSymbol = resolveType(symbolFromFile->name(), symbolFromFile->fileName())) { - result.append(superTypeSymbol->members()); - result.append(expandType(superTypeSymbol)); - } - - return result; - } else { - return QList<Symbol*>(); - } -} diff --git a/src/plugins/qmljseditor/qmllookupcontext.h b/src/plugins/qmljseditor/qmllookupcontext.h deleted file mode 100644 index 973276b2e2f..00000000000 --- a/src/plugins/qmljseditor/qmllookupcontext.h +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QMLLOOKUPCONTEXT_H -#define QMLLOOKUPCONTEXT_H - -#include <qmljs/qmljstypesystem.h> -#include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmljsdocument.h> -#include <qmljs/qmljssymbol.h> - -#include <QStack> - -namespace QmlJSEditor { -namespace Internal { - -class QmlLookupContext -{ -public: - QmlLookupContext(const QStack<QmlJS::Symbol *> &scopes, - const QmlJS::Document::Ptr &doc, - const QmlJS::Snapshot &snapshot, - QmlJS::TypeSystem *typeSystem); - - QmlJS::Symbol *resolve(const QString &name); - QmlJS::Symbol *resolveType(const QString &name) - { return resolveType(name, _doc->fileName()); } - QmlJS::Symbol *resolveType(QmlJS::AST::UiQualifiedId *name) - { return resolveType(toString(name), _doc->fileName()); } - - QmlJS::Document::Ptr document() const - { return _doc; } - - QList<QmlJS::Symbol*> visibleSymbolsInScope(); - QList<QmlJS::Symbol*> visibleTypes(); - - QList<QmlJS::Symbol*> expandType(QmlJS::Symbol *symbol); - -private: - QmlJS::Symbol *resolveType(const QString &name, const QString &fileName); - QmlJS::Symbol *resolveProperty(const QString &name, QmlJS::Symbol *scope, const QString &fileName); - QmlJS::Symbol *resolveBuildinType(const QString &name); - - static QString toString(QmlJS::AST::UiQualifiedId *id); - -private: - QStack<QmlJS::Symbol *> _scopes; - QmlJS::Document::Ptr _doc; - QmlJS::Snapshot _snapshot; - QmlJS::TypeSystem *m_typeSystem; -}; - -} // namespace Internal -} // namespace QmlJSEditor - -#endif // QMLLOOKUPCONTEXT_H diff --git a/src/plugins/qmljseditor/qmlmodelmanagerinterface.h b/src/plugins/qmljseditor/qmlmodelmanagerinterface.h index 49d358ccf25..4ac4bb9fee6 100644 --- a/src/plugins/qmljseditor/qmlmodelmanagerinterface.h +++ b/src/plugins/qmljseditor/qmlmodelmanagerinterface.h @@ -33,7 +33,6 @@ #include "qmljseditor_global.h" #include <qmljs/qmljsdocument.h> -#include <qmljs/qmljstypesystem.h> #include <QObject> #include <QStringList> diff --git a/src/plugins/qmljseditor/qmlresolveexpression.cpp b/src/plugins/qmljseditor/qmlresolveexpression.cpp deleted file mode 100644 index b651aa5bb02..00000000000 --- a/src/plugins/qmljseditor/qmlresolveexpression.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#include "qmlresolveexpression.h" - -#include <qmljs/parser/qmljsast_p.h> -#include <qmljs/parser/qmljsengine_p.h> - -using namespace QmlJSEditor; -using namespace QmlJSEditor::Internal; -using namespace QmlJS; -using namespace QmlJS::AST; - -QmlResolveExpression::QmlResolveExpression(const QmlLookupContext &context) - : _context(context), _value(0) -{ -} - -Symbol *QmlResolveExpression::typeOf(Node *node) -{ - Symbol *previousValue = switchValue(0); - Node::accept(node, this); - return switchValue(previousValue); -} - -QList<Symbol*> QmlResolveExpression::visibleSymbols(Node *node) -{ - QList<Symbol*> result; - - Symbol *symbol = typeOf(node); - if (symbol) { - if (symbol->isIdSymbol()) - symbol = symbol->asIdSymbol()->parentNode(); - result.append(symbol->members()); - - // TODO: also add symbols from super-types - } else { - result.append(_context.visibleTypes()); - } - - if (node) { - foreach (IdSymbol *idSymbol, _context.document()->ids().values()) - result.append(idSymbol); - } - - result.append(_context.visibleSymbolsInScope()); - - return result; -} - -Symbol *QmlResolveExpression::switchValue(Symbol *value) -{ - Symbol *previousValue = _value; - _value = value; - return previousValue; -} - -bool QmlResolveExpression::visit(IdentifierExpression *ast) -{ - const QString name = ast->name->asString(); - _value = _context.resolve(name); - return false; -} - -static inline bool matches(UiQualifiedId *candidate, const QString &wanted) -{ - if (!candidate) - return false; - - if (!(candidate->name)) - return false; - - if (candidate->next) - return false; // TODO: verify this! - - return wanted == candidate->name->asString(); -} - -bool QmlResolveExpression::visit(FieldMemberExpression *ast) -{ - const QString memberName = ast->name->asString(); - - Symbol *base = typeOf(ast->base); - if (!base) - return false; - - if (base->isIdSymbol()) - base = base->asIdSymbol()->parentNode(); - - if (!base) - return false; - - foreach (Symbol *memberSymbol, base->members()) - if (memberSymbol->name() == memberName) - _value = memberSymbol; - - return false; -} - -bool QmlResolveExpression::visit(QmlJS::AST::UiQualifiedId *ast) -{ - _value = _context.resolveType(ast); - - return false; -} diff --git a/src/plugins/qmljseditor/qmlresolveexpression.h b/src/plugins/qmljseditor/qmlresolveexpression.h deleted file mode 100644 index afb2e529ba8..00000000000 --- a/src/plugins/qmljseditor/qmlresolveexpression.h +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** -**************************************************************************/ - -#ifndef QMLRESOLVEEXPRESSION_H -#define QMLRESOLVEEXPRESSION_H - -#include "qmllookupcontext.h" - -#include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmljssymbol.h> - -namespace QmlJSEditor { -namespace Internal { - -class QmlResolveExpression: protected QmlJS::AST::Visitor -{ -public: - QmlResolveExpression(const QmlLookupContext &context); - - QmlJS::Symbol *typeOf(QmlJS::AST::Node *node); - QList<QmlJS::Symbol*> visibleSymbols(QmlJS::AST::Node *node); - -protected: - using QmlJS::AST::Visitor::visit; - - QmlJS::Symbol *switchValue(QmlJS::Symbol *symbol); - - virtual bool visit(QmlJS::AST::FieldMemberExpression *ast); - virtual bool visit(QmlJS::AST::IdentifierExpression *ast); - virtual bool visit(QmlJS::AST::UiQualifiedId *ast); - -private: - QmlLookupContext _context; - QmlJS::Symbol *_value; -}; - -} // namespace Internal -} // namespace QmlJSEditor - -#endif // QMLRESOLVEEXPRESSION_H -- GitLab