Merge pull request #32088 from abmyii/2.1

Fix crash when guessing type of variable declared to itself - Godot 2.1
This commit is contained in:
Rémi Verschelde 2019-09-24 13:23:03 +02:00 committed by GitHub
commit e6b20e1626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -960,7 +960,7 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_
}
//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);
}
@ -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);
return true;
} 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);
if (rtype && r_type.type != Variant::NIL)