Skip to content

Commit

Permalink
GDScript: Fix cached parser error when using typed Dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
rune-scape committed Oct 21, 2024
1 parent 44fa552 commit 5a1298e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,8 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
Finally finally([&]() {
ensure_cached_external_parser_for_class(member.get_datatype().class_type, p_class, "Trying to resolve datatype of class member", p_source);
GDScriptParser::DataType member_type = member.get_datatype();
if (member_type.has_container_element_type(0)) {
ensure_cached_external_parser_for_class(member_type.get_container_element_type(0).class_type, p_class, "Trying to resolve datatype of class member", p_source);
for (int i = 0; i < member_type.get_container_element_type_count(); ++i) {
ensure_cached_external_parser_for_class(member_type.get_container_element_type(i).class_type, p_class, "Trying to resolve datatype of class member", p_source);
}
});

Expand Down
4 changes: 4 additions & 0 deletions modules/gdscript/gdscript_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ class GDScriptParser {
container_element_types.write[p_index] = DataType(p_type);
}

_FORCE_INLINE_ int get_container_element_type_count() const {
return container_element_types.size();
}

_FORCE_INLINE_ DataType get_container_element_type(int p_index) const {
ERR_FAIL_INDEX_V(p_index, container_element_types.size(), get_variant_type());
return container_element_types[p_index];
Expand Down

0 comments on commit 5a1298e

Please sign in to comment.