mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Unify GDScriptAnalyzer in-editor and runtime autoload checks
This commit is contained in:
parent
2a04b18d37
commit
fb418685a0
3 changed files with 17 additions and 13 deletions
|
@ -3403,8 +3403,8 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
|
|||
}
|
||||
}
|
||||
} else if (ResourceLoader::get_resource_type(autoload.path) == "PackedScene") {
|
||||
if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_named_globals_map()[name];
|
||||
if (GDScriptLanguage::get_singleton()->has_any_global_constant(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_any_global_constant(name);
|
||||
Node *node = Object::cast_to<Node>(constant);
|
||||
if (node != nullptr) {
|
||||
Ref<GDScript> scr = node->get_script();
|
||||
|
@ -3426,17 +3426,8 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
|
|||
}
|
||||
}
|
||||
|
||||
if (GDScriptLanguage::get_singleton()->get_global_map().has(name)) {
|
||||
int idx = GDScriptLanguage::get_singleton()->get_global_map()[name];
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_global_array()[idx];
|
||||
p_identifier->set_datatype(type_from_variant(constant, p_identifier));
|
||||
p_identifier->is_constant = true;
|
||||
p_identifier->reduced_value = constant;
|
||||
return;
|
||||
}
|
||||
|
||||
if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_named_globals_map()[name];
|
||||
if (GDScriptLanguage::get_singleton()->has_any_global_constant(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_any_global_constant(name);
|
||||
p_identifier->set_datatype(type_from_variant(constant, p_identifier));
|
||||
p_identifier->is_constant = true;
|
||||
p_identifier->reduced_value = constant;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue