diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qmldom/qqmldomastcreator.cpp | 33 | ||||
-rw-r--r-- | src/qmldom/qqmldomastcreator_p.h | 3 | ||||
-rw-r--r-- | src/qmldom/qqmldomscriptelements_p.h | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/qmldom/qqmldomastcreator.cpp b/src/qmldom/qqmldomastcreator.cpp index 0462c7c65c..ae6acbb366 100644 --- a/src/qmldom/qqmldomastcreator.cpp +++ b/src/qmldom/qqmldomastcreator.cpp @@ -1155,6 +1155,39 @@ bool QQmlDomAstCreator::visit(AST::StringLiteral *expression) return true; } +bool QQmlDomAstCreator::visit(AST::NullExpression *expression) +{ + if (!m_enableScriptExpressions) + return false; + + auto current = makeScriptElement<ScriptElements::Literal>(expression); + current->setLiteralValue(nullptr); + pushScriptElement(current); + return true; +} + +bool QQmlDomAstCreator::visit(AST::TrueLiteral *expression) +{ + if (!m_enableScriptExpressions) + return false; + + auto current = makeScriptElement<ScriptElements::Literal>(expression); + current->setLiteralValue(true); + pushScriptElement(current); + return true; +} + +bool QQmlDomAstCreator::visit(AST::FalseLiteral *expression) +{ + if (!m_enableScriptExpressions) + return false; + + auto current = makeScriptElement<ScriptElements::Literal>(expression); + current->setLiteralValue(false); + pushScriptElement(current); + return true; +} + bool QQmlDomAstCreator::visit(AST::VariableDeclarationList *) { if (!m_enableScriptExpressions) diff --git a/src/qmldom/qqmldomastcreator_p.h b/src/qmldom/qqmldomastcreator_p.h index a99294fd23..77fe2af823 100644 --- a/src/qmldom/qqmldomastcreator_p.h +++ b/src/qmldom/qqmldomastcreator_p.h @@ -321,6 +321,9 @@ public: bool visit(AST::IdentifierExpression *expression) override; bool visit(AST::NumericLiteral *expression) override; bool visit(AST::StringLiteral *expression) override; + bool visit(AST::NullExpression *expression) override; + bool visit(AST::TrueLiteral *expression) override; + bool visit(AST::FalseLiteral *expression) override; void throwRecursionDepthError() override; diff --git a/src/qmldom/qqmldomscriptelements_p.h b/src/qmldom/qqmldomscriptelements_p.h index 0ddcb54938..00cc25fe49 100644 --- a/src/qmldom/qqmldomscriptelements_p.h +++ b/src/qmldom/qqmldomscriptelements_p.h @@ -167,7 +167,7 @@ public: using BaseT::BaseT; ~Literal() override{}; - using VariantT = std::variant<QString, double>; + using VariantT = std::variant<QString, double, bool, std::nullptr_t>; void setLiteralValue(VariantT value) { m_value = value; } VariantT literalValue() const { return m_value; } |