diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-09-11 09:50:57 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-09-15 16:26:33 +0200 |
| commit | 6a2aa09e5fbb5275ae4a3bb80f0ab0e931e113b9 (patch) | |
| tree | 98c7746390de6edccf865c71877f6cfc9a0d49b3 | |
| parent | 44ee880d82f0c47f6f12658d700d52d7403c5c13 (diff) | |
QQmlJSScope: Unify flag setters and getters
They can all be inline and the setters should be next to the getters.
Change-Id: I2afc8d5b139b37b3d2ac03738a44b2ddf70195c7
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
| -rw-r--r-- | src/qmlcompiler/qqmljsscope_p.h | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h index b0bc6818a3..5407be0ae6 100644 --- a/src/qmlcompiler/qqmljsscope_p.h +++ b/src/qmlcompiler/qqmljsscope_p.h @@ -371,37 +371,46 @@ public: * * Returns true for objects defined from Qml, and false for objects declared from C++. */ - bool isComposite() const { return m_flags & Composite; } - bool isScript() const { return m_flags & Script; } - bool hasCustomParser() const { return m_flags & CustomParser; } - bool isArrayScope() const { return m_flags & Array; } - bool isInlineComponent() const { return m_flags & InlineComponent; } - bool isWrappedInImplicitComponent() const { return m_flags & WrappedInImplicitComponent; } - bool extensionIsJavaScript() const { return m_flags & ExtensionIsJavaScript; } - bool extensionIsNamespace() const { return m_flags & ExtensionIsNamespace; } - bool isListProperty() const { return m_flags.testFlag(IsListProperty); } - void setIsListProperty(bool v) { m_flags.setFlag(IsListProperty, v); } - bool isSingleton() const { return m_flags & Singleton; } - bool isCreatable() const; - bool isStructured() const; - bool isReferenceType() const { return m_semantics == QQmlJSScope::AccessSemantics::Reference; } - bool isValueType() const { return m_semantics == QQmlJSScope::AccessSemantics::Value; } - - void setIsSingleton(bool v) { m_flags.setFlag(Singleton, v); } - void setCreatableFlag(bool v) { m_flags.setFlag(Creatable, v); } - void setStructuredFlag(bool v) { m_flags.setFlag(Structured, v); } + bool isComposite() const { return m_flags.testFlag(Composite); } void setIsComposite(bool v) { m_flags.setFlag(Composite, v); } + + bool isScript() const { return m_flags.testFlag(Script); } void setIsScript(bool v) { m_flags.setFlag(Script, v); } - void setHasCustomParser(bool v); + + bool hasCustomParser() const { return m_flags.testFlag(CustomParser); } + void setHasCustomParser(bool v) { m_flags.setFlag(CustomParser, v); } + + bool isArrayScope() const { return m_flags.testFlag(Array); } void setIsArrayScope(bool v) { m_flags.setFlag(Array, v); } + + bool isInlineComponent() const { return m_flags.testFlag(InlineComponent); } void setIsInlineComponent(bool v) { m_flags.setFlag(InlineComponent, v); } + + bool isWrappedInImplicitComponent() const { return m_flags.testFlag(WrappedInImplicitComponent); } void setIsWrappedInImplicitComponent(bool v) { m_flags.setFlag(WrappedInImplicitComponent, v); } + + bool extensionIsJavaScript() const { return m_flags.testFlag(ExtensionIsJavaScript); } void setExtensionIsJavaScript(bool v) { m_flags.setFlag(ExtensionIsJavaScript, v); } + + bool extensionIsNamespace() const { return m_flags.testFlag(ExtensionIsNamespace); } void setExtensionIsNamespace(bool v) { m_flags.setFlag(ExtensionIsNamespace, v); } + bool isListProperty() const { return m_flags.testFlag(IsListProperty); } + void setIsListProperty(bool v) { m_flags.setFlag(IsListProperty, v); } + + bool isSingleton() const { return m_flags.testFlag(Singleton); } + void setIsSingleton(bool v) { m_flags.setFlag(Singleton, v); } + + bool isCreatable() const; + void setCreatableFlag(bool v) { m_flags.setFlag(Creatable, v); } + + bool isStructured() const; + void setStructuredFlag(bool v) { m_flags.setFlag(Structured, v); } void setAccessSemantics(AccessSemantics semantics) { m_semantics = semantics; } AccessSemantics accessSemantics() const { return m_semantics; } + bool isReferenceType() const { return m_semantics == QQmlJSScope::AccessSemantics::Reference; } + bool isValueType() const { return m_semantics == QQmlJSScope::AccessSemantics::Value; } std::optional<JavaScriptIdentifier> jsIdentifier(const QString &id) const; std::optional<JavaScriptIdentifier> ownJSIdentifier(const QString &id) const; @@ -600,11 +609,6 @@ inline QQmlJSMetaMethod::AbsoluteFunctionIndex QQmlJSScope::ownRuntimeFunctionIn return m_runtimeFunctionIndices[i]; } -inline void QQmlJSScope::setHasCustomParser(bool v) -{ - m_flags.setFlag(CustomParser, v);; -} - inline void QQmlJSScope::setInlineComponentName(const QString &inlineComponentName) { Q_ASSERT(isInlineComponent()); |
