ScopeChain Class | Extending Qt Creator Manual

Extending Qt Creator Manual | ScopeChain

Extending Qt Creator Manual 4.3.0

# ScopeChain Class

(QmlJS::ScopeChain)

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

Header: | #include <ScopeChain>

- List of all members, including inherited members

## Public Functions

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

Default constructs an instance of ScopeChain.

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

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

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

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

See also setCppContextProperties().

### Document::Ptr ScopeChain::document() const

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

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

See also setGlobalScope().

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

See also setJsImports().

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

See also setJsScopes().

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

### QSharedPointer<const QmlComponentChain> ScopeChain::qmlComponentChain() const

See also setQmlComponentChain().

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

See also setQmlScopeObjects().

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

See also setQmlTypes().

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

See also cppContextProperties().

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

See also globalScope().

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

See also jsImports().

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

See also jsScopes().

### void ScopeChain::setQmlComponentChain(const QSharedPointer<const QmlComponentChain> &qmlComponentChain)

See also qmlComponentChain().

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

See also qmlScopeObjects().

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

See also qmlTypes().