diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-14 15:46:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-14 15:46:53 +0100 |
commit | 6edb0a75ab561ac703377aa4bc66ef84279df56c (patch) | |
tree | e712c3d22b0d847c600f5bc0d032c7073d494613 /modules/gdscript | |
parent | 2e2d533b481aa4126030ae2b1e2a5aa7dd3c3a00 (diff) | |
parent | 762bb5843b72d5921a02484bdb850c28fe6e48a9 (diff) |
Merge pull request #46936 from DavidSichma/match_temp_header
Fixed match test expression for temporaries
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_compiler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 76b7522f41..63ca34fc24 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1511,17 +1511,17 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui codegen.start_block(); // Evaluate the match expression. - GDScriptCodeGenerator::Address value_local = codegen.add_local("@match_value", _gdtype_from_datatype(match->test->get_datatype())); - GDScriptCodeGenerator::Address value = _parse_expression(codegen, error, match->test); + GDScriptCodeGenerator::Address value = codegen.add_local("@match_value", _gdtype_from_datatype(match->test->get_datatype())); + GDScriptCodeGenerator::Address value_expr = _parse_expression(codegen, error, match->test); if (error) { return error; } // Assign to local. // 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(); } |