summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_compiler.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-01-11 13:54:04 +0100
committerGitHub <noreply@github.com>2021-01-11 13:54:04 +0100
commitc17413f15974b8c78948ddd57736660affe16798 (patch)
treee76a955e2a699520eef6b760d2e27ecb34057751 /modules/gdscript/gdscript_compiler.cpp
parent813bdb49419edc18810d382d4e2f8eadcf60bf48 (diff)
parent2e4ee06b7a6eef8d7775aeed8f72e4ab556479fc (diff)
downloadredot-engine-c17413f15974b8c78948ddd57736660affe16798.tar.gz
Merge pull request #44104 from nekomatata/coroutine-await-fix
Fix error when calling coroutine with await in _ready
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 e8be310375..b491440d4c 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);