From 810fcc74318a4fcb12997d20d3738cd5e349430c Mon Sep 17 00:00:00 2001 From: baptr <1522777+baptr@users.noreply.github.com> Date: Sun, 26 Feb 2023 19:42:55 -0800 Subject: Fix gdscript analyzer error when instantiating EditorPlugins. Editor code is not instantiable outside of the editor (https://github.com/godotengine/godot/blob/1d14c054a12dacdc193b589e4afb0ef319ee2aae/core/object/class_db.cpp#L369). This is fine for editor plugins and the like, but the GDScript analyzer balks at it, causing F5 runs to fail: #73525. Instead, we really just want to know if the type is abstract - so add a new ClassDB method to check that and nothing else. Update core/object/class_db.cpp Apply code review comments Co-Authored-By: Bryce <1522777+baptr@users.noreply.github.com> --- modules/gdscript/gdscript_analyzer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gdscript/gdscript_analyzer.cpp') diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index a6b4bce000..67b40a6198 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -5180,7 +5180,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bo if (!class_exists(base_native)) { push_error(vformat("Native class %s used in script doesn't exist or isn't exposed.", base_native), p_source); return false; - } else if (p_is_constructor && !ClassDB::can_instantiate(base_native)) { + } else if (p_is_constructor && ClassDB::is_abstract(base_native)) { if (p_base_type.kind == GDScriptParser::DataType::CLASS) { push_error(vformat(R"(Class "%s" cannot be constructed as it is based on abstract native class "%s".)", p_base_type.class_type->fqcn.get_file(), base_native), p_source); } else if (p_base_type.kind == GDScriptParser::DataType::SCRIPT) { -- cgit v1.2.3