summaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_compiler.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-01-03 21:11:11 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-01-03 21:11:11 -0300
commitcb39db0b02c2d69994e2cd523844a2a9d3087d85 (patch)
tree457f95e6faf0b37755c0363dc873c32777e62c94 /modules/gdscript/gd_compiler.cpp
parente0eff65fc0a807ecabc86194e0888e52cf682100 (diff)
Fixed bug with default arguments in gdscript, closes #2024
Diffstat (limited to 'modules/gdscript/gd_compiler.cpp')
-rw-r--r--modules/gdscript/gd_compiler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 6180c668ef..53519030fc 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1253,6 +1253,7 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
StringName func_name;
if (p_func) {
+
if (p_func->default_values.size()) {
codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_TO_DEF_ARGUMENT);
@@ -1346,7 +1347,7 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
if (defarg_addr.size()) {
gdfunc->default_arguments=defarg_addr;
- gdfunc->_default_arg_count=defarg_addr.size();
+ gdfunc->_default_arg_count=defarg_addr.size()-1;
gdfunc->_default_arg_ptr=&gdfunc->default_arguments[0];
} else {
gdfunc->_default_arg_count=0;