Bläddra i källkod

Sol Part 51: Break Unbroken!

master
Graham Northup 5 år sedan
förälder
incheckning
7884cda9c4
Signerad av: grissess GPG-nyckel ID: 5D000E6F539376FB
  1. 8
      programs/test.sol
  2. 1
      runtime.c

8
programs/test.sol

@ -408,4 +408,12 @@ for i in l do
print(i)
end
print('--- Control expressions')
print('1 is', if 1 then 'true' else 'false' end)
print('0 is', if 0 then 'true' else 'false' end)
print(for i in l do continue 1000 + 2 * i end)
print(for i in l do print('(', i, ')') if i >= 5 then break i end end)
print('--- All done!')

1
runtime.c

@ -838,6 +838,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
sol_obj_free(item);
if(state->ret || state->sflag == SF_BREAKING || sol_has_error(state)) {
item = sol_incref(state->StopIteration);
continue;
}
state->sflag = SF_NORMAL;
item = CALL_METHOD(state, iter, call, list);

Laddar…
Avbryt
Spara