diff --git a/src/codeobject.h b/src/codeobject.h index 0d7fa0ee..3fad18c1 100644 --- a/src/codeobject.h +++ b/src/codeobject.h @@ -253,9 +253,7 @@ public: if(code->co_blocks[i].type == FOR_LOOP) pop(); i = code->co_blocks[i].parent; } - if(i!=next.block) throw std::runtime_error( - "invalid jump from " + code->co_blocks[prev.block].to_string() + " to " + code->co_blocks[next.block].to_string() - ); + if(i!=next.block) throw std::runtime_error("invalid jump"); } } diff --git a/src/repl.h b/src/repl.h index 3a6d4510..e8603125 100644 --- a/src/repl.h +++ b/src/repl.h @@ -22,6 +22,7 @@ public: } InputResult input(std::string line){ + CompileMode mode = SINGLE_MODE; if(need_more_lines){ buffer += line; buffer += '\n'; @@ -33,6 +34,7 @@ public: need_more_lines = 0; line = buffer; buffer.clear(); + mode = EXEC_MODE; }else{ __NOT_ENOUGH_LINES: return NEED_MORE_LINES; @@ -42,7 +44,7 @@ __NOT_ENOUGH_LINES: } try{ - vm->compile(line, "", SINGLE_MODE); + vm->compile(line, "", mode); }catch(NeedMoreLines& ne){ buffer += line; buffer += '\n'; @@ -51,7 +53,7 @@ __NOT_ENOUGH_LINES: }catch(...){ // do nothing } - vm->exec(line, "", SINGLE_MODE); + vm->exec(line, "", mode); return EXEC_STARTED; } }; \ No newline at end of file