Merge pull request #43856 from vnen/gdscript-some-fixes

A couple of GDScript fixes
This commit is contained in:
Rémi Verschelde 2020-11-25 17:13:41 +01:00 committed by GitHub
commit fc28de64c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -978,7 +978,7 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
if (!call->arguments[i]->is_constant) { if (!call->arguments[i]->is_constant) {
all_is_constant = false; all_is_constant = false;
} else { } else if (all_is_constant) {
args.write[i] = call->arguments[i]->reduced_value; args.write[i] = call->arguments[i]->reduced_value;
} }
@ -1011,11 +1011,15 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
} }
} }
GDScriptParser::DataType list_type; if (p_for->list->is_constant) {
list_type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; p_for->list->set_datatype(type_from_variant(p_for->list->reduced_value, p_for->list));
list_type.kind = GDScriptParser::DataType::BUILTIN; } else {
list_type.builtin_type = Variant::ARRAY; GDScriptParser::DataType list_type;
p_for->list->set_datatype(list_type); list_type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
list_type.kind = GDScriptParser::DataType::BUILTIN;
list_type.builtin_type = Variant::ARRAY;
p_for->list->set_datatype(list_type);
}
} }
} }
} }

View file

@ -437,7 +437,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
gen->pop_temporary(); gen->pop_temporary();
} }
return source; return result;
} break; } break;
case GDScriptParser::Node::CALL: { case GDScriptParser::Node::CALL: {
const GDScriptParser::CallNode *call = static_cast<const GDScriptParser::CallNode *>(p_expression); const GDScriptParser::CallNode *call = static_cast<const GDScriptParser::CallNode *>(p_expression);