forked from qt-creator/qt-creator
		
	Removed obsolete code
Done with: Erik
This commit is contained in:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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(); }
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
		Reference in New Issue
	
	Block a user