diff options
author | Damien George <damien.p.george@gmail.com> | 2017-07-04 02:14:25 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-07-04 02:14:25 +1000 |
commit | 9ed5e80eea71c8392b7c178d2e2b69e2428850d8 (patch) | |
tree | 2578c2311e01e0c28d4297ece98cd07b830e14c9 /py | |
parent | 9d2c72ad4f62194b3c83ac9fae9f65329a34cdaf (diff) | |
download | micropython-9ed5e80eea71c8392b7c178d2e2b69e2428850d8.tar.gz micropython-9ed5e80eea71c8392b7c178d2e2b69e2428850d8.zip |
py/vm: Make "if" control flow more obvious in YIELD_FROM opcode.
Diffstat (limited to 'py')
-rw-r--r-- | py/vm.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1159,8 +1159,7 @@ yield: ip--; PUSH(ret_value); goto yield; - } - if (ret_kind == MP_VM_RETURN_NORMAL) { + } else if (ret_kind == MP_VM_RETURN_NORMAL) { // Pop exhausted gen sp--; // TODO: When ret_value can be MP_OBJ_NULL here?? @@ -1176,8 +1175,8 @@ yield: // if it was swallowed, we re-raise GeneratorExit GENERATOR_EXIT_IF_NEEDED(t_exc); DISPATCH(); - } - if (ret_kind == MP_VM_RETURN_EXCEPTION) { + } else { + assert(ret_kind == MP_VM_RETURN_EXCEPTION); // Pop exhausted gen sp--; if (EXC_MATCH(ret_value, MP_OBJ_FROM_PTR(&mp_type_StopIteration))) { |