You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
false positive "Identifier not found" error or signals fixed
This commit is contained in:
@@ -255,6 +255,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try class constants.
|
// Try class constants.
|
||||||
|
{
|
||||||
GDScript *owner = codegen.script;
|
GDScript *owner = codegen.script;
|
||||||
while (owner) {
|
while (owner) {
|
||||||
GDScript *scr = owner;
|
GDScript *scr = owner;
|
||||||
@@ -280,8 +281,10 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||||||
|
|
||||||
owner = owner->_owner;
|
owner = owner->_owner;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try signals and methods (can be made callables);
|
// Try signals and methods (can be made callables).
|
||||||
|
{
|
||||||
if (codegen.class_node->members_indices.has(identifier)) {
|
if (codegen.class_node->members_indices.has(identifier)) {
|
||||||
const GDScriptParser::ClassNode::Member &member = codegen.class_node->members[codegen.class_node->members_indices[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) {
|
if (member.type == GDScriptParser::ClassNode::Member::FUNCTION || member.type == GDScriptParser::ClassNode::Member::SIGNAL) {
|
||||||
@@ -294,6 +297,26 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try in native base.
|
||||||
|
GDScript *scr = codegen.script;
|
||||||
|
GDScriptNativeClass *nc = nullptr;
|
||||||
|
while (scr) {
|
||||||
|
if (scr->native.is_valid()) {
|
||||||
|
nc = scr->native.ptr();
|
||||||
|
}
|
||||||
|
scr = scr->_base;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nc && (ClassDB::has_signal(nc->get_name(), identifier) || ClassDB::has_method(nc->get_name(), identifier))) {
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GDScriptLanguage::get_singleton()->get_global_map().has(identifier)) {
|
if (GDScriptLanguage::get_singleton()->get_global_map().has(identifier)) {
|
||||||
int idx = GDScriptLanguage::get_singleton()->get_global_map()[identifier];
|
int idx = GDScriptLanguage::get_singleton()->get_global_map()[identifier];
|
||||||
return GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::GLOBAL, idx); // TODO: Get type.
|
return GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::GLOBAL, idx); // TODO: Get type.
|
||||||
|
|||||||
Reference in New Issue
Block a user