diff options
author | Antonio Dell'Annunziata <contact@antonio-da.dev> | 2022-08-07 13:39:11 +0200 |
---|---|---|
committer | Antonio Dell'Annunziata <contact@antonio-da.dev> | 2022-08-07 16:09:24 +0200 |
commit | f81a166ab81c6c5c875cf41d2dc9f54d55c07043 (patch) | |
tree | a36a28484d163e9fa150820a77247da018935356 /modules/gdscript/gdscript_analyzer.cpp | |
parent | 428aed8e877b0b9e2de6502a7cbeb496bfba159f (diff) | |
download | redot-engine-f81a166ab81c6c5c875cf41d2dc9f54d55c07043.tar.gz |
fix(gdscript): Infer type from preload const
When resolving the type of the attribute from the variant, the result_type.kind was overritten for no reason.
It is assumed that this only needs to be done, if the variant value is not valid to have any kind here.
Solves #63715
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 7ed440929c..a07d4855f3 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -3238,12 +3238,12 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri Variant value = p_subscript->base->reduced_value.get_named(p_subscript->attribute->name, valid); if (!valid) { push_error(vformat(R"(Cannot get member "%s" from "%s".)", p_subscript->attribute->name, p_subscript->base->reduced_value), p_subscript->index); + result_type.kind = GDScriptParser::DataType::VARIANT; } else { p_subscript->is_constant = true; p_subscript->reduced_value = value; result_type = type_from_variant(value, p_subscript); } - result_type.kind = GDScriptParser::DataType::VARIANT; } else { GDScriptParser::DataType base_type = p_subscript->base->get_datatype(); |