Merge pull request #56830 from strank/parent-signals
This commit is contained in:
commit
79bbe57244
1 changed files with 13 additions and 8 deletions
|
@ -294,16 +294,21 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||
|
||||
// Try signals and methods (can be made callables).
|
||||
{
|
||||
if (codegen.class_node->members_indices.has(identifier)) {
|
||||
const GDScriptParser::ClassNode::Member &member = codegen.class_node->members[codegen.class_node->members_indices[identifier]];
|
||||
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);
|
||||
// Search upwards through parent classes:
|
||||
const GDScriptParser::ClassNode *base_class = codegen.class_node;
|
||||
while (base_class != nullptr) {
|
||||
if (base_class->has_member(identifier)) {
|
||||
const GDScriptParser::ClassNode::Member &member = base_class->get_member(identifier);
|
||||
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);
|
||||
return temp;
|
||||
gen->write_get_named(temp, identifier, self);
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
base_class = base_class->base_type.class_type;
|
||||
}
|
||||
|
||||
// Try in native base.
|
||||
|
|
Loading…
Reference in a new issue