GDScript: Fix regression with native signal not found

This commit is contained in:
Danil Alexeev 2023-08-02 15:42:36 +03:00
parent dca12c2e54
commit f19377160c
No known key found for this signature in database
GPG Key ID: 124453E157DA8DC7
3 changed files with 52 additions and 31 deletions

View File

@ -245,6 +245,8 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
// MEMBERS.
case GDScriptParser::IdentifierNode::MEMBER_VARIABLE:
case GDScriptParser::IdentifierNode::MEMBER_FUNCTION:
case GDScriptParser::IdentifierNode::MEMBER_SIGNAL:
case GDScriptParser::IdentifierNode::INHERITED_VARIABLE: {
// Try class members.
if (_is_class_member_property(codegen, identifier)) {
@ -271,11 +273,9 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
}
}
}
} break;
case GDScriptParser::IdentifierNode::MEMBER_FUNCTION:
case GDScriptParser::IdentifierNode::MEMBER_SIGNAL: {
// Try methods and signals (can be Callable and Signal).
// Try methods and signals (can be Callable and Signal).
{
// Search upwards through parent classes:
const GDScriptParser::ClassNode *base_class = codegen.class_node;
while (base_class != nullptr) {
@ -311,6 +311,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
gen->write_get_named(temp, identifier, self);
return temp;
}
}
} break;
case GDScriptParser::IdentifierNode::MEMBER_CONSTANT:
case GDScriptParser::IdentifierNode::MEMBER_CLASS: {
@ -319,6 +320,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
while (owner) {
GDScript *scr = owner;
GDScriptNativeClass *nc = nullptr;
while (scr) {
if (scr->constants.has(identifier)) {
return codegen.add_constant(scr->constants[identifier]); // TODO: Get type here.

View File

@ -0,0 +1,14 @@
# GH-80157
extends Node
func f():
pass
signal s()
func test():
print(f)
print(s)
print(get_child)
print(ready)

View File

@ -0,0 +1,5 @@
GDTEST_OK
Node::f
Node::[signal]s
Node::get_child
Node::[signal]ready