2010-07-09 15:47:07 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 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.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2010-01-28 14:53:53 +01:00
|
|
|
#ifndef QMLJSLINK_H
|
|
|
|
|
#define QMLJSLINK_H
|
|
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
#include <qmljs/qmljsdocument.h>
|
2010-01-28 14:53:53 +01:00
|
|
|
#include <qmljs/qmljsinterpreter.h>
|
|
|
|
|
#include <qmljs/parser/qmljsastfwd_p.h>
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QList>
|
2010-02-02 15:55:17 +01:00
|
|
|
#include <QtCore/QHash>
|
2010-03-16 16:34:33 +01:00
|
|
|
#include <QtCore/QStringList>
|
2010-05-19 13:32:11 +02:00
|
|
|
#include <QtCore/QCoreApplication>
|
2010-01-28 14:53:53 +01:00
|
|
|
|
|
|
|
|
namespace QmlJS {
|
|
|
|
|
|
2010-02-04 10:19:37 +01:00
|
|
|
class NameId;
|
2010-09-16 15:29:37 +02:00
|
|
|
class LinkPrivate;
|
2010-02-04 10:19:37 +01:00
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
/*
|
2010-02-04 10:19:37 +01:00
|
|
|
Helper for building a context.
|
2010-02-02 15:55:17 +01:00
|
|
|
*/
|
2010-03-31 10:03:18 +02:00
|
|
|
class QMLJS_EXPORT Link
|
2010-01-28 14:53:53 +01:00
|
|
|
{
|
2010-09-16 15:29:37 +02:00
|
|
|
Q_DECLARE_PRIVATE(Link)
|
2010-05-19 13:42:56 +02:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(QmlJS::Link)
|
|
|
|
|
|
2010-01-28 14:53:53 +01:00
|
|
|
public:
|
2010-03-16 16:34:33 +01:00
|
|
|
// Link all documents in snapshot
|
2010-03-29 11:32:11 +02:00
|
|
|
Link(Interpreter::Context *context, const Document::Ptr &doc, const Snapshot &snapshot,
|
|
|
|
|
const QStringList &importPaths);
|
2010-02-02 15:55:17 +01:00
|
|
|
~Link();
|
|
|
|
|
|
2010-03-25 14:47:28 +01:00
|
|
|
QList<DiagnosticMessage> diagnosticMessages() const;
|
|
|
|
|
|
2010-01-28 14:53:53 +01:00
|
|
|
private:
|
2010-02-04 10:19:37 +01:00
|
|
|
Interpreter::Engine *engine();
|
|
|
|
|
|
2010-02-02 17:06:48 +01:00
|
|
|
static AST::UiQualifiedId *qualifiedTypeNameId(AST::Node *node);
|
2010-01-28 14:53:53 +01:00
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
void linkImports();
|
|
|
|
|
|
2010-09-16 15:29:37 +02:00
|
|
|
void populateImportedTypes(Interpreter::TypeEnvironment *typeEnv, Document::Ptr doc);
|
|
|
|
|
Interpreter::ObjectValue *importFile(Document::Ptr doc, const Interpreter::ImportInfo &importInfo);
|
|
|
|
|
Interpreter::ObjectValue *importNonFile(Document::Ptr doc, const Interpreter::ImportInfo &importInfo);
|
2010-02-03 15:59:15 +01:00
|
|
|
void importObject(Bind *bind, const QString &name, Interpreter::ObjectValue *object, NameId *targetNamespace);
|
2010-02-02 15:55:17 +01:00
|
|
|
|
2010-03-29 11:32:11 +02:00
|
|
|
void error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
|
|
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
private:
|
2010-09-16 15:29:37 +02:00
|
|
|
QScopedPointer<LinkPrivate> d_ptr;
|
2010-01-28 14:53:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QmlJS
|
|
|
|
|
|
|
|
|
|
#endif // QMLJSLINK_H
|