Add -Wshadow=local to warnings and fix reported issues.

Fixes #25316.
This commit is contained in:
marxin
2019-02-12 21:10:08 +01:00
committed by Rémi Verschelde
parent d695667ac4
commit bb4bf909f5
3 changed files with 36 additions and 36 deletions

View File

@@ -1165,9 +1165,9 @@ void VisualScript::_set_data(const Dictionary &p_data) {
Array nodes = func["nodes"]; Array nodes = func["nodes"];
for (int i = 0; i < nodes.size(); i += 3) { for (int j = 0; j < nodes.size(); j += 3) {
add_node(name, nodes[i], nodes[i + 2], nodes[i + 1]); add_node(name, nodes[j], nodes[j + 2], nodes[j + 1]);
} }
Array sequence_connections = func["sequence_connections"]; Array sequence_connections = func["sequence_connections"];

View File

@@ -679,10 +679,10 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
} }
str_ofs = cofs; //revert str_ofs = cofs; //revert
//parse an expression //parse an expression
ENode *expr = _parse_expression(); ENode *expr2 = _parse_expression();
if (!expr) if (!expr2)
return NULL; return NULL;
dn->dict.push_back(expr); dn->dict.push_back(expr2);
_get_token(tk); _get_token(tk);
if (tk.type != TK_COLON) { if (tk.type != TK_COLON) {
@@ -690,11 +690,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
return NULL; return NULL;
} }
expr = _parse_expression(); expr2 = _parse_expression();
if (!expr) if (!expr2)
return NULL; return NULL;
dn->dict.push_back(expr); dn->dict.push_back(expr2);
cofs = str_ofs; cofs = str_ofs;
_get_token(tk); _get_token(tk);
@@ -723,10 +723,10 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
} }
str_ofs = cofs; //revert str_ofs = cofs; //revert
//parse an expression //parse an expression
ENode *expr = _parse_expression(); ENode *expr2 = _parse_expression();
if (!expr) if (!expr2)
return NULL; return NULL;
an->array.push_back(expr); an->array.push_back(expr2);
cofs = str_ofs; cofs = str_ofs;
_get_token(tk); _get_token(tk);
@@ -807,11 +807,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
} }
str_ofs = cofs; //revert str_ofs = cofs; //revert
//parse an expression //parse an expression
ENode *expr = _parse_expression(); ENode *expr2 = _parse_expression();
if (!expr) if (!expr2)
return NULL; return NULL;
constructor->arguments.push_back(expr); constructor->arguments.push_back(expr2);
cofs = str_ofs; cofs = str_ofs;
_get_token(tk); _get_token(tk);
@@ -848,11 +848,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
} }
str_ofs = cofs; //revert str_ofs = cofs; //revert
//parse an expression //parse an expression
ENode *expr = _parse_expression(); ENode *expr2 = _parse_expression();
if (!expr) if (!expr2)
return NULL; return NULL;
bifunc->arguments.push_back(expr); bifunc->arguments.push_back(expr2);
cofs = str_ofs; cofs = str_ofs;
_get_token(tk); _get_token(tk);
@@ -947,25 +947,25 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
while (true) { while (true) {
int cofs = str_ofs; int cofs3 = str_ofs;
_get_token(tk); _get_token(tk);
if (tk.type == TK_PARENTHESIS_CLOSE) { if (tk.type == TK_PARENTHESIS_CLOSE) {
break; break;
} }
str_ofs = cofs; //revert str_ofs = cofs3; //revert
//parse an expression //parse an expression
ENode *expr = _parse_expression(); ENode *expr2 = _parse_expression();
if (!expr) if (!expr2)
return NULL; return NULL;
func_call->arguments.push_back(expr); func_call->arguments.push_back(expr2);
cofs = str_ofs; cofs3 = str_ofs;
_get_token(tk); _get_token(tk);
if (tk.type == TK_COMMA) { if (tk.type == TK_COMMA) {
//all good //all good
} else if (tk.type == TK_PARENTHESIS_CLOSE) { } else if (tk.type == TK_PARENTHESIS_CLOSE) {
str_ofs = cofs; str_ofs = cofs3;
} else { } else {
_set_error("Expected ',' or ')'"); _set_error("Expected ',' or ')'");
} }
@@ -1426,8 +1426,8 @@ public:
for (int i = 0; i < call->arguments.size(); i++) { for (int i = 0; i < call->arguments.size(); i++) {
Variant value; Variant value;
bool ret = _execute(p_inputs, call->arguments[i], value, r_error_str, ce); bool ret2 = _execute(p_inputs, call->arguments[i], value, r_error_str, ce);
if (ret) if (ret2)
return true; return true;
arr.write[i] = value; arr.write[i] = value;
argp.write[i] = &arr[i]; argp.write[i] = &arr[i];

View File

@@ -514,26 +514,26 @@ void VisualScriptPropertySelector::_item_selected() {
if (names->find(name) != NULL) { if (names->find(name) != NULL) {
Ref<VisualScriptOperator> operator_node = VisualScriptLanguage::singleton->create_node_from_name(name); Ref<VisualScriptOperator> operator_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (operator_node.is_valid()) { if (operator_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(operator_node->get_class_name()); Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(operator_node->get_class_name());
if (E) { if (F) {
text = Variant::get_operator_name(operator_node->get_operator()); text = Variant::get_operator_name(operator_node->get_operator());
} }
} }
Ref<VisualScriptTypeCast> typecast_node = VisualScriptLanguage::singleton->create_node_from_name(name); Ref<VisualScriptTypeCast> typecast_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (typecast_node.is_valid()) { if (typecast_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(typecast_node->get_class_name()); Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(typecast_node->get_class_name());
if (E) { if (F) {
text = E->get().description; text = F->get().description;
} }
} }
Ref<VisualScriptBuiltinFunc> builtin_node = VisualScriptLanguage::singleton->create_node_from_name(name); Ref<VisualScriptBuiltinFunc> builtin_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (builtin_node.is_valid()) { if (builtin_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(builtin_node->get_class_name()); Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(builtin_node->get_class_name());
if (E) { if (F) {
for (int i = 0; i < E->get().constants.size(); i++) { for (int i = 0; i < F->get().constants.size(); i++) {
if (E->get().constants[i].value.to_int() == int(builtin_node->get_func())) { if (F->get().constants[i].value.to_int() == int(builtin_node->get_func())) {
text = E->get().constants[i].description; text = F->get().constants[i].description;
} }
} }
} }