summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_vm.cpp
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-10-14 19:58:10 -0300
committerGeorge Marques <george@gmarqu.es>2021-10-14 19:58:10 -0300
commit056a54db7be5b63685f221e34c17cc4b72964080 (patch)
tree5b787da4abbf649e650085dc674947818324fd7b /modules/gdscript/gdscript_vm.cpp
parentd36213bab8d71575b39c4d5d96622f3e91dc09ee (diff)
downloadredot-engine-056a54db7be5b63685f221e34c17cc4b72964080.tar.gz
GDScript: Properly return value with await on non-coroutine
If the keyword `await` is used without a coroutine, it should still return the value synchronally.
Diffstat (limited to 'modules/gdscript/gdscript_vm.cpp')
-rw-r--r--modules/gdscript/gdscript_vm.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index 1bc7ae086f..7018c339d7 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -2098,8 +2098,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
}
if (result.get_type() != Variant::SIGNAL) {
+ // Not async, return immediately using the target from OPCODE_AWAIT_RESUME.
+ GET_VARIANT_PTR(target, 3);
+ *target = result;
ip += 4; // Skip OPCODE_AWAIT_RESUME and its data.
- // The stack pointer should be the same, so we don't need to set a return value.
is_signal = false;
} else {
sig = result;