1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

GDScript: Fix subscript resolution for constant non-metatypes

This commit is contained in:
Danil Alexeev
2023-09-19 20:35:45 +03:00
parent 571cd0eb79
commit c35cb51d74
5 changed files with 193 additions and 17 deletions

View File

@@ -4099,7 +4099,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
GDScriptParser::DataType base_type = p_subscript->base->get_datatype();
bool valid = false;
// If the base is a metatype, use the analyzer instead.
if (p_subscript->base->is_constant && !base_type.is_meta_type) {
if (p_subscript->base->is_constant && !base_type.is_meta_type && base_type.kind != GDScriptParser::DataType::CLASS) {
// Just try to get it.
Variant value = p_subscript->base->reduced_value.get_named(p_subscript->attribute->name, valid);
if (valid) {