From 40b53bc29a10bb0f53266b0631dcfa9f0fb6de3f Mon Sep 17 00:00:00 2001 From: Thakee Nathees Date: Sun, 1 Mar 2020 20:39:17 +0530 Subject: [PATCH] duplicate arguments in a function handled (cherry picked from commit 5424b626f96c0fb9e00610036236e3e6c67eda55) --- modules/gdscript/gdscript_parser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index d125da5b79f..44d0cb01059 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3809,6 +3809,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { } StringName argname = tokenizer->get_token_identifier(); + for (int i = 0; i < arguments.size(); i++) { + if (arguments[i] == argname) { + _set_error("The argument name \"" + String(argname) + "\" is defined multiple times."); + return; + } + } arguments.push_back(argname); #ifdef DEBUG_ENABLED arguments_usage.push_back(0);