slightly more code for goto handling

This commit is contained in:
hyunghwan.chung 2019-07-28 15:37:01 +00:00
parent 299faf4a87
commit 5ef1c3b989
2 changed files with 4 additions and 6 deletions

View File

@ -6683,14 +6683,12 @@ static int compile_goto_statement (moo_t* moo)
moo_copy_oochars (nptr, target->ptr, target->len);
nptr[target->len] = '\0';
#if 0
if (add_to_oow_pool(moo, &cc->mth._goto->target_ip_pool, cc->mth.code.len) <= -1 ||
emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, srcloc) <= -1)
_goto->ip = cc->mth.code.len;
if (emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1)
{
moo_freemem (moo, _goto);
return -1;
}
#endif
_goto->next = cc->mth._goto;
cc->mth._goto = _goto;

View File

@ -403,18 +403,18 @@ struct moo_loop_t
typedef struct moo_label_t moo_label_t;
struct moo_label_t
{
moo_ooch_t* name;
moo_oow_t level;
moo_label_t* next;
/* ... label name at the back ... */
};
typedef struct moo_goto_t moo_goto_t;
struct moo_goto_t
{
moo_ooch_t* target_name;
moo_oow_t level;
moo_oow_t ip;
moo_goto_t* next;
/* ... target label name at the back ... */
};
typedef struct moo_oopbuf_t moo_oopbuf_t;