![]() |
Qt 6.x
The Qt SDK
|
#include <qqmljsshadowcheck_p.h>
Public Member Functions | |
QQmlJSShadowCheck (const QV4::Compiler::JSUnitGenerator *jsUnitGenerator, const QQmlJSTypeResolver *typeResolver, QQmlJSLogger *logger) | |
~QQmlJSShadowCheck ()=default | |
void | run (InstructionAnnotations *annotations, const Function *function, QQmlJS::DiagnosticMessage *error) |
![]() | |
QQmlJSCompilePass (const QV4::Compiler::JSUnitGenerator *jsUnitGenerator, const QQmlJSTypeResolver *typeResolver, QQmlJSLogger *logger) | |
![]() | |
ByteCodeHandler ()=default | |
virtual | ~ByteCodeHandler () |
void | decode (const char *code, uint len) |
void | reset () |
int | currentInstructionOffset () const |
int | nextInstructionOffset () const |
int | absoluteOffset (int relativeOffset) const |
Private Member Functions | |
void | generate_LoadProperty (int nameIndex) override |
void | generate_GetLookup (int index) override |
void | generate_StoreProperty (int nameIndex, int base) override |
void | generate_SetLookup (int index, int base) override |
void | generate_CallProperty (int nameIndex, int base, int argc, int argv) override |
void | generate_CallPropertyLookup (int nameIndex, int base, int argc, int argv) override |
QV4::Moth::ByteCodeHandler::Verdict | startInstruction (QV4::Moth::Instr::Type) override |
void | endInstruction (QV4::Moth::Instr::Type) override |
This pass looks for possible shadowing when accessing members of QML-exposed types. A member can be shadowed if a non-final property is re-declared in a derived class. As the QML engine will always pick up the most derived variant of that property, we cannot rely on any property of a type to be actually accessible, unless one of a few special cases holds:
If the property is potentially shadowed, we can still retrieve it, but we don't know its type. We should assume "var" then.
All of the above also holds for methods. There we have to transform the arguments and return types into "var".
Definition at line 21 of file qqmljsshadowcheck_p.h.
|
inline |
Definition at line 24 of file qqmljsshadowcheck_p.h.
|
default |
|
overrideprivatevirtual |
Implements QV4::Moth::ByteCodeHandler.
Definition at line 106 of file qqmljsshadowcheck.cpp.
|
overrideprivate |
Definition at line 84 of file qqmljsshadowcheck.cpp.
References base, QV4::Compiler::JSUnitGenerator::lookupName(), QQmlJSCompilePass::m_jsUnitGenerator, Q_UNUSED, and QQmlJSCompilePass::State::registers.
|
overrideprivate |
Definition at line 91 of file qqmljsshadowcheck.cpp.
References base, QV4::Compiler::JSUnitGenerator::lookupName(), QQmlJSCompilePass::m_jsUnitGenerator, Q_UNUSED, and QQmlJSCompilePass::State::registers.
|
overrideprivate |
Definition at line 61 of file qqmljsshadowcheck.cpp.
References QQmlJSCompilePass::Accumulator, QFlatMap< Key, T, Compare, KeyContainer, MappedContainer >::end(), QFlatMap< Key, T, Compare, KeyContainer, MappedContainer >::find(), QV4::Compiler::JSUnitGenerator::lookupName(), QQmlJSCompilePass::m_jsUnitGenerator, QQmlJSCompilePass::State::readsRegister(), and QQmlJSCompilePass::State::registers.
|
overrideprivate |
Definition at line 48 of file qqmljsshadowcheck.cpp.
References QQmlJSCompilePass::Accumulator, QFlatMap< Key, T, Compare, KeyContainer, MappedContainer >::end(), QFlatMap< Key, T, Compare, KeyContainer, MappedContainer >::find(), QQmlJSCompilePass::m_jsUnitGenerator, QQmlJSCompilePass::State::readsRegister(), QQmlJSCompilePass::State::registers, and QV4::Compiler::JSUnitGenerator::stringForIndex().
|
overrideprivate |
Definition at line 79 of file qqmljsshadowcheck.cpp.
References base, QV4::Compiler::JSUnitGenerator::lookupName(), QQmlJSCompilePass::m_jsUnitGenerator, and QQmlJSCompilePass::State::registers.
|
overrideprivate |
Definition at line 73 of file qqmljsshadowcheck.cpp.
References base, QQmlJSCompilePass::m_jsUnitGenerator, QQmlJSCompilePass::State::registers, and QV4::Compiler::JSUnitGenerator::stringForIndex().
void QQmlJSShadowCheck::run | ( | InstructionAnnotations * | annotations, |
const Function * | function, | ||
QQmlJS::DiagnosticMessage * | error | ||
) |
Definition at line 37 of file qqmljsshadowcheck.cpp.
References QQmlJSCompilePass::Function::code, QByteArray::constData(), decode, error, function, QQmlJSCompilePass::initialState(), QQmlJSCompilePass::m_error, QQmlJSCompilePass::m_function, and QByteArray::size().
|
overrideprivatevirtual |
Implements QV4::Moth::ByteCodeHandler.
Definition at line 98 of file qqmljsshadowcheck.cpp.
References QQmlJSCompilePass::State::changedRegisterIndex(), QQmlJSCompilePass::State::hasSideEffects(), QQmlJSCompilePass::InvalidRegister, QQmlJSCompilePass::nextStateFromAnnotations(), QV4::Moth::ByteCodeHandler::ProcessInstruction, and QV4::Moth::ByteCodeHandler::SkipInstruction.