Mercurial > hg-old > index.cgi
changeset 62:da1337724ecd
Moved insn_gen8 to simplified expression evaluator
author | lost |
---|---|
date | Mon, 05 Jan 2009 00:57:37 +0000 |
parents | 73423b66e511 |
children | d85ba47b1e8f |
files | src/insn_gen.c |
diffstat | 1 files changed, 1 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/insn_gen.c Mon Jan 05 00:57:14 2009 +0000 +++ b/src/insn_gen.c Mon Jan 05 00:57:37 2009 +0000 @@ -131,28 +131,14 @@ OPFUNC(insn_gen8) { - lwasm_expr_stack_t *s; int rval; if (**p == '#') { lwasm_emitop(as, l, instab[opnum].ops[3]); (*p)++; - s = lwasm_evaluate_expr(as, l, *p, NULL); - if (!s) - { - register_error(as, l, 1, "Bad expression"); + if (lwasm_expr_result(as, l, p, EXPR_PASS2CONST | EXPR_BYTE, &rval) < 0) rval = 0; - } - else - { - if (!lwasm_expr_is_constant(s)) - register_error(as, l, 2, "Incomplete reference"); - rval = lwasm_expr_get_value(s); - lwasm_expr_stack_free(s); - } - if (rval < -128 || rval > 255) - register_error(as, l, 2, "Byte overflow"); lwasm_emit(as, l, rval & 0xff); return; }