You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
GDScript: Fix infinite loop in autocomplete
It happened when the definition of the variable contained the variable itself.
This commit is contained in:
@@ -1376,11 +1376,11 @@ static bool _guess_identifier_type_from_base(const GDScriptCompletionContext &p_
|
|||||||
for (int i = 0; i < base_type.class_type->variables.size(); i++) {
|
for (int i = 0; i < base_type.class_type->variables.size(); i++) {
|
||||||
GDScriptParser::ClassNode::Member m = base_type.class_type->variables[i];
|
GDScriptParser::ClassNode::Member m = base_type.class_type->variables[i];
|
||||||
if (m.identifier == p_identifier) {
|
if (m.identifier == p_identifier) {
|
||||||
if (m.data_type.has_type) {
|
|
||||||
r_type.type = m.data_type;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (m.expression) {
|
if (m.expression) {
|
||||||
|
if (p_context.line == m.expression->line) {
|
||||||
|
// Variable used in the same expression
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (_guess_expression_type(p_context, m.expression, r_type)) {
|
if (_guess_expression_type(p_context, m.expression, r_type)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1389,6 +1389,10 @@ static bool _guess_identifier_type_from_base(const GDScriptCompletionContext &p_
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m.data_type.has_type) {
|
||||||
|
r_type.type = m.data_type;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user