2010-07-09 15:47:07 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
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>
|
|
|
|
|
|
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-11-24 09:30:46 +01:00
|
|
|
void warning(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
|
2010-03-29 11:32:11 +02:00
|
|
|
|
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
|