mirror of
https://github.com/godotengine/godot.git
synced 2025-11-02 06:31:13 +00:00
Merge pull request #46936 from DavidSichma/match_temp_header
Fixed match test expression for temporaries
This commit is contained in:
commit
6edb0a75ab
1 changed files with 4 additions and 4 deletions
|
|
@ -1511,17 +1511,17 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
|
||||||
codegen.start_block();
|
codegen.start_block();
|
||||||
|
|
||||||
// Evaluate the match expression.
|
// Evaluate the match expression.
|
||||||
GDScriptCodeGenerator::Address value_local = codegen.add_local("@match_value", _gdtype_from_datatype(match->test->get_datatype()));
|
GDScriptCodeGenerator::Address value = codegen.add_local("@match_value", _gdtype_from_datatype(match->test->get_datatype()));
|
||||||
GDScriptCodeGenerator::Address value = _parse_expression(codegen, error, match->test);
|
GDScriptCodeGenerator::Address value_expr = _parse_expression(codegen, error, match->test);
|
||||||
if (error) {
|
if (error) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign to local.
|
// Assign to local.
|
||||||
// TODO: This can be improved by passing the target to parse_expression().
|
// TODO: This can be improved by passing the target to parse_expression().
|
||||||
gen->write_assign(value_local, value);
|
gen->write_assign(value, value_expr);
|
||||||
|
|
||||||
if (value.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
|
if (value_expr.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
|
||||||
codegen.generator->pop_temporary();
|
codegen.generator->pop_temporary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue