ScopeChain Class

(QmlJS::ScopeChain)

The ScopeChain class describes the scopes used for global lookup in a specific location. More...

Header: #include <ScopeChain>

Public Functions

ScopeChain(const Document::Ptr &document, const QmlJS::ContextPtr &context)
QList<const QmlJS::ObjectValue *> all() const
void appendJsScope(const QmlJS::ObjectValue *scope)
const QmlJS::ContextPtr &context() const
const QmlJS::ObjectValue *cppContextProperties() const
Document::Ptr document() const
const QmlJS::Value *evaluate(AST::Node *node) const
const QmlJS::ObjectValue *globalScope() const
const QmlJS::JSImportScope *jsImports() const
QList<const QmlJS::ObjectValue *> jsScopes() const
const QmlJS::Value *lookup(const QString &name, const QmlJS::ObjectValue **foundInScope = 0) const
int qmlComponentChain() const
QList<const QmlJS::ObjectValue *> qmlScopeObjects() const
const QmlJS::TypeScope *qmlTypes() const
void setCppContextProperties(const QmlJS::ObjectValue *cppContextProperties)
void setGlobalScope(const QmlJS::ObjectValue *globalScope)
void setJsImports(const QmlJS::JSImportScope *jsImports)
void setJsScopes(const QList<const QmlJS::ObjectValue *> &jsScopes)
void setQmlComponentChain(const int &qmlComponentChain)
void setQmlScopeObjects(const QList<const QmlJS::ObjectValue *> &qmlScopeObjects)
void setQmlTypes(const QmlJS::TypeScope *qmlTypes)

Detailed Description

The ScopeChain class describes the scopes used for global lookup in a specific location.

A ScopeChain is used to perform global lookup with the lookup() function and to access information about the enclosing scopes.

Once constructed for a Document in a Context it represents the root scope of that Document. From there, a ScopeBuilder can be used to push and pop scopes corresponding to functions, object definitions, etc.

It is an error to use the same ScopeChain from multiple threads; use a copy. Copying is cheap. Initial construction is currently expensive.

When a QmlJSEditor::QmlJSEditorDocument is available, there's no need to construct a new ScopeChain. Instead use QmlJSEditorDocument::semanticInfo()::scopeChain().

See also Document, Context, and ScopeBuilder.

Member Function Documentation

ScopeChain::ScopeChain(const Document::Ptr &document, const QmlJS::ContextPtr &context)

Default constructs an instance of ScopeChain.

QList<const QmlJS::ObjectValue *> ScopeChain::all() const

void ScopeChain::appendJsScope(const QmlJS::ObjectValue *scope)

const QmlJS::ContextPtr &ScopeChain::context() const

const QmlJS::ObjectValue *ScopeChain::cppContextProperties() const

See also setCppContextProperties().

Document::Ptr ScopeChain::document() const

const QmlJS::Value *ScopeChain::evaluate(AST::Node *node) const

const QmlJS::ObjectValue *ScopeChain::globalScope() const

See also setGlobalScope().

const QmlJS::JSImportScope *ScopeChain::jsImports() const

See also setJsImports().

QList<const QmlJS::ObjectValue *> ScopeChain::jsScopes() const

See also setJsScopes().

const QmlJS::Value *ScopeChain::lookup(const QString &name, const QmlJS::ObjectValue **foundInScope = 0) const

int ScopeChain::qmlComponentChain() const

See also setQmlComponentChain().

QList<const QmlJS::ObjectValue *> ScopeChain::qmlScopeObjects() const

See also setQmlScopeObjects().

const QmlJS::TypeScope *ScopeChain::qmlTypes() const

See also setQmlTypes().

void ScopeChain::setCppContextProperties(const QmlJS::ObjectValue *cppContextProperties)

See also cppContextProperties().

void ScopeChain::setGlobalScope(const QmlJS::ObjectValue *globalScope)

See also globalScope().

void ScopeChain::setJsImports(const QmlJS::JSImportScope *jsImports)

See also jsImports().

void ScopeChain::setJsScopes(const QList<const QmlJS::ObjectValue *> &jsScopes)

See also jsScopes().

void ScopeChain::setQmlComponentChain(const int &qmlComponentChain)

See also qmlComponentChain().

void ScopeChain::setQmlScopeObjects(const QList<const QmlJS::ObjectValue *> &qmlScopeObjects)

See also qmlScopeObjects().

void ScopeChain::setQmlTypes(const QmlJS::TypeScope *qmlTypes)

See also qmlTypes().