remove public is_in_loop api
parent
7158a6979b
commit
1624938c0b
|
@ -404,8 +404,6 @@ struct LIBCUBESCRIPT_EXPORT state {
|
||||||
loop_state run_loop(bcode_ref const &code, any_value &ret);
|
loop_state run_loop(bcode_ref const &code, any_value &ret);
|
||||||
loop_state run_loop(bcode_ref const &code);
|
loop_state run_loop(bcode_ref const &code);
|
||||||
|
|
||||||
bool is_in_loop() const;
|
|
||||||
|
|
||||||
bool get_override_mode() const;
|
bool get_override_mode() const;
|
||||||
bool set_override_mode(bool v);
|
bool set_override_mode(bool v);
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ state::state(alloc_func func, void *data) {
|
||||||
static_cast<command_impl *>(p)->p_type = ID_LOCAL;
|
static_cast<command_impl *>(p)->p_type = ID_LOCAL;
|
||||||
|
|
||||||
p = new_command("break", "", [](auto &cs, auto, auto &) {
|
p = new_command("break", "", [](auto &cs, auto, auto &) {
|
||||||
if (cs.is_in_loop()) {
|
if (cs.thread_pointer()->loop_level) {
|
||||||
throw break_exception{};
|
throw break_exception{};
|
||||||
} else {
|
} else {
|
||||||
throw error{cs, "no loop to break"};
|
throw error{cs, "no loop to break"};
|
||||||
|
@ -252,7 +252,7 @@ state::state(alloc_func func, void *data) {
|
||||||
static_cast<command_impl *>(p)->p_type = ID_BREAK;
|
static_cast<command_impl *>(p)->p_type = ID_BREAK;
|
||||||
|
|
||||||
p = new_command("continue", "", [](auto &cs, auto, auto &) {
|
p = new_command("continue", "", [](auto &cs, auto, auto &) {
|
||||||
if (cs.is_in_loop()) {
|
if (cs.thread_pointer()->loop_level) {
|
||||||
throw continue_exception{};
|
throw continue_exception{};
|
||||||
} else {
|
} else {
|
||||||
throw error{cs, "no loop to continue"};
|
throw error{cs, "no loop to continue"};
|
||||||
|
@ -828,10 +828,6 @@ LIBCUBESCRIPT_EXPORT loop_state state::run_loop(bcode_ref const &code) {
|
||||||
return run_loop(code, ret);
|
return run_loop(code, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBCUBESCRIPT_EXPORT bool state::is_in_loop() const {
|
|
||||||
return !!p_tstate->loop_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
LIBCUBESCRIPT_EXPORT bool state::get_override_mode() const {
|
LIBCUBESCRIPT_EXPORT bool state::get_override_mode() const {
|
||||||
return (p_tstate->ident_flags & IDENT_FLAG_OVERRIDDEN);
|
return (p_tstate->ident_flags & IDENT_FLAG_OVERRIDDEN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,14 +638,14 @@ std::uint32_t *vm_exec(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case BC_INST_BREAK | BC_INST_FLAG_FALSE:
|
case BC_INST_BREAK | BC_INST_FLAG_FALSE:
|
||||||
if (cs.is_in_loop()) {
|
if (ts.loop_level) {
|
||||||
throw break_exception();
|
throw break_exception();
|
||||||
} else {
|
} else {
|
||||||
throw error{cs, "no loop to break"};
|
throw error{cs, "no loop to break"};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BC_INST_BREAK | BC_INST_FLAG_TRUE:
|
case BC_INST_BREAK | BC_INST_FLAG_TRUE:
|
||||||
if (cs.is_in_loop()) {
|
if (ts.loop_level) {
|
||||||
throw continue_exception();
|
throw continue_exception();
|
||||||
} else {
|
} else {
|
||||||
throw error{cs, "no loop to continue"};
|
throw error{cs, "no loop to continue"};
|
||||||
|
|
Loading…
Reference in New Issue