From e1554f76c45a022e7c3e0e044928545e74a0905e Mon Sep 17 00:00:00 2001 From: Victor Yacovlev Date: Mon, 21 Jan 2013 16:09:29 +0400 Subject: [PATCH] Fixed generating error instructions on wrong algorithm end --- src/plugins/kumircodegenerator/generator.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/plugins/kumircodegenerator/generator.cpp b/src/plugins/kumircodegenerator/generator.cpp index 4cbe333b..cf9f686d 100644 --- a/src/plugins/kumircodegenerator/generator.cpp +++ b/src/plugins/kumircodegenerator/generator.cpp @@ -774,6 +774,25 @@ void Generator::addFunction(int id, int moduleId, Bytecode::ElemType type, const ret << line; } + + if (alg->impl.endLexems.size()>0) { + QString endError; + for (int i=0; iimpl.endLexems.size();i++) { + if (alg->impl.endLexems[i]->error.size()>0) { + endError = ErrorMessages::message("KumirAnalizer", QLocale::Russian, alg->impl.endLexems[i]->error); + break; + } + } + if (endError.length()>0) { + Bytecode::Instruction err; + err.type = Bytecode::ERRORR; + err.scope = Bytecode::CONSTT; + err.arg = constantValue(Bytecode::VT_string, 0, endError); + ret << err; + } + } + + const AST::Variable * retval = returnValue(alg); if (retval) { Bytecode::Instruction loadRetval; -- GitLab