You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Fix crash when guessing type of variable declared to itself
Fixes #10972
(cherry picked from commit b7fd065f5c)
This commit is contained in:
committed by
Rémi Verschelde
parent
b5c444a671
commit
f4a6e3dded
@@ -960,7 +960,7 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_
|
|||||||
}
|
}
|
||||||
|
|
||||||
//use the last assignment, (then backwards?)
|
//use the last assignment, (then backwards?)
|
||||||
if (last_assign) {
|
if (last_assign && last_assign_line != p_line) {
|
||||||
|
|
||||||
return _guess_expression_type(context, last_assign, last_assign_line, r_type);
|
return _guess_expression_type(context, last_assign, last_assign_line, r_type);
|
||||||
}
|
}
|
||||||
@@ -1094,6 +1094,8 @@ static bool _guess_identifier_type(GDCompletionContext &context, int p_line, con
|
|||||||
r_type = _get_type_from_pinfo(context._class->variables[i]._export);
|
r_type = _get_type_from_pinfo(context._class->variables[i]._export);
|
||||||
return true;
|
return true;
|
||||||
} else if (context._class->variables[i].expression) {
|
} else if (context._class->variables[i].expression) {
|
||||||
|
if (p_line <= context._class->variables[i].line)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool rtype = _guess_expression_type(context, context._class->variables[i].expression, context._class->variables[i].line, r_type);
|
bool rtype = _guess_expression_type(context, context._class->variables[i].expression, context._class->variables[i].line, r_type);
|
||||||
if (rtype && r_type.type != Variant::NIL)
|
if (rtype && r_type.type != Variant::NIL)
|
||||||
|
|||||||
Reference in New Issue
Block a user