diff options
author | marxin <mliska@suse.cz> | 2019-02-12 21:10:08 +0100 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-02-20 19:44:12 +0100 |
commit | 8d51618949d5ea8a94e0f504401e8f852a393968 (patch) | |
tree | 6c0ab829b02aba47ff3dc27b9a14d3c3a0658a3b /modules/gdscript/gdscript_parser.cpp | |
parent | 132e2f458df7a3551a251d68afeccd0362ca6be2 (diff) |
Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index b53d37226c..a642abeb0a 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2640,14 +2640,14 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) { local_var->assign = e->value(); local_var->set_datatype(local_var->assign->get_datatype()); - IdentifierNode *id = alloc_node<IdentifierNode>(); - id->name = local_var->name; - id->declared_block = branch->body; - id->set_datatype(local_var->assign->get_datatype()); + IdentifierNode *id2 = alloc_node<IdentifierNode>(); + id2->name = local_var->name; + id2->declared_block = branch->body; + id2->set_datatype(local_var->assign->get_datatype()); OperatorNode *op = alloc_node<OperatorNode>(); op->op = OperatorNode::OP_ASSIGN; - op->arguments.push_back(id); + op->arguments.push_back(id2); op->arguments.push_back(local_var->assign); branch->body->statements.push_front(op); @@ -2694,9 +2694,9 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { if (pending_newline != -1) { - NewLineNode *nl = alloc_node<NewLineNode>(); - nl->line = pending_newline; - p_block->statements.push_back(nl); + NewLineNode *nl2 = alloc_node<NewLineNode>(); + nl2->line = pending_newline; + p_block->statements.push_back(nl2); pending_newline = -1; } @@ -2735,9 +2735,9 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } - NewLineNode *nl = alloc_node<NewLineNode>(); - nl->line = tokenizer->get_token_line(); - p_block->statements.push_back(nl); + NewLineNode *nl2 = alloc_node<NewLineNode>(); + nl2->line = tokenizer->get_token_line(); + p_block->statements.push_back(nl2); } break; case GDScriptTokenizer::TK_CF_PASS: { @@ -2922,14 +2922,14 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { cf_else->cf_type = ControlFlowNode::CF_IF; //condition - Node *condition = _parse_and_reduce_expression(p_block, p_static); - if (!condition) { + Node *condition2 = _parse_and_reduce_expression(p_block, p_static); + if (!condition2) { if (_recover_from_completion()) { break; } return; } - cf_else->arguments.push_back(condition); + cf_else->arguments.push_back(condition2); cf_else->cf_type = ControlFlowNode::CF_IF; cf_if->body_else->statements.push_back(cf_else); @@ -2992,8 +2992,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { case GDScriptTokenizer::TK_CF_WHILE: { tokenizer->advance(); - Node *condition = _parse_and_reduce_expression(p_block, p_static); - if (!condition) { + Node *condition2 = _parse_and_reduce_expression(p_block, p_static); + if (!condition2) { if (_recover_from_completion()) { break; } @@ -3003,7 +3003,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { ControlFlowNode *cf_while = alloc_node<ControlFlowNode>(); cf_while->cf_type = ControlFlowNode::CF_WHILE; - cf_while->arguments.push_back(condition); + cf_while->arguments.push_back(condition2); cf_while->body = alloc_node<BlockNode>(); cf_while->body->parent_block = p_block; @@ -4705,12 +4705,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { op->arguments.push_back(subexpr); #ifdef DEBUG_ENABLED - NewLineNode *nl = alloc_node<NewLineNode>(); - nl->line = line; + NewLineNode *nl2 = alloc_node<NewLineNode>(); + nl2->line = line; if (onready) - p_class->ready->statements.push_back(nl); + p_class->ready->statements.push_back(nl2); else - p_class->initializer->statements.push_back(nl); + p_class->initializer->statements.push_back(nl2); #endif if (onready) p_class->ready->statements.push_back(op); @@ -4732,8 +4732,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { ConstantNode *cn = alloc_node<ConstantNode>(); - Variant::CallError ce; - cn->value = Variant::construct(member._export.type, NULL, 0, ce); + Variant::CallError ce2; + cn->value = Variant::construct(member._export.type, NULL, 0, ce2); OperatorNode *op = alloc_node<OperatorNode>(); op->op = OperatorNode::OP_INIT_ASSIGN; @@ -5523,10 +5523,10 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source, result.script_type = gds; found = true; } else { - Ref<Script> scr = constants[id]; - if (scr.is_valid()) { + Ref<Script> scr2 = constants[id]; + if (scr2.is_valid()) { result.kind = DataType::SCRIPT; - result.script_type = scr; + result.script_type = scr2; found = true; } } @@ -6646,7 +6646,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat bool match = false; List<MethodInfo> constructors; Variant::get_constructor_list(tn->vtype, &constructors); - PropertyInfo return_type; + PropertyInfo return_type2; for (List<MethodInfo>::Element *E = constructors.front(); E; E = E->next()) { MethodInfo &mi = E->get(); @@ -6685,13 +6685,13 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat if (types_match) { match = true; - return_type = mi.return_val; + return_type2 = mi.return_val; break; } } if (match) { - return _type_from_property(return_type, false); + return _type_from_property(return_type2, false); } else if (check_types) { String err = "No constructor of '"; err += Variant::get_type_name(tn->vtype); @@ -7603,7 +7603,7 @@ void GDScriptParser::_check_function_types(FunctionNode *p_function) { } parent_signature += " " + p_function->name + "("; if (arg_types.size()) { - int i = 0; + int j = 0; for (List<DataType>::Element *E = arg_types.front(); E; E = E->next()) { if (E != arg_types.front()) { parent_signature += ", "; @@ -7613,11 +7613,11 @@ void GDScriptParser::_check_function_types(FunctionNode *p_function) { arg = "Variant"; } parent_signature += arg; - if (i == arg_types.size() - default_arg_count) { + if (j == arg_types.size() - default_arg_count) { parent_signature += "=default"; } - i++; + j++; } } parent_signature += ")"; |