GDScript: Fix accessing static function as Callable in static context

(cherry picked from commit 10dcb21d8b)
This commit is contained in:
Danil Alexeev 2023-12-12 22:15:16 +03:00 committed by Yuri Sizov
parent beadc92e4f
commit c35e05e7b1
3 changed files with 15 additions and 3 deletions

View file

@ -322,9 +322,13 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
if (member.type == GDScriptParser::ClassNode::Member::FUNCTION || member.type == GDScriptParser::ClassNode::Member::SIGNAL) {
// Get like it was a property.
GDScriptCodeGenerator::Address temp = codegen.add_temporary(); // TODO: Get type here.
GDScriptCodeGenerator::Address self(GDScriptCodeGenerator::Address::SELF);
gen->write_get_named(temp, identifier, self);
GDScriptCodeGenerator::Address base(GDScriptCodeGenerator::Address::SELF);
if (member.type == GDScriptParser::ClassNode::Member::FUNCTION && member.function->is_static) {
base = GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::CLASS);
}
gen->write_get_named(temp, identifier, base);
return temp;
}
}