45 for (
const auto &store : m_resettableStores)
46 checkResettable(store.accumulatorIn, store.instructionOffset);
49 for (
const auto &
base : m_baseTypes) {
50 if (checkBaseType(
base) == Shadowable)
88void QQmlJSShadowCheck::handleStore(
int base,
const QString &memberName)
97 if (checkBaseType(baseType) == NotShadowable)
98 m_baseTypes.
append(baseType);
102 if (checkShadowing(baseType, memberName,
base) == Shadowable)
149QQmlJSShadowCheck::Shadowability QQmlJSShadowCheck::checkShadowing(
152 if (checkBaseType(baseType) == Shadowable)
155 m_baseTypes.
append(baseType);
158 return NotShadowable;
175 return NotShadowable;
180 return NotShadowable;
182 return NotShadowable;
186 u
"Member %1 of %2 can be shadowed"_s.arg(memberName, baseType.
descriptiveName()),
196 currentAnnotation.changedRegister.storedType(), varType);
199 m_adjustedTypes.
insert(currentAnnotation.changedRegister);
202 for (
auto it = currentAnnotation.readRegisters.
begin(),
203 end = currentAnnotation.readRegisters.end();
205 if (
it.key() != baseRegister)
214 return NotShadowable;
218void QQmlJSShadowCheck::checkResettable(
237QQmlJSShadowCheck::Shadowability QQmlJSShadowCheck::checkBaseType(
240 if (!m_adjustedTypes.
contains(baseType))
241 return NotShadowable;
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
iterator find(const Key &key)
void append(parameter_type t)
const QV4::Compiler::JSUnitGenerator * m_jsUnitGenerator
const Function * m_function
const QQmlJSTypeResolver * m_typeResolver
QQmlJS::DiagnosticMessage * m_error
InstructionAnnotations m_annotations
State initialState(const Function *function)
State nextStateFromAnnotations(const State &oldState, const InstructionAnnotations &annotations)
QQmlJS::SourceLocation currentSourceLocation() const
BasicBlocks m_basicBlocks
void setError(const QString &message, int instructionOffset)
void log(const QString &message, QQmlJS::LoggerWarningId id, const QQmlJS::SourceLocation &srcLocation, bool showContext=true, bool showFileName=true, const std::optional< QQmlJSFixSuggestion > &suggestion={}, const QString overrideFileName=QString())
QQmlJSRegisterContent storedIn(const QQmlJSScope::ConstPtr &newStoredType) const
QString descriptiveName() const
QQmlJSMetaProperty property() const
ContentVariant variant() const
QQmlJSScope::ConstPtr storedType() const
@ ExtensionObjectProperty
AccessSemantics accessSemantics() const
void endInstruction(QV4::Moth::Instr::Type) override
void generate_CallPropertyLookup(int nameIndex, int base, int argc, int argv) override
void generate_GetOptionalLookup(int index, int offset) override
QV4::Moth::ByteCodeHandler::Verdict startInstruction(QV4::Moth::Instr::Type) override
void generate_SetLookup(int index, int base) override
void generate_LoadProperty(int nameIndex) override
void generate_CallProperty(int nameIndex, int base, int argc, int argv) override
BlocksAndAnnotations run(const Function *function, QQmlJS::DiagnosticMessage *error)
void generate_GetLookup(int index) override
void generate_StoreProperty(int nameIndex, int base) override
QQmlJSScope::ConstPtr containedType(const QQmlJSRegisterContent &container) const
bool registerContains(const QQmlJSRegisterContent ®, const QQmlJSScope::ConstPtr &type) const
bool isPrefix(const QString &name) const
QQmlJSRegisterContent globalType(const QQmlJSScope::ConstPtr &type) const
QQmlJSRegisterContent convert(const QQmlJSRegisterContent &from, const QQmlJSRegisterContent &to) const
bool canHoldUndefined(const QQmlJSRegisterContent &content) const
void adjustOriginalType(const QQmlJSScope::ConstPtr &tracked, const QQmlJSScope::ConstPtr &conversion) const
QQmlJSRegisterContent memberType(const QQmlJSRegisterContent &type, const QString &name, int lookupIndex=QQmlJSRegisterContent::InvalidLookupIndex) const
QQmlJSScope::ConstPtr varType() const
bool contains(const T &value) const
iterator insert(const T &value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
int currentInstructionOffset() const
QSet< QString >::iterator it
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError * error
GLenum GLuint GLintptr offset
const QQmlSA::LoggerWarningId qmlCompiler
const QQmlJSRegisterContent & accumulatorIn() const
The accumulatorIn is the input register of the current instruction.
VirtualRegisters registers
int changedRegisterIndex() const
bool readsRegister(int registerIndex) const
bool hasSideEffects() const
QString lookupName(int index) const
QString stringForIndex(int index) const