Skip to content

Commit

Permalink
Fixed regression bug caused in godotengine#30095 and actually fix the…
Browse files Browse the repository at this point in the history
… issue it was supposed to fix(godotengine#26850)
  • Loading branch information
Anutrix authored and myhalibobo committed Sep 3, 2019
1 parent 637e3e5 commit 0b8963d
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions modules/gdscript/gdscript_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,8 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
_add_warning(GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, -1, identifier.operator String());
}
} break;
FALLTHROUGH;
}
case GDScriptTokenizer::TK_OP_ASSIGN: {
lv->assignments += 1;
lv->usages--; // Assignment is not really usage
Expand Down Expand Up @@ -846,24 +847,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (current_function) {
int arg_idx = current_function->arguments.find(identifier);
if (arg_idx != -1) {
switch (tokenizer->get_token()) {
case GDScriptTokenizer::TK_OP_ASSIGN_ADD:
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND:
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_OR:
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_XOR:
case GDScriptTokenizer::TK_OP_ASSIGN_DIV:
case GDScriptTokenizer::TK_OP_ASSIGN_MOD:
case GDScriptTokenizer::TK_OP_ASSIGN_MUL:
case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_LEFT:
case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT:
case GDScriptTokenizer::TK_OP_ASSIGN_SUB:
case GDScriptTokenizer::TK_OP_ASSIGN: {
// Assignment is not really usage
current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] - 1;
} break;
default: {
current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] + 1;
}
if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
// Assignment is not really usage
current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] - 1;
} else {
current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] + 1;
}
}
}
Expand Down

0 comments on commit 0b8963d

Please sign in to comment.