From bd0356207631602f35e2111bc73bca2bd53e91a1 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 6 Jan 2015 00:39:35 -0300 Subject: [PATCH] -Resolved bug that made yield() not work in some situations, fixes #884 --- bin/tests/test_gdscript.cpp | 20 ++++++++++++++++++++ modules/gdscript/gd_compiler.cpp | 2 +- modules/gdscript/gd_script.cpp | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bin/tests/test_gdscript.cpp b/bin/tests/test_gdscript.cpp index b62deee2cd7..4b4030954a0 100644 --- a/bin/tests/test_gdscript.cpp +++ b/bin/tests/test_gdscript.cpp @@ -738,6 +738,26 @@ static void _disassemble_class(const Ref& p_class,const Vector incr=4+argc; } break; + case GDFunction::OPCODE_YIELD: { + + txt+=" yield "; + incr=1; + + } break; + case GDFunction::OPCODE_YIELD_SIGNAL: { + + txt+=" yield_signal "; + txt+=DADDR(1); + txt+=","; + txt+=DADDR(2); + incr=3; + } break; + case GDFunction::OPCODE_YIELD_RESUME: { + + txt+=" yield resume: "; + txt+=DADDR(1); + incr=2; + } break; case GDFunction::OPCODE_JUMP: { txt+=" jump "; diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 6289e6961c8..278651d6427 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -528,7 +528,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre int ret = _parse_expression(codegen,on->arguments[i],slevel); if (ret<0) return ret; - if (ret&GDFunction::ADDR_TYPE_STACK<state.stack.resize(alloca_size); //copy variant stack for(int i=0;i<_stack_size;i++) { - memnew_placement(&stack[sizeof(Variant)*i],Variant(stack[i])); + memnew_placement(&gdfs->state.stack[sizeof(Variant)*i],Variant(stack[i])); } gdfs->state.stack_size=_stack_size; gdfs->state.self=self;