You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
GDScript: Add support for variadic functions
This commit is contained in:
@@ -508,9 +508,22 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
|
||||
parameters += " = " + parameter->initializer->reduced_value.to_json_string();
|
||||
}
|
||||
}
|
||||
if (p_func->is_vararg()) {
|
||||
if (!p_func->parameters.is_empty()) {
|
||||
parameters += ", ";
|
||||
}
|
||||
const ParameterNode *rest_param = p_func->rest_parameter;
|
||||
parameters += "..." + rest_param->identifier->name + ": " + rest_param->get_datatype().to_string();
|
||||
}
|
||||
r_symbol.detail += parameters + ")";
|
||||
if (p_func->get_datatype().is_hard_type()) {
|
||||
r_symbol.detail += " -> " + p_func->get_datatype().to_string();
|
||||
|
||||
const DataType return_type = p_func->get_datatype();
|
||||
if (return_type.is_hard_type()) {
|
||||
if (return_type.kind == DataType::BUILTIN && return_type.builtin_type == Variant::NIL) {
|
||||
r_symbol.detail += " -> void";
|
||||
} else {
|
||||
r_symbol.detail += " -> " + return_type.to_string();
|
||||
}
|
||||
}
|
||||
|
||||
List<GDScriptParser::SuiteNode *> function_nodes;
|
||||
|
||||
Reference in New Issue
Block a user