Skip to content

Commit

Permalink
Fix crash when guessing type of variable declared to itself
Browse files Browse the repository at this point in the history
  • Loading branch information
bojidar-bg committed Nov 8, 2017
1 parent 5fb359d commit b7fd065
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/gdscript/gd_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,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);
}
Expand Down Expand Up @@ -1194,6 +1194,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)
Expand Down

0 comments on commit b7fd065

Please sign in to comment.