Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4qmlcontext.cpp File Reference

(85daa5aa6de0840ffa39313893cfee0a2b9e6b0c)

#include "qv4qmlcontext_p.h"
#include <private/qjsvalue_p.h>
#include <private/qqmlcontext_p.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
#include <private/qqmljavascriptexpression_p.h>
#include <private/qqmllistwrapper_p.h>
#include <private/qqmltypewrapper_p.h>
#include <private/qv4compileddata_p.h>
#include <private/qv4engine_p.h>
#include <private/qv4function_p.h>
#include <private/qv4identifiertable_p.h>
#include <private/qv4lookup_p.h>
#include <private/qv4mm_p.h>
#include <private/qv4module_p.h>
#include <private/qv4objectproto_p.h>
#include <private/qv4qobjectwrapper_p.h>
#include <private/qv4stackframe_p.h>
#include <private/qv4value_p.h>
#include <QtCore/qloggingcategory.h>
Include dependency graph for qv4qmlcontext.cpp:

Go to the source code of this file.

Functions

QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY (lcQmlContext, "qt.qml.context")
 DEFINE_OBJECT_VTABLE (QQmlContextWrapper)
 DEFINE_MANAGED_VTABLE (QmlContext)
static OptionalReturnedValue searchContextProperties (QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, String *namename, bool *hasProperty, Value *base, QV4::Lookup *lookup, QV4::Lookup *originalLookup, QQmlEnginePrivate *ep)
template<typename Lookup>
bool performLookup (ScopedValue *resultresult, bool *hasProperty, const Lookup &lookup)
static QV4::QObjectWrapper::Flags getQmlPropertyFlags (const Lookup *l)
static OptionalReturnedValue searchModule (const QQmlContextWrapper *resource, PropertyKey idid, const Value *receiver, bool *hasProperty)
static void setupSingletonLookup (QV4::ExecutionEngine *v4, Lookup *lookup, const QQmlType &typetype)
static OptionalReturnedValue searchImports (QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, QObject *scopeObject, String *namename, bool *hasProperty, Value *base, Lookup *lookup)
static OptionalReturnedValue searchBoundComponentContexts (QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, QQmlRefPointer< QQmlContextData > &outer, String *namename, bool *hasProperty, Value *base, Lookup *originalLookup, QQmlEnginePrivate *ep)
static OptionalReturnedValue searchScopeObject (QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, QObject *scopeObject, String *namename, bool *hasProperty, Value *base, Lookup *lookup)
static OptionalReturnedValue searchContextObject (QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, String *namename, bool *hasProperty, Value *base, Lookup *lookup, Lookup *originalLookup, Lookup::Call contextGetterCall)
static bool cacheGlobalLookup (QV4::ExecutionEngine *v4, Lookup *lookup, ScopedValue *resultresult)
static bool lostScopeCacheResolves (const QQmlPropertyCache *cache, QV4::ExecutionEngine *v4, String *namename)
static ReturnedValue revertObjectPropertyLookup (Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue revertObjectMethodLookup (Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue throwLostObjectReferenceError (Lookup *l, ExecutionEngine *engine)
template<typename Call>
ReturnedValue callWithScopeObject (Lookup *l, ExecutionEngine *engine, Value *base, Call cc)
template<typename Call>
ReturnedValue callWithContextObject (Lookup *l, ExecutionEngine *engine, Value *base, Call cc)

Function Documentation

◆ cacheGlobalLookup()

bool cacheGlobalLookup ( QV4::ExecutionEngine * v4,
Lookup * lookup,
ScopedValue * result )
static

Resolves the global object getter on lookup and turns it into a lookup that caches a hit in the global object. The global object cannot change, and everything searched before it is either stable or not covered by the lookup anyway. Returns false and leaves the generic global getter in place if the hit cannot be cached.

Definition at line 370 of file qv4qmlcontext.cpp.

◆ callWithContextObject()

template<typename Call>
ReturnedValue callWithContextObject ( Lookup * l,
ExecutionEngine * engine,
Value * base,
Call c )

Definition at line 876 of file qv4qmlcontext.cpp.

◆ callWithScopeObject()

template<typename Call>
ReturnedValue callWithScopeObject ( Lookup * l,
ExecutionEngine * engine,
Value * base,
Call c )

Definition at line 832 of file qv4qmlcontext.cpp.

◆ DEFINE_MANAGED_VTABLE()

DEFINE_MANAGED_VTABLE ( QmlContext )

◆ DEFINE_OBJECT_VTABLE()

◆ getQmlPropertyFlags()

QV4::QObjectWrapper::Flags getQmlPropertyFlags ( const Lookup * l)
static

Definition at line 120 of file qv4qmlcontext.cpp.

◆ lostScopeCacheResolves()

bool lostScopeCacheResolves ( const QQmlPropertyCache * cache,
QV4::ExecutionEngine * v4,
String * name )
static

Definition at line 380 of file qv4qmlcontext.cpp.

◆ performLookup()

template<typename Lookup>
bool performLookup ( ScopedValue * result,
bool * hasProperty,
const Lookup & lookup )

Definition at line 109 of file qv4qmlcontext.cpp.

◆ Q_STATIC_LOGGING_CATEGORY()

QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY ( lcQmlContext ,
"qt.qml.context"  )

◆ revertObjectMethodLookup()

ReturnedValue revertObjectMethodLookup ( Lookup * l,
ExecutionEngine * engine,
Value * base )
static

Definition at line 814 of file qv4qmlcontext.cpp.

◆ revertObjectPropertyLookup()

ReturnedValue revertObjectPropertyLookup ( Lookup * l,
ExecutionEngine * engine,
Value * base )
static

Definition at line 806 of file qv4qmlcontext.cpp.

◆ searchBoundComponentContexts()

OptionalReturnedValue searchBoundComponentContexts ( QV4::ExecutionEngine * v4,
const QQmlRefPointer< QQmlContextData > & context,
QQmlRefPointer< QQmlContextData > & outer,
String * name,
bool * hasProperty,
Value * base,
Lookup * originalLookup,
QQmlEnginePrivate * ep )
static

Searches the contexts enclosing outer that belong to the same compilation unit as context, advancing outer to the first context beyond them. Only applies if the components of the compilation unit are bound.

Definition at line 241 of file qv4qmlcontext.cpp.

◆ searchContextObject()

OptionalReturnedValue searchContextObject ( QV4::ExecutionEngine * v4,
const QQmlRefPointer< QQmlContextData > & context,
String * name,
bool * hasProperty,
Value * base,
Lookup * lookup,
Lookup * originalLookup,
Lookup::Call contextGetterCall )
static

Searches the properties and methods of the context object of context for name, and prepares lookup if it can accelerate the next access. contextGetterCall is the getter to use for properties. It is the scope object getter if scope and context object are the same.

Definition at line 314 of file qv4qmlcontext.cpp.

◆ searchContextProperties()

OptionalReturnedValue searchContextProperties ( QV4::ExecutionEngine * v4,
const QQmlRefPointer< QQmlContextData > & context,
String * name,
bool * hasProperty,
Value * base,
QV4::Lookup * lookup,
QV4::Lookup * originalLookup,
QQmlEnginePrivate * ep )
static

Definition at line 57 of file qv4qmlcontext.cpp.

◆ searchImports()

OptionalReturnedValue searchImports ( QV4::ExecutionEngine * v4,
const QQmlRefPointer< QQmlContextData > & context,
QObject * scopeObject,
String * name,
bool * hasProperty,
Value * base,
Lookup * lookup )
static

Searches the attached properties, enums, imported scripts, types and namespaces visible in context for name.

Definition at line 190 of file qv4qmlcontext.cpp.

◆ searchModule()

OptionalReturnedValue searchModule ( const QQmlContextWrapper * resource,
PropertyKey id,
const Value * receiver,
bool * hasProperty )
static

Searches the module the context wrapped by resource belongs to, if any. This is what code running outside of that context can see besides the plain JavaScript properties.

Definition at line 132 of file qv4qmlcontext.cpp.

◆ searchScopeObject()

OptionalReturnedValue searchScopeObject ( QV4::ExecutionEngine * v4,
const QQmlRefPointer< QQmlContextData > & context,
QObject * scopeObject,
String * name,
bool * hasProperty,
Value * base,
Lookup * lookup )
static

Searches the properties and methods of scopeObject for name, and prepares lookup if it can accelerate the next access.

Definition at line 268 of file qv4qmlcontext.cpp.

◆ setupSingletonLookup()

void setupSingletonLookup ( QV4::ExecutionEngine * v4,
Lookup * lookup,
const QQmlType & type )
static

Prepares lookup to return the singleton type.

Definition at line 155 of file qv4qmlcontext.cpp.

◆ throwLostObjectReferenceError()

ReturnedValue throwLostObjectReferenceError ( Lookup * l,
ExecutionEngine * engine )
static

Definition at line 824 of file qv4qmlcontext.cpp.