summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_compiler.cpp
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2020-12-04 16:42:45 -0700
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2020-12-17 09:01:39 -0700
commit2e4ee06b7a6eef8d7775aeed8f72e4ab556479fc (patch)
treec0b350430f44ad0f7eecdd531191b2040546965e /modules/gdscript/gdscript_compiler.cpp
parent68117f5e75944cfd6f8ad1534a15c334e7ed5e91 (diff)
downloadredot-engine-2e4ee06b7a6eef8d7775aeed8f72e4ab556479fc.tar.gz
Fix error when calling coroutine with await in _ready
The code paths for calling async functions seemed to be missing in some cases, causing a debug break and false positive error.
Diffstat (limited to 'modules/gdscript/gdscript_compiler.cpp')
-rw-r--r--modules/gdscript/gdscript_compiler.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index af6991041e..e230cf5905 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -494,9 +494,17 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
} else if ((codegen.function_node && codegen.function_node->is_static) || call->function_name == "new") {
GDScriptCodeGenerator::Address self;
self.mode = GDScriptCodeGenerator::Address::CLASS;
- gen->write_call(result, self, call->function_name, arguments);
+ if (within_await) {
+ gen->write_call_async(result, self, call->function_name, arguments);
+ } else {
+ gen->write_call(result, self, call->function_name, arguments);
+ }
} else {
- gen->write_call_self(result, call->function_name, arguments);
+ if (within_await) {
+ gen->write_call_self_async(result, call->function_name, arguments);
+ } else {
+ gen->write_call_self(result, call->function_name, arguments);
+ }
}
} else if (callee->type == GDScriptParser::Node::SUBSCRIPT) {
const GDScriptParser::SubscriptNode *subscript = static_cast<const GDScriptParser::SubscriptNode *>(call->callee);