diff options
author | Dmitrii Maganov <vonagam@gmail.com> | 2023-03-17 05:36:50 +0200 |
---|---|---|
committer | Dmitrii Maganov <vonagam@gmail.com> | 2023-03-17 05:37:56 +0200 |
commit | 5d0b183822052e894c98d8d0ea997e0afddc93ed (patch) | |
tree | 00830c8c2f7e342a222828208e0c127ff99c44dd /modules/gdscript/gdscript_analyzer.cpp | |
parent | 1e0f7a12f7c762ee1d73795485b0d00db3cf2ac8 (diff) | |
download | redot-engine-5d0b183822052e894c98d8d0ea997e0afddc93ed.tar.gz |
GDScript: Allow usage of literal false in assert without a warning
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 38d5ae6b77..607d9f034f 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2007,7 +2007,7 @@ void GDScriptAnalyzer::resolve_assert(GDScriptParser::AssertNode *p_assert) { if (p_assert->condition->is_constant) { if (p_assert->condition->reduced_value.booleanize()) { parser->push_warning(p_assert->condition, GDScriptWarning::ASSERT_ALWAYS_TRUE); - } else { + } else if (!(p_assert->condition->type == GDScriptParser::Node::LITERAL && static_cast<GDScriptParser::LiteralNode *>(p_assert->condition)->value.get_type() == Variant::BOOL)) { parser->push_warning(p_assert->condition, GDScriptWarning::ASSERT_ALWAYS_FALSE); } } |