6#include <private/qjsvalue_p.h>
7#include <private/qqmlcontext_p.h>
8#include <private/qqmlengine_p.h>
9#include <private/qqmlglobal_p.h>
10#include <private/qqmljavascriptexpression_p.h>
11#include <private/qqmllistwrapper_p.h>
12#include <private/qqmltypewrapper_p.h>
13#include <private/qv4compileddata_p.h>
14#include <private/qv4engine_p.h>
15#include <private/qv4function_p.h>
16#include <private/qv4identifiertable_p.h>
17#include <private/qv4lookup_p.h>
18#include <private/qv4mm_p.h>
19#include <private/qv4module_p.h>
20#include <private/qv4objectproto_p.h>
21#include <private/qv4qobjectwrapper_p.h>
22#include <private/qv4stackframe_p.h>
23#include <private/qv4value_p.h>
25#include <QtCore/qloggingcategory.h>
40 this->scopeObject.init(scopeObject);
43void Heap::QQmlContextWrapper::destroy()
47 scopeObject.destroy();
56 const int propertyIdx =
context->propertyIndex(
name);
58 if (propertyIdx == -1)
61 if (propertyIdx < context->numIdValues()) {
69 }
else if (originalLookup) {
95template<
typename Lookup>
98 *
result = lookup(&hasProp);
101 *hasProperty = hasProp;
123 if (resource->d()->module) {
125 bool hasProp =
false;
130 return value->asReturnedValue();
147 return result->asReturnedValue();
162 const auto globalLookup = [v4, &
name](
bool *hasProp) {
166 const auto jsLookup = [resource, &
id, receiver](
bool *hasProp) {
170 const bool isJSContext =
context->isJSContext();
174 return result->asReturnedValue();
197 return result->asReturnedValue();
200 if (
context->imports() && (
name->startsWithUpper() ||
context->valueTypesAreAddressable())) {
207 if (
r.scriptIndex != -1) {
215 return scripts->get(
r.scriptIndex);
217 }
else if (
r.type.isValid()) {
219 bool isValueSingleton =
false;
220 if (
r.type.isSingleton()) {
222 if (
r.type.isQObjectSingleton() ||
r.type.isCompositeSingleton()) {
239 isValueSingleton =
true;
248 }
else if (
r.importNamespace) {
255 return result->asReturnedValue();
262 Lookup *
const originalLookup = lookup;
267 if (scopeObject ==
context->contextObject()) {
268 scopeObject =
nullptr;
278 bool hasProp =
false;
314 return result->asReturnedValue();
317 scopeObject =
nullptr;
322 bool hasProp =
false;
357 }
else if (originalLookup) {
362 return result->asReturnedValue();
376 return result->asReturnedValue();
380 if (originalLookup) {
384 lookup = originalLookup;
391 return result->asReturnedValue();
396 return result->asReturnedValue();
399 expressionContext->setUnresolvedNames(
true);
415 if (
id.
isSymbol() ||
id.isArrayIndex())
425 auto member =
wrapper->internalClass()->findValueOrSetter(
id);
426 if (member.index < UINT_MAX)
427 return wrapper->putValue(member.index, member.attrs,
value);
444 if (
const int propertyIndex =
context->propertyIndex(
name); propertyIndex != -1) {
445 if (propertyIndex < context->numIdValues()) {
456 scopeObject =
nullptr;
459 if (
context->contextObject() &&
467 expressionContext->setUnresolvedNames(
true);
487 if (
ctx->type == Heap::ExecutionContext::Type_CallContext) {
489 if (
index < std::numeric_limits<uint>::max()) {
490 if (!
func->detectedInjectedParameters) {
492 qCWarning(lcQmlContext).nospace().noquote()
494 <<
" Parameter \"" <<
name.toQString() <<
"\" is not declared."
495 <<
" Injection of parameters into signal handlers is deprecated."
496 <<
" Use JavaScript functions with formal parameters instead.";
499 func->detectedInjectedParameters =
true;
508 if (
ctx->type != Heap::ExecutionContext::Type_BlockContext &&
ctx->type != Heap::ExecutionContext::Type_CallContext)
516 if (callingQmlContext) {
531 return result->asReturnedValue();
612template<
typename Call>
659template<
typename Call>
756 bool hasProp =
false;
765 return result->asReturnedValue();
770 bool hasProp =
false;
773 return result->asReturnedValue();
775 expressionContext->setUnresolvedNames(
true);
803 Heap::ExecutionContext::init(Heap::ExecutionContext::Type_QmlContext);
804 outer.set(internalClass->engine, outerContext->d());
806 this->activation.set(internalClass->engine, qml->d());
817 std::move(
context), scopeObject));
static QV4::Value * takeManagedValue(QJSValue *jsval)
static QV4::ReturnedValue asReturnedValue(const QJSValue *jsval)
static const QString * asQString(const QJSValue *jsval)
The QJSValue class acts as a container for Qt/JavaScript data types.
static qsizetype context_count(QQmlListProperty< QObject > *)
QVariant propertyValue(int index) const
static QObject * context_at(QQmlListProperty< QObject > *, qsizetype)
QQmlPropertyCache::ConstPtr propertyCache
static bool wasDeleted(const QObject *)
static QQmlData * get(QObjectPrivate *priv, bool create)
QQmlPropertyCapture * propertyCapture
static QQmlEnginePrivate * get(QQmlEngine *e)
void captureProperty(QObject *object, const QMetaProperty &property) const
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
void captureProperty(QQmlNotifier *)
\macro QT_RESTRICTED_CAST_FROM_ASCII
ObjectType::Data * allocate(Args &&... args)
ManagedType::Data * alloc(Args &&... args)
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
void setupQObjectMethodLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData, const Object *self, Heap::QObjectMethod *method)
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
QLatin1StringView QLatin1String
static ReturnedValue revertObjectMethodLookup(Lookup *l, ExecutionEngine *engine, Value *base)
static QV4::QObjectWrapper::Flags getQmlPropertyFlags(const Lookup *l)
static ReturnedValue revertObjectPropertyLookup(Lookup *l, ExecutionEngine *engine, Value *base)
static OptionalReturnedValue searchContextProperties(QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, String *name, bool *hasProperty, Value *base, QV4::Lookup *lookup, QV4::Lookup *originalLookup, QQmlEnginePrivate *ep)
ReturnedValue callWithScopeObject(ExecutionEngine *engine, Value *base, Call c)
ReturnedValue callWithContextObject(ExecutionEngine *engine, Value *base, Call c)
bool performLookup(ScopedValue *result, bool *hasProperty, const Lookup &lookup)
#define DEFINE_OBJECT_VTABLE(classname)
#define DEFINE_MANAGED_VTABLE(classname)
\inmodule QtCore \reentrant
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
IdentifierTable * identifierTable
MemoryManager * memoryManager
CppStackFrame * currentStackFrame
QQmlRefPointer< QQmlContextData > callingQmlContext() const
ReturnedValue throwError(const Value &value)
ReturnedValue throwReferenceError(const Value &value)
QV4::ReturnedValue fromVariant(const QVariant &)
QQmlEngine * qmlEngine() const
static Heap::ExecutionContext * qmlContext(Heap::ExecutionContext *ctx)
ExecutionContext * currentContext() const
CompiledData::CompilationUnitBase * compilationUnit
ReturnedValue asReturnedValue() const
PropertyKey asPropertyKey(const Heap::String *str)
ReturnedValue(* globalGetter)(Lookup *l, ExecutionEngine *engine)
QV4::ReturnedValue singletonValue
struct QV4::Lookup::@576::@608 qmlContextGlobalLookup
struct QV4::Lookup::@576::@601 qobjectLookup
struct QV4::Lookup::@576::@606 qmlContextSingletonLookup
ReturnedValue resolveGlobalGetter(ExecutionEngine *engine)
Heap::Base * qmlTypeWrapper
ReturnedValue(* qmlContextPropertyGetter)(Lookup *l, ExecutionEngine *engine, Value *thisObject)
Heap::Base * singletonObject
static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionEngine *engine)
struct QV4::Lookup::@576::@605 qmlContextScriptLookup
ReturnedValue(* getterTrampoline)(Lookup *l, ExecutionEngine *engine)
struct QV4::Lookup::@576::@607 qmlContextIdObjectLookup
struct QV4::Lookup::@576::@609 qmlTypeLookup
struct QV4::Lookup::@576::@602 qobjectMethodLookup
const QQmlPropertyCache * propertyCache
Q_ALWAYS_INLINE Heap::Base * heapObject() const
ExecutionEngine * engine() const
const Value * propertyData(uint index) const
bool hasProperty(PropertyKey id) const
ReturnedValue get(StringOrSymbol *name, bool *hasProperty=nullptr, const Value *receiver=nullptr) const
static bool setQmlProperty(ExecutionEngine *engine, const QQmlRefPointer< QQmlContextData > &qmlContext, QObject *object, String *name, Flags flags, const Value &value)
ReturnedValue getQmlProperty(const QQmlRefPointer< QQmlContextData > &qmlContext, String *name, Flags flags, bool *hasProperty=nullptr) const
static ReturnedValue lookupPropertyGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
static ReturnedValue lookupMethodGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue lookupScopeObjectMethod(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupSingleton(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupInParentContextHierarchy(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupContextObjectMethod(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue getPropertyAndBase(const QQmlContextWrapper *resource, PropertyKey id, const Value *receiver, bool *hasProperty, Value *base, Lookup *lookup=nullptr)
QQmlRefPointer< QQmlContextData > getContext() const
static ReturnedValue lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
V4_NEEDS_DESTROY QObject * getScopeObject() const
static ReturnedValue lookupIdObjectInParentContext(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupIdObject(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue resolveQmlContextPropertyLookupGetter(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScopeObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupValueSingleton(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScopeFallbackProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupInGlobalObject(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupType(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScript(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlType &, Heap::QQmlTypeWrapper::TypeNameMode=Heap::QQmlTypeWrapper::IncludeEnums)
static Heap::QmlContext * create(QV4::ExecutionContext *parent, QQmlRefPointer< QQmlContextData > context, QObject *scopeObject)
static V4_NEEDS_DESTROY ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, QMetaType propType)
bool hasException() const
constexpr ReturnedValue asReturnedValue() const
static constexpr VTable::Get virtualGet
static constexpr VTable::Put virtualPut
QML_NEARLY_ALWAYS_INLINE Object * objectValue() const
static Value fromHeapObject(HeapBasePtr m)
static constexpr Value fromReturnedValue(ReturnedValue val)
QML_NEARLY_ALWAYS_INLINE Value::HeapBasePtr heapObject() const
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent