Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <qqmljsshadowcheck_p.h>
Public Member Functions | |
QQmlJSShadowCheck (const QV4::Compiler::JSUnitGenerator *jsUnitGenerator, const QQmlJSTypeResolver *typeResolver, QQmlJSLogger *logger, BasicBlocks basicBlocks, InstructionAnnotations annotations) | |
~QQmlJSShadowCheck ()=default | |
BlocksAndAnnotations | run (const Function *function, QQmlJS::DiagnosticMessage *error) |
Public Member Functions inherited from QQmlJSCompilePass | |
QQmlJSCompilePass (const QV4::Compiler::JSUnitGenerator *jsUnitGenerator, const QQmlJSTypeResolver *typeResolver, QQmlJSLogger *logger, BasicBlocks basicBlocks={}, InstructionAnnotations annotations={}) | |
Public Member Functions inherited from QV4::Moth::ByteCodeHandler | |
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_GetOptionalLookup (int index, int offset) 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 145 of file qqmljsshadowcheck.cpp.
|
overrideprivate |
Definition at line 123 of file qqmljsshadowcheck.cpp.
References base, QV4::Compiler::JSUnitGenerator::lookupName(), QQmlJSCompilePass::m_jsUnitGenerator, Q_UNUSED, and QQmlJSCompilePass::State::registers.
|
overrideprivate |
Definition at line 130 of file qqmljsshadowcheck.cpp.
References base, QV4::Compiler::JSUnitGenerator::lookupName(), QQmlJSCompilePass::m_jsUnitGenerator, Q_UNUSED, and QQmlJSCompilePass::State::registers.
|
overrideprivate |
Definition at line 70 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.
Referenced by generate_GetOptionalLookup().
|
overrideprivate |
Definition at line 82 of file qqmljsshadowcheck.cpp.
References generate_GetLookup(), and Q_UNUSED.
|
overrideprivate |
Definition at line 57 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 118 of file qqmljsshadowcheck.cpp.
References base, QV4::Compiler::JSUnitGenerator::lookupName(), and QQmlJSCompilePass::m_jsUnitGenerator.
|
overrideprivate |
Definition at line 113 of file qqmljsshadowcheck.cpp.
References base, QQmlJSCompilePass::m_jsUnitGenerator, and QV4::Compiler::JSUnitGenerator::stringForIndex().
QQmlJSCompilePass::BlocksAndAnnotations QQmlJSShadowCheck::run | ( | const Function * | function, |
QQmlJS::DiagnosticMessage * | error ) |
Definition at line 37 of file qqmljsshadowcheck.cpp.
References base, QQmlJSCompilePass::Function::code, QByteArray::constData(), decode, error, function, QQmlJSCompilePass::initialState(), QQmlJSCompilePass::m_annotations, QQmlJSCompilePass::m_basicBlocks, QQmlJSCompilePass::m_error, QQmlJSCompilePass::m_function, and QByteArray::size().
|
overrideprivatevirtual |
Implements QV4::Moth::ByteCodeHandler.
Definition at line 137 of file qqmljsshadowcheck.cpp.
References QQmlJSCompilePass::State::changedRegisterIndex(), QQmlJSCompilePass::State::hasSideEffects(), QQmlJSCompilePass::InvalidRegister, QQmlJSCompilePass::m_annotations, QQmlJSCompilePass::nextStateFromAnnotations(), QV4::Moth::ByteCodeHandler::ProcessInstruction, and QV4::Moth::ByteCodeHandler::SkipInstruction.