summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGeorge L. Albany <Megacake1234@gmail.com>2022-07-03 23:53:31 -0400
committerGeorge L. Albany <Megacake1234@gmail.com>2022-07-18 00:53:31 -0400
commit8035f1e36fe9d161fa98f9b1a2d2d7a7d0dd62d9 (patch)
tree9d03dd7615febfde5dfe9d7c3df677cb5f0cadaf /modules
parentecc86afc00c6ace07bfc05ea6ebe8a971d40934b (diff)
Allow non-constant string message for assert
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 8b4c245bf6..50e319fdd6 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -1590,8 +1590,8 @@ void GDScriptAnalyzer::resolve_assert(GDScriptParser::AssertNode *p_assert) {
reduce_expression(p_assert->condition);
if (p_assert->message != nullptr) {
reduce_expression(p_assert->message);
- if (!p_assert->message->is_constant || p_assert->message->reduced_value.get_type() != Variant::STRING) {
- push_error(R"(Expected constant string for assert error message.)", p_assert->message);
+ if (!p_assert->message->get_datatype().has_no_type() && (p_assert->message->get_datatype().kind != GDScriptParser::DataType::BUILTIN || p_assert->message->get_datatype().builtin_type != Variant::STRING)) {
+ push_error(R"(Expected string for assert error message.)", p_assert->message);
}
}