forked from qt-creator/qt-creator
QmlJS: Remove Interpreter namespace.
The distinction between QmlJS and QmlJS::Interpreter has always been weak and the extra namespace just added an unnecessary complication. Change-Id: I4db8ef4bd91b5f6bf610a9d23fdbf55bd60250fc Reviewed-on: http://codereview.qt.nokia.com/2743 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
using namespace LanguageUtils;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
using namespace QmlJS::Interpreter;
|
||||
|
||||
/*!
|
||||
\class QmlJS::Bind
|
||||
@@ -54,7 +53,7 @@ using namespace QmlJS::Interpreter;
|
||||
Each QmlJS::Document owns a instance of Bind. It provides access to data
|
||||
that can be derived by looking at the document in isolation. If you need
|
||||
information that goes beyond that, you need to create a
|
||||
\l{QmlJS::Interpreter::Context} using \l{QmlJS::Link}.
|
||||
\l{QmlJS::Context} using \l{QmlJS::Link}.
|
||||
|
||||
The document's imports are classified and available through imports().
|
||||
|
||||
@@ -81,17 +80,17 @@ QList<ImportInfo> Bind::imports() const
|
||||
return _imports;
|
||||
}
|
||||
|
||||
Interpreter::ObjectValue *Bind::idEnvironment() const
|
||||
ObjectValue *Bind::idEnvironment() const
|
||||
{
|
||||
return _idEnvironment;
|
||||
}
|
||||
|
||||
Interpreter::ObjectValue *Bind::rootObjectValue() const
|
||||
ObjectValue *Bind::rootObjectValue() const
|
||||
{
|
||||
return _rootObjectValue;
|
||||
}
|
||||
|
||||
Interpreter::ObjectValue *Bind::findQmlObject(AST::Node *node) const
|
||||
ObjectValue *Bind::findQmlObject(AST::Node *node) const
|
||||
{
|
||||
return _qmlObjects.value(node);
|
||||
}
|
||||
@@ -171,7 +170,7 @@ bool Bind::usesQmlPrototype(ObjectValue *prototype,
|
||||
return false;
|
||||
}
|
||||
|
||||
Interpreter::ObjectValue *Bind::findAttachedJSScope(AST::Node *node) const
|
||||
ObjectValue *Bind::findAttachedJSScope(AST::Node *node) const
|
||||
{
|
||||
return _attachedJSScopes.value(node);
|
||||
}
|
||||
@@ -317,7 +316,7 @@ bool Bind::visit(UiObjectDefinition *ast)
|
||||
_qmlObjects.insert(ast, value);
|
||||
} else {
|
||||
_groupedPropertyBindings.insert(ast);
|
||||
Interpreter::ObjectValue *oldObjectValue = switchObjectValue(0);
|
||||
ObjectValue *oldObjectValue = switchObjectValue(0);
|
||||
accept(ast->initializer);
|
||||
switchObjectValue(oldObjectValue);
|
||||
}
|
||||
|
@@ -55,16 +55,16 @@ public:
|
||||
Bind(Document *doc, QList<DiagnosticMessage> *messages);
|
||||
virtual ~Bind();
|
||||
|
||||
QList<Interpreter::ImportInfo> imports() const;
|
||||
QList<ImportInfo> imports() const;
|
||||
|
||||
Interpreter::ObjectValue *idEnvironment() const;
|
||||
Interpreter::ObjectValue *rootObjectValue() const;
|
||||
ObjectValue *idEnvironment() const;
|
||||
ObjectValue *rootObjectValue() const;
|
||||
|
||||
Interpreter::ObjectValue *findQmlObject(AST::Node *node) const;
|
||||
bool usesQmlPrototype(Interpreter::ObjectValue *prototype,
|
||||
const Interpreter::ContextPtr &context) const;
|
||||
ObjectValue *findQmlObject(AST::Node *node) const;
|
||||
bool usesQmlPrototype(ObjectValue *prototype,
|
||||
const ContextPtr &context) const;
|
||||
|
||||
Interpreter::ObjectValue *findAttachedJSScope(AST::Node *node) const;
|
||||
ObjectValue *findAttachedJSScope(AST::Node *node) const;
|
||||
bool isGroupedPropertyBinding(AST::Node *node) const;
|
||||
|
||||
static QString toString(AST::UiQualifiedId *qualifiedId, QChar delimiter = QChar('.'));
|
||||
@@ -90,23 +90,23 @@ protected:
|
||||
virtual bool visit(AST::FunctionExpression *ast);
|
||||
virtual bool visit(AST::VariableDeclaration *ast);
|
||||
|
||||
Interpreter::ObjectValue *switchObjectValue(Interpreter::ObjectValue *newObjectValue);
|
||||
Interpreter::ObjectValue *bindObject(AST::UiQualifiedId *qualifiedTypeNameId, AST::UiObjectInitializer *initializer);
|
||||
ObjectValue *switchObjectValue(ObjectValue *newObjectValue);
|
||||
ObjectValue *bindObject(AST::UiQualifiedId *qualifiedTypeNameId, AST::UiObjectInitializer *initializer);
|
||||
|
||||
private:
|
||||
Document *_doc;
|
||||
Interpreter::ValueOwner _valueOwner;
|
||||
ValueOwner _valueOwner;
|
||||
|
||||
Interpreter::ObjectValue *_currentObjectValue;
|
||||
Interpreter::ObjectValue *_idEnvironment;
|
||||
Interpreter::ObjectValue *_rootObjectValue;
|
||||
ObjectValue *_currentObjectValue;
|
||||
ObjectValue *_idEnvironment;
|
||||
ObjectValue *_rootObjectValue;
|
||||
|
||||
QHash<AST::Node *, Interpreter::ObjectValue *> _qmlObjects;
|
||||
QHash<AST::Node *, ObjectValue *> _qmlObjects;
|
||||
QSet<AST::Node *> _groupedPropertyBindings;
|
||||
QHash<AST::Node *, Interpreter::ObjectValue *> _attachedJSScopes;
|
||||
QHash<AST::Node *, ObjectValue *> _attachedJSScopes;
|
||||
QStringList _includedScripts;
|
||||
|
||||
QList<Interpreter::ImportInfo> _imports;
|
||||
QList<ImportInfo> _imports;
|
||||
|
||||
QList<DiagnosticMessage> *_diagnosticMessages;
|
||||
};
|
||||
|
@@ -43,7 +43,6 @@
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
using namespace QmlJS::Interpreter;
|
||||
|
||||
QColor QmlJS::toQColor(const QString &qmlColorString)
|
||||
{
|
||||
@@ -102,8 +101,8 @@ public:
|
||||
DiagnosticMessage operator()(
|
||||
const Document::Ptr &document,
|
||||
const SourceLocation &location,
|
||||
const Interpreter::Value *lhsValue,
|
||||
const Interpreter::Value *rhsValue,
|
||||
const Value *lhsValue,
|
||||
const Value *rhsValue,
|
||||
ExpressionNode *ast)
|
||||
{
|
||||
_doc = document;
|
||||
|
@@ -54,7 +54,7 @@ class QMLJS_EXPORT Check: protected AST::Visitor
|
||||
|
||||
public:
|
||||
// prefer taking root scope chain?
|
||||
Check(Document::Ptr doc, const Interpreter::ContextPtr &context);
|
||||
Check(Document::Ptr doc, const ContextPtr &context);
|
||||
virtual ~Check();
|
||||
|
||||
QList<DiagnosticMessage> operator()();
|
||||
@@ -116,7 +116,7 @@ protected:
|
||||
private:
|
||||
void visitQmlObject(AST::Node *ast, AST::UiQualifiedId *typeId,
|
||||
AST::UiObjectInitializer *initializer);
|
||||
const Interpreter::Value *checkScopeObjectMember(const AST::UiQualifiedId *id);
|
||||
const Value *checkScopeObjectMember(const AST::UiQualifiedId *id);
|
||||
void checkAssignInCondition(AST::ExpressionNode *condition);
|
||||
void checkEndsWithControlFlow(AST::StatementList *statements, AST::SourceLocation errorLoc);
|
||||
void checkProperty(QmlJS::AST::UiQualifiedId *);
|
||||
@@ -128,15 +128,15 @@ private:
|
||||
|
||||
Document::Ptr _doc;
|
||||
|
||||
Interpreter::ContextPtr _context;
|
||||
Interpreter::ScopeChain _scopeChain;
|
||||
ContextPtr _context;
|
||||
ScopeChain _scopeChain;
|
||||
ScopeBuilder _scopeBuilder;
|
||||
|
||||
QList<DiagnosticMessage> _messages;
|
||||
|
||||
Options _options;
|
||||
|
||||
const Interpreter::Value *_lastValue;
|
||||
const Value *_lastValue;
|
||||
QList<AST::Node *> _chain;
|
||||
QStack<StringSet> m_idStack;
|
||||
QStack<StringSet> m_propertyStack;
|
||||
|
@@ -36,7 +36,6 @@
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
using namespace QmlJS::Interpreter;
|
||||
|
||||
ContextPtr Context::create(const QmlJS::Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports)
|
||||
{
|
||||
|
@@ -42,9 +42,6 @@ namespace QmlJS {
|
||||
|
||||
class Document;
|
||||
class Snapshot;
|
||||
|
||||
namespace Interpreter {
|
||||
|
||||
class Context;
|
||||
typedef QSharedPointer<const Context> ContextPtr;
|
||||
|
||||
@@ -100,8 +97,6 @@ private:
|
||||
QList<const Reference *> m_references;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Interpreter
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QMLJS_CONTEXT_H
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Interpreter;
|
||||
|
||||
Evaluate::Evaluate(const ScopeChain *scopeChain)
|
||||
: _valueOwner(scopeChain->context()->valueOwner()),
|
||||
@@ -53,12 +52,12 @@ Evaluate::~Evaluate()
|
||||
{
|
||||
}
|
||||
|
||||
const Interpreter::Value *Evaluate::operator()(AST::Node *ast)
|
||||
const Value *Evaluate::operator()(AST::Node *ast)
|
||||
{
|
||||
return value(ast);
|
||||
}
|
||||
|
||||
const Interpreter::Value *Evaluate::value(AST::Node *ast)
|
||||
const Value *Evaluate::value(AST::Node *ast)
|
||||
{
|
||||
const Value *result = reference(ast);
|
||||
|
||||
@@ -71,7 +70,7 @@ const Interpreter::Value *Evaluate::value(AST::Node *ast)
|
||||
return result;
|
||||
}
|
||||
|
||||
const Interpreter::Value *Evaluate::reference(AST::Node *ast)
|
||||
const Value *Evaluate::reference(AST::Node *ast)
|
||||
{
|
||||
// save the result
|
||||
const Value *previousResult = switchResult(0);
|
||||
@@ -83,16 +82,16 @@ const Interpreter::Value *Evaluate::reference(AST::Node *ast)
|
||||
return switchResult(previousResult);
|
||||
}
|
||||
|
||||
const Interpreter::Value *Evaluate::switchResult(const Interpreter::Value *result)
|
||||
const Value *Evaluate::switchResult(const Value *result)
|
||||
{
|
||||
const Interpreter::Value *previousResult = _result;
|
||||
const Value *previousResult = _result;
|
||||
_result = result;
|
||||
return previousResult;
|
||||
}
|
||||
|
||||
const Interpreter::ObjectValue *Evaluate::switchScope(const Interpreter::ObjectValue *scope)
|
||||
const ObjectValue *Evaluate::switchScope(const ObjectValue *scope)
|
||||
{
|
||||
const Interpreter::ObjectValue *previousScope = _scope;
|
||||
const ObjectValue *previousScope = _scope;
|
||||
_scope = scope;
|
||||
return previousScope;
|
||||
}
|
||||
@@ -311,8 +310,8 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast)
|
||||
if (! ast->name)
|
||||
return false;
|
||||
|
||||
if (const Interpreter::Value *base = _valueOwner->convertToObject(value(ast->base))) {
|
||||
if (const Interpreter::ObjectValue *obj = base->asObjectValue()) {
|
||||
if (const Value *base = _valueOwner->convertToObject(value(ast->base))) {
|
||||
if (const ObjectValue *obj = base->asObjectValue()) {
|
||||
_result = obj->lookupMember(ast->name->asString(), _context);
|
||||
}
|
||||
}
|
||||
@@ -338,8 +337,8 @@ bool Evaluate::visit(AST::NewExpression *ast)
|
||||
|
||||
bool Evaluate::visit(AST::CallExpression *ast)
|
||||
{
|
||||
if (const Interpreter::Value *base = value(ast->base)) {
|
||||
if (const Interpreter::FunctionValue *obj = base->asFunctionValue()) {
|
||||
if (const Value *base = value(ast->base)) {
|
||||
if (const FunctionValue *obj = base->asFunctionValue()) {
|
||||
_result = obj->returnValue();
|
||||
}
|
||||
}
|
||||
|
@@ -39,34 +39,32 @@
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
namespace Interpreter {
|
||||
class ValueOwner;
|
||||
class Context;
|
||||
class Value;
|
||||
class ObjectValue;
|
||||
class FunctionValue;
|
||||
} // namespace Interpreter
|
||||
class ValueOwner;
|
||||
class Context;
|
||||
class Value;
|
||||
class ObjectValue;
|
||||
class FunctionValue;
|
||||
|
||||
class QMLJS_EXPORT Evaluate: protected AST::Visitor
|
||||
{
|
||||
public:
|
||||
Evaluate(const Interpreter::ScopeChain *scopeChain);
|
||||
Evaluate(const ScopeChain *scopeChain);
|
||||
virtual ~Evaluate();
|
||||
|
||||
// same as value()
|
||||
const Interpreter::Value *operator()(AST::Node *ast);
|
||||
const Value *operator()(AST::Node *ast);
|
||||
|
||||
// evaluate ast in the given context, resolving references
|
||||
const Interpreter::Value *value(AST::Node *ast);
|
||||
const Value *value(AST::Node *ast);
|
||||
|
||||
// evaluate, but stop when encountering a Reference
|
||||
const Interpreter::Value *reference(AST::Node *ast);
|
||||
const Value *reference(AST::Node *ast);
|
||||
|
||||
protected:
|
||||
void accept(AST::Node *node);
|
||||
|
||||
const Interpreter::Value *switchResult(const Interpreter::Value *result);
|
||||
const Interpreter::ObjectValue *switchScope(const Interpreter::ObjectValue *scope);
|
||||
const Value *switchResult(const Value *result);
|
||||
const ObjectValue *switchScope(const ObjectValue *scope);
|
||||
|
||||
// Ui
|
||||
virtual bool visit(AST::UiProgram *ast);
|
||||
@@ -164,11 +162,11 @@ protected:
|
||||
|
||||
private:
|
||||
QmlJS::Document::Ptr _doc;
|
||||
Interpreter::ValueOwner *_valueOwner;
|
||||
Interpreter::ContextPtr _context;
|
||||
const Interpreter::ScopeChain *_scopeChain;
|
||||
const Interpreter::ObjectValue *_scope;
|
||||
const Interpreter::Value *_result;
|
||||
ValueOwner *_valueOwner;
|
||||
ContextPtr _context;
|
||||
const ScopeChain *_scopeChain;
|
||||
const ObjectValue *_scope;
|
||||
const Value *_result;
|
||||
};
|
||||
|
||||
} // namespace Qml
|
||||
|
@@ -46,9 +46,7 @@ class BaseTextEditor;
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
namespace Interpreter {
|
||||
class ScopeChain;
|
||||
}
|
||||
|
||||
class QMLJS_EXPORT IContextPane : public QObject
|
||||
{
|
||||
@@ -57,7 +55,7 @@ class QMLJS_EXPORT IContextPane : public QObject
|
||||
public:
|
||||
IContextPane(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~IContextPane() {}
|
||||
virtual void apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const Interpreter::ScopeChain *scopeChain, AST::Node *node, bool update, bool force = false) = 0;
|
||||
virtual void apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force = false) = 0;
|
||||
virtual void setEnabled(bool) = 0;
|
||||
virtual bool isAvailable(TextEditor::BaseTextEditor *editor, Document::Ptr document, AST::Node *node) = 0;
|
||||
virtual QWidget* widget() = 0;
|
||||
|
@@ -55,7 +55,7 @@
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
using namespace LanguageUtils;
|
||||
using namespace QmlJS::Interpreter;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
|
||||
namespace {
|
||||
@@ -1176,7 +1176,7 @@ CppQmlTypesLoader::BuiltinObjects CppQmlTypesLoader::loadQmlTypes(const QFileInf
|
||||
QString contents = QString::fromUtf8(file.readAll());
|
||||
file.close();
|
||||
|
||||
QmlJS::TypeDescriptionReader reader(contents);
|
||||
TypeDescriptionReader reader(contents);
|
||||
if (!reader(&newObjects))
|
||||
error = reader.errorMessage();
|
||||
warning = reader.warningMessage();
|
||||
@@ -1205,7 +1205,7 @@ void CppQmlTypesLoader::parseQmlTypeDescriptions(const QByteArray &xml,
|
||||
{
|
||||
errorMessage->clear();
|
||||
warningMessage->clear();
|
||||
QmlJS::TypeDescriptionReader reader(QString::fromUtf8(xml));
|
||||
TypeDescriptionReader reader(QString::fromUtf8(xml));
|
||||
if (!reader(newObjects)) {
|
||||
if (reader.errorMessage().isEmpty()) {
|
||||
*errorMessage = QLatin1String("unknown error");
|
||||
@@ -1631,7 +1631,7 @@ void TypeId::visit(const AnchorLineValue *)
|
||||
|
||||
ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName,
|
||||
UiObjectInitializer *initializer,
|
||||
const QmlJS::Document *doc,
|
||||
const Document *doc,
|
||||
ValueOwner *valueOwner)
|
||||
: ObjectValue(valueOwner), _typeName(typeName), _initializer(initializer), _doc(doc), _defaultPropertyRef(0)
|
||||
{
|
||||
@@ -1701,12 +1701,12 @@ UiQualifiedId *ASTObjectValue::typeName() const
|
||||
return _typeName;
|
||||
}
|
||||
|
||||
const QmlJS::Document *ASTObjectValue::document() const
|
||||
const Document *ASTObjectValue::document() const
|
||||
{
|
||||
return _doc;
|
||||
}
|
||||
|
||||
ASTVariableReference::ASTVariableReference(VariableDeclaration *ast, const QmlJS::Document *doc, ValueOwner *valueOwner)
|
||||
ASTVariableReference::ASTVariableReference(VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner)
|
||||
: Reference(valueOwner)
|
||||
, _ast(ast)
|
||||
, _doc(doc)
|
||||
@@ -1724,14 +1724,14 @@ const Value *ASTVariableReference::value(const ReferenceContext *referenceContex
|
||||
|
||||
Document::Ptr doc = _doc->ptr();
|
||||
ScopeChain scopeChain(doc, referenceContext->context());
|
||||
QmlJS::ScopeBuilder builder(&scopeChain);
|
||||
builder.push(QmlJS::ScopeAstPath(doc)(_ast->expression->firstSourceLocation().begin()));
|
||||
ScopeBuilder builder(&scopeChain);
|
||||
builder.push(ScopeAstPath(doc)(_ast->expression->firstSourceLocation().begin()));
|
||||
|
||||
QmlJS::Evaluate evaluator(&scopeChain);
|
||||
Evaluate evaluator(&scopeChain);
|
||||
return evaluator(_ast->expression);
|
||||
}
|
||||
|
||||
ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const QmlJS::Document *doc, ValueOwner *valueOwner)
|
||||
ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const Document *doc, ValueOwner *valueOwner)
|
||||
: FunctionValue(valueOwner), _ast(ast), _doc(doc)
|
||||
{
|
||||
setPrototype(valueOwner->functionPrototype());
|
||||
@@ -1787,7 +1787,7 @@ bool ASTFunctionValue::getSourceLocation(QString *fileName, int *line, int *colu
|
||||
return true;
|
||||
}
|
||||
|
||||
QmlPrototypeReference::QmlPrototypeReference(UiQualifiedId *qmlTypeName, const QmlJS::Document *doc,
|
||||
QmlPrototypeReference::QmlPrototypeReference(UiQualifiedId *qmlTypeName, const Document *doc,
|
||||
ValueOwner *valueOwner)
|
||||
: Reference(valueOwner),
|
||||
_qmlTypeName(qmlTypeName),
|
||||
@@ -1809,7 +1809,7 @@ const Value *QmlPrototypeReference::value(const ReferenceContext *referenceConte
|
||||
return referenceContext->context()->lookupType(_doc, _qmlTypeName);
|
||||
}
|
||||
|
||||
ASTPropertyReference::ASTPropertyReference(UiPublicMember *ast, const QmlJS::Document *doc, ValueOwner *valueOwner)
|
||||
ASTPropertyReference::ASTPropertyReference(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner)
|
||||
: Reference(valueOwner), _ast(ast), _doc(doc)
|
||||
{
|
||||
const QString propertyName = ast->name->asString();
|
||||
@@ -1840,14 +1840,14 @@ const Value *ASTPropertyReference::value(const ReferenceContext *referenceContex
|
||||
// Adjust the context for the current location - expensive!
|
||||
// ### Improve efficiency by caching the 'use chain' constructed in ScopeBuilder.
|
||||
|
||||
QmlJS::Document::Ptr doc = _doc->ptr();
|
||||
Document::Ptr doc = _doc->ptr();
|
||||
ScopeChain scopeChain(doc, referenceContext->context());
|
||||
QmlJS::ScopeBuilder builder(&scopeChain);
|
||||
ScopeBuilder builder(&scopeChain);
|
||||
|
||||
int offset = _ast->statement->firstSourceLocation().begin();
|
||||
builder.push(ScopeAstPath(doc)(offset));
|
||||
|
||||
QmlJS::Evaluate evaluator(&scopeChain);
|
||||
Evaluate evaluator(&scopeChain);
|
||||
return evaluator(_ast->statement);
|
||||
}
|
||||
|
||||
@@ -1857,7 +1857,7 @@ const Value *ASTPropertyReference::value(const ReferenceContext *referenceContex
|
||||
return valueOwner()->undefinedValue();
|
||||
}
|
||||
|
||||
ASTSignalReference::ASTSignalReference(UiPublicMember *ast, const QmlJS::Document *doc, ValueOwner *valueOwner)
|
||||
ASTSignalReference::ASTSignalReference(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner)
|
||||
: Reference(valueOwner), _ast(ast), _doc(doc)
|
||||
{
|
||||
const QString signalName = ast->name->asString();
|
||||
|
@@ -51,8 +51,6 @@ namespace QmlJS {
|
||||
class NameId;
|
||||
class Document;
|
||||
|
||||
namespace Interpreter {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declarations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -573,10 +571,10 @@ public:
|
||||
static const QLatin1String cppPackage;
|
||||
|
||||
template <typename T>
|
||||
QList<QmlObjectValue *> load(Interpreter::ValueOwner *interpreter, const T &objects);
|
||||
QList<QmlObjectValue *> load(ValueOwner *interpreter, const T &objects);
|
||||
|
||||
QList<Interpreter::QmlObjectValue *> typesForImport(const QString &prefix, LanguageUtils::ComponentVersion version) const;
|
||||
Interpreter::QmlObjectValue *typeByCppName(const QString &cppName) const;
|
||||
QList<QmlObjectValue *> typesForImport(const QString &prefix, LanguageUtils::ComponentVersion version) const;
|
||||
QmlObjectValue *typeByCppName(const QString &cppName) const;
|
||||
|
||||
bool hasPackage(const QString &package) const;
|
||||
|
||||
@@ -906,6 +904,6 @@ private:
|
||||
JSImportScope *_jsImportScope;
|
||||
};
|
||||
|
||||
} } // namespace QmlJS::Interpreter
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QMLJS_INTERPRETER_H
|
||||
|
@@ -44,14 +44,13 @@
|
||||
|
||||
using namespace LanguageUtils;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Interpreter;
|
||||
using namespace QmlJS::AST;
|
||||
|
||||
namespace {
|
||||
class ImportCacheKey
|
||||
{
|
||||
public:
|
||||
explicit ImportCacheKey(const Interpreter::ImportInfo &info)
|
||||
explicit ImportCacheKey(const ImportInfo &info)
|
||||
: type(info.type())
|
||||
, name(info.name())
|
||||
, majorVersion(info.version().majorVersion())
|
||||
@@ -84,7 +83,7 @@ class QmlJS::LinkPrivate
|
||||
{
|
||||
public:
|
||||
Snapshot snapshot;
|
||||
Interpreter::ValueOwner *valueOwner;
|
||||
ValueOwner *valueOwner;
|
||||
QStringList importPaths;
|
||||
LibraryInfo builtins;
|
||||
|
||||
@@ -99,7 +98,7 @@ public:
|
||||
/*!
|
||||
\class QmlJS::Link
|
||||
\brief Initializes the Context for a Document.
|
||||
\sa QmlJS::Document QmlJS::Interpreter::Context
|
||||
\sa QmlJS::Document QmlJS::Context
|
||||
|
||||
Initializes a context by resolving imports and building the root scope
|
||||
chain. Currently, this is a expensive operation.
|
||||
@@ -439,7 +438,7 @@ void Link::appendDiagnostic(const Document::Ptr &doc, const DiagnosticMessage &m
|
||||
(*d->allDiagnosticMessages)[doc->fileName()].append(message);
|
||||
}
|
||||
|
||||
void Link::loadQmldirComponents(Interpreter::ObjectValue *import, ComponentVersion version,
|
||||
void Link::loadQmldirComponents(ObjectValue *import, ComponentVersion version,
|
||||
const LibraryInfo &libraryInfo, const QString &libraryPath)
|
||||
{
|
||||
Q_D(Link);
|
||||
|
@@ -58,38 +58,38 @@ public:
|
||||
Link(const Snapshot &snapshot, const QStringList &importPaths, const LibraryInfo &builtins);
|
||||
|
||||
// Link all documents in snapshot, collecting all diagnostic messages (if messages != 0)
|
||||
Interpreter::ContextPtr operator()(QHash<QString, QList<DiagnosticMessage> > *messages = 0);
|
||||
ContextPtr operator()(QHash<QString, QList<DiagnosticMessage> > *messages = 0);
|
||||
|
||||
// Link all documents in snapshot, appending the diagnostic messages
|
||||
// for 'doc' in 'messages'
|
||||
Interpreter::ContextPtr operator()(const Document::Ptr &doc, QList<DiagnosticMessage> *messages);
|
||||
ContextPtr operator()(const Document::Ptr &doc, QList<DiagnosticMessage> *messages);
|
||||
|
||||
~Link();
|
||||
|
||||
private:
|
||||
static AST::UiQualifiedId *qualifiedTypeNameId(AST::Node *node);
|
||||
|
||||
Interpreter::Context::ImportsPerDocument linkImports();
|
||||
Context::ImportsPerDocument linkImports();
|
||||
|
||||
void populateImportedTypes(Interpreter::Imports *imports, Document::Ptr doc);
|
||||
Interpreter::Import importFileOrDirectory(
|
||||
void populateImportedTypes(Imports *imports, Document::Ptr doc);
|
||||
Import importFileOrDirectory(
|
||||
Document::Ptr doc,
|
||||
const Interpreter::ImportInfo &importInfo);
|
||||
Interpreter::Import importNonFile(
|
||||
const ImportInfo &importInfo);
|
||||
Import importNonFile(
|
||||
Document::Ptr doc,
|
||||
const Interpreter::ImportInfo &importInfo);
|
||||
void importObject(Bind *bind, const QString &name, Interpreter::ObjectValue *object, NameId *targetNamespace);
|
||||
const ImportInfo &importInfo);
|
||||
void importObject(Bind *bind, const QString &name, ObjectValue *object, NameId *targetNamespace);
|
||||
|
||||
bool importLibrary(Document::Ptr doc,
|
||||
const QString &libraryPath,
|
||||
Interpreter::Import *import,
|
||||
Import *import,
|
||||
const QString &importPath = QString());
|
||||
void loadQmldirComponents(Interpreter::ObjectValue *import,
|
||||
void loadQmldirComponents(ObjectValue *import,
|
||||
LanguageUtils::ComponentVersion version,
|
||||
const LibraryInfo &libraryInfo,
|
||||
const QString &libraryPath);
|
||||
void loadImplicitDirectoryImports(Interpreter::Imports *imports, Document::Ptr doc);
|
||||
void loadImplicitDefaultImports(Interpreter::Imports *imports);
|
||||
void loadImplicitDirectoryImports(Imports *imports, Document::Ptr doc);
|
||||
void loadImplicitDefaultImports(Imports *imports);
|
||||
|
||||
void error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
|
||||
void warning(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
|
||||
|
@@ -39,7 +39,6 @@
|
||||
#include "parser/qmljsast_p.h"
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Interpreter;
|
||||
using namespace QmlJS::AST;
|
||||
|
||||
ScopeBuilder::ScopeBuilder(ScopeChain *scopeChain)
|
||||
|
@@ -39,14 +39,12 @@
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
namespace Interpreter {
|
||||
class QmlComponentChain;
|
||||
class Context;
|
||||
typedef QSharedPointer<const Context> ContextPtr;
|
||||
class ObjectValue;
|
||||
class Value;
|
||||
class ScopeChain;
|
||||
}
|
||||
|
||||
namespace AST {
|
||||
class Node;
|
||||
@@ -55,20 +53,20 @@ namespace AST {
|
||||
class QMLJS_EXPORT ScopeBuilder
|
||||
{
|
||||
public:
|
||||
ScopeBuilder(Interpreter::ScopeChain *scopeChain);
|
||||
ScopeBuilder(ScopeChain *scopeChain);
|
||||
~ScopeBuilder();
|
||||
|
||||
void push(AST::Node *node);
|
||||
void push(const QList<AST::Node *> &nodes);
|
||||
void pop();
|
||||
|
||||
static const Interpreter::ObjectValue *isPropertyChangesObject(const Interpreter::ContextPtr &context, const Interpreter::ObjectValue *object);
|
||||
static const ObjectValue *isPropertyChangesObject(const ContextPtr &context, const ObjectValue *object);
|
||||
|
||||
private:
|
||||
void setQmlScopeObject(AST::Node *node);
|
||||
const Interpreter::Value *scopeObjectLookup(AST::UiQualifiedId *id);
|
||||
const Value *scopeObjectLookup(AST::UiQualifiedId *id);
|
||||
|
||||
Interpreter::ScopeChain *_scopeChain;
|
||||
ScopeChain *_scopeChain;
|
||||
QList<AST::Node *> _nodes;
|
||||
};
|
||||
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include "qmljsevaluate.h"
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Interpreter;
|
||||
|
||||
QmlComponentChain::QmlComponentChain(const Document::Ptr &document)
|
||||
: m_document(document)
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include <QtCore/QSharedPointer>
|
||||
|
||||
namespace QmlJS {
|
||||
namespace Interpreter {
|
||||
|
||||
class ObjectValue;
|
||||
class TypeScope;
|
||||
@@ -122,7 +121,6 @@ private:
|
||||
mutable QList<const ObjectValue *> m_all;
|
||||
};
|
||||
|
||||
} // namespace Interpreter
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QMLJS_SCOPECHAIN_H
|
||||
|
@@ -218,7 +218,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
|
||||
}
|
||||
|
||||
// ### add implicit export into the package of c++ types
|
||||
fmo->addExport(fmo->className(), QmlJS::Interpreter::CppQmlTypes::cppPackage, ComponentVersion());
|
||||
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
|
||||
_objects->insert(fmo->className(), fmo);
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include "qmljsvalueowner.h"
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Interpreter;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@@ -39,7 +39,6 @@
|
||||
#include <QtCore/QList>
|
||||
|
||||
namespace QmlJS {
|
||||
namespace Interpreter {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declarations
|
||||
@@ -194,7 +193,6 @@ private:
|
||||
QMutex _mutex;
|
||||
};
|
||||
|
||||
} // namespace Interpreter
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QMLJS_VALUEOWNER_H
|
||||
|
Reference in New Issue
Block a user