mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 22:21:18 +00:00
GDScript: Give an error if dependency can't be parsed
Otherwise this may lead to a crash when the dependency is not present.
This commit is contained in:
parent
613b76cfd5
commit
817fb3d702
2 changed files with 12 additions and 4 deletions
|
|
@ -2029,9 +2029,17 @@ void GDScriptAnalyzer::reduce_get_node(GDScriptParser::GetNodeNode *p_get_node)
|
|||
p_get_node->set_datatype(result);
|
||||
}
|
||||
|
||||
GDScriptParser::DataType GDScriptAnalyzer::make_global_class_meta_type(const StringName &p_class_name) {
|
||||
GDScriptParser::DataType GDScriptAnalyzer::make_global_class_meta_type(const StringName &p_class_name, const GDScriptParser::Node *p_source) {
|
||||
Ref<GDScriptParserRef> ref = get_parser_for(ScriptServer::get_global_class_path(p_class_name));
|
||||
ref->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
|
||||
Error err = ref->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
|
||||
|
||||
if (err) {
|
||||
push_error(vformat(R"(Could not resolve class "%s", because of a parser error.)", p_class_name), p_source);
|
||||
GDScriptParser::DataType type;
|
||||
type.type_source = GDScriptParser::DataType::UNDETECTED;
|
||||
type.kind = GDScriptParser::DataType::VARIANT;
|
||||
return type;
|
||||
}
|
||||
|
||||
GDScriptParser::DataType type;
|
||||
type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
|
||||
|
|
@ -2303,7 +2311,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
|
|||
}
|
||||
|
||||
if (ScriptServer::is_global_class(name)) {
|
||||
p_identifier->set_datatype(make_global_class_meta_type(name));
|
||||
p_identifier->set_datatype(make_global_class_meta_type(name, p_identifier));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue