You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Prevent unused_argument warning when passing arg to parent constructor
This requires creating the FunctionNode object a bit sooner, and setting it as the current_function while parsing the parent constructor call arguments. Note that the return type has not yet been parsed at this point, but that doesn't seem to be a problem. Fixes #22139
This commit is contained in:
@@ -3752,6 +3752,19 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||||||
BlockNode *block = alloc_node<BlockNode>();
|
BlockNode *block = alloc_node<BlockNode>();
|
||||||
block->parent_class = p_class;
|
block->parent_class = p_class;
|
||||||
|
|
||||||
|
FunctionNode *function = alloc_node<FunctionNode>();
|
||||||
|
function->name = name;
|
||||||
|
function->arguments = arguments;
|
||||||
|
function->argument_types = argument_types;
|
||||||
|
function->default_values = default_values;
|
||||||
|
function->_static = _static;
|
||||||
|
function->line = fnline;
|
||||||
|
#ifdef DEBUG_ENABLED
|
||||||
|
function->arguments_usage = arguments_usage;
|
||||||
|
#endif // DEBUG_ENABLED
|
||||||
|
function->rpc_mode = rpc_mode;
|
||||||
|
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||||
|
|
||||||
if (name == "_init") {
|
if (name == "_init") {
|
||||||
|
|
||||||
if (_static) {
|
if (_static) {
|
||||||
@@ -3782,7 +3795,9 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||||||
parenthesis++;
|
parenthesis++;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
|
current_function = function;
|
||||||
Node *arg = _parse_and_reduce_expression(p_class, _static);
|
Node *arg = _parse_and_reduce_expression(p_class, _static);
|
||||||
|
current_function = NULL;
|
||||||
cparent->arguments.push_back(arg);
|
cparent->arguments.push_back(arg);
|
||||||
|
|
||||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
|
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
|
||||||
@@ -3826,19 +3841,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionNode *function = alloc_node<FunctionNode>();
|
|
||||||
function->name = name;
|
|
||||||
function->return_type = return_type;
|
function->return_type = return_type;
|
||||||
function->arguments = arguments;
|
|
||||||
function->argument_types = argument_types;
|
|
||||||
function->default_values = default_values;
|
|
||||||
function->_static = _static;
|
|
||||||
function->line = fnline;
|
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
function->arguments_usage = arguments_usage;
|
|
||||||
#endif // DEBUG_ENABLED
|
|
||||||
function->rpc_mode = rpc_mode;
|
|
||||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
|
||||||
|
|
||||||
if (_static)
|
if (_static)
|
||||||
p_class->static_functions.push_back(function);
|
p_class->static_functions.push_back(function);
|
||||||
|
|||||||
Reference in New Issue
Block a user