Berry fix bug in conditional

This commit is contained in:
Stephan Hadinger 2021-08-26 18:52:08 +02:00
parent e2e90cc18a
commit 9be8f4fc7a
2 changed files with 4 additions and 3 deletions

View File

@ -111,7 +111,7 @@ void be_print_inst(binstruction ins, int pc)
logbuf("%s\tK%d", opc2str(op), IGET_Bx(ins)); logbuf("%s\tK%d", opc2str(op), IGET_Bx(ins));
break; break;
case OP_CLOSE: case OP_LDNIL: case OP_CLOSE: case OP_LDNIL:
logbuf("%s\t%d", opc2str(op), IGET_RA(ins)); logbuf("%s\tR%d", opc2str(op), IGET_RA(ins));
break; break;
case OP_RAISE: case OP_RAISE:
logbuf("%s\t%d\t%c%d\t%c%d", opc2str(op), IGET_RA(ins), logbuf("%s\t%d\t%c%d\t%c%d", opc2str(op), IGET_RA(ins),

View File

@ -106,7 +106,7 @@ static void check_symbol(bparser *parser, bexpdesc *e)
} }
} }
/* check that the value in `e` is valid for a variable, i.e. conatins a value or a valid symbol */ /* check that the value in `e` is valid for a variable, i.e. contains a value or a valid symbol */
static void check_var(bparser *parser, bexpdesc *e) static void check_var(bparser *parser, bexpdesc *e)
{ {
check_symbol(parser, e); /* check the token is a symbol */ check_symbol(parser, e); /* check the token is a symbol */
@ -989,6 +989,7 @@ static void cond_expr(bparser *parser, bexpdesc *e)
if (next_type(parser) == OptQuestion) { if (next_type(parser) == OptQuestion) {
int jf, jl = NO_JUMP; /* jump list */ int jf, jl = NO_JUMP; /* jump list */
bfuncinfo *finfo = parser->finfo; bfuncinfo *finfo = parser->finfo;
check_var(parser, e); /* check if valid */
scan_next_token(parser); /* skip '?' */ scan_next_token(parser); /* skip '?' */
be_code_jumpbool(finfo, e, bfalse); /* go if true */ be_code_jumpbool(finfo, e, bfalse); /* go if true */
jf = e->f; jf = e->f;