You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Remove script class checks when getting function signature
This commit is contained in:
committed by
Rémi Verschelde
parent
3f02cf7ced
commit
0fef203b1f
@@ -3017,7 +3017,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
|
||||
push_error(vformat(R"*(Cannot call non-static function "%s()" from static function "%s()".)*", p_call->function_name, parent_function->identifier->name), p_call);
|
||||
} else if (!is_self && base_type.is_meta_type && !is_static) {
|
||||
base_type.is_meta_type = false; // For `to_string()`.
|
||||
push_error(vformat(R"*(Cannot call non-static function "%s()" on the class "%s" directly. Make an instance instead.)*", p_call->function_name, base_type.to_string()), p_call);
|
||||
push_error(vformat(R"*(Cannot call non-static function "%s()" on a class directly. Make an instance instead.)*", p_call->function_name), p_call);
|
||||
} else if (is_self && !is_static) {
|
||||
mark_lambda_use_self();
|
||||
}
|
||||
@@ -4564,16 +4564,6 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bo
|
||||
base_script = base_script->get_base_script();
|
||||
}
|
||||
|
||||
// If the base is a script, it might be trying to access members of the Script class itself.
|
||||
if (p_base_type.is_meta_type && !p_is_constructor && (p_base_type.kind == GDScriptParser::DataType::SCRIPT || p_base_type.kind == GDScriptParser::DataType::CLASS)) {
|
||||
MethodInfo info;
|
||||
StringName script_class = p_base_type.kind == GDScriptParser::DataType::SCRIPT ? p_base_type.script_type->get_class_name() : StringName(GDScript::get_class_static());
|
||||
|
||||
if (ClassDB::get_method_info(script_class, function_name, &info)) {
|
||||
return function_signature_from_info(info, r_return_type, r_par_types, r_default_arg_count, r_static, r_vararg);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_is_constructor) {
|
||||
// Native types always have a default constructor.
|
||||
r_return_type = p_base_type;
|
||||
|
||||
Reference in New Issue
Block a user