-
Notifications
You must be signed in to change notification settings - Fork 20
berry
Link : https://github.com/berry-lang/berry/commit/01595d59e67d87483f758c5b92e9fb541d7524a3
Description: Fix flip
At src/be_vm.c
@@ -743,7 +743,7 @@ newframe: /* a new call frame */
opcase(FLIP): {
bvalue *dst = RA(), *a = RKB();
if (var_isint(a)) {
+ var_setint(dst, ~a->v.i);
- var_setint(dst, -a->v.i);
} else if (var_isinstance(a)) {
ins_unop(vm, "~", *RKB());
reg = vm->reg;
Tags
#Single-line
#Modified
Link : https://github.com/berry-lang/berry/commit/7ae229f137cd9620f48828fb84143690a40361e0
Description: Fix unary not compiler bug
At src/be_code.c
@@ -578,7 +578,6 @@ static void code_not(bfuncinfo *finfo, bexpdesc *e)
case ETBOOL: e->v.i = !e->v.i; break;
case ETSTRING: e->v.i = 0; break;
default: {
+ unaryexp(finfo, OP_MOVE, e);
int temp = e->t;
e->t = e->f;
e->f = temp;
Tags
#Single-line
#Omission
Link : https://github.com/berry-lang/berry/commit/ff032c9f7e21bd8aec9e8e205a6a2c4c4fbbe868
Description: Fix static initializer for subclass
At src/be_parser.c
@@ -1420,12 +1420,11 @@ static void classdef_stmt(bparser *parser, bclass *c)
static void class_inherit(bparser *parser, bexpdesc *e)
{
if (next_type(parser) == OptColon) { /* ':' */
+ bexpdesc ec = *e; /* work on a copy because we preserve original class */
bexpdesc e1;
scan_next_token(parser); /* skip ':' */
expr(parser, &e1);
check_var(parser, &e1);
+ be_code_setsuper(parser->finfo, &ec, &e1);
- be_code_setsuper(parser->finfo, e, &e1);
}
}
Tags
#Multi-line
#Modified
#Invalid-condition
Link : https://github.com/berry-lang/berry/commit/42cb2f4ce7b8cbf0934cf28653810f43b0855ee2
Description: Fix %% in format
At src/be_strlib.c
@@ -512,15 +512,11 @@ static int str_format(bvm *vm)
concat2(vm);
p = get_mode(p + 1, mode);
buf[0] = '\0';
+ if (index > top && *p != '%') {
- if (index > top) {
be_raise(vm, "runtime_error", be_pushfstring(vm,
"bad argument #%d to 'format': no value", index));
}
switch (*p) {
+ case '%':
+ be_pushstring(vm, "%");
+ --index; /* compensate the future ++index */
+ break;
case 'd': case 'i': case 'o':
case 'u': case 'x': case 'X':
if (be_isint(vm, index)) {
Tags
#Multi-line
#Modified
#Logical-error
Link : https://github.com/berry-lang/berry/commit/c9e226d315a61357289649ae8dbc5bf27f5aa17f
Description: Fix compiler bug for index
At src/be_code.c
@@ -317,7 +317,7 @@ static void free_suffix(bfuncinfo *finfo, bexpdesc *e)
be_code_freeregs(finfo, 1);
}
/* release object register */
+ if (e->v.ss.tt == ETREG && (int)e->v.ss.obj >= nlocal && (e->v.ss.obj + 1 >= finfo->freereg)) {
- if (e->v.ss.tt == ETREG && (int)e->v.ss.obj >= nlocal) {
be_code_freeregs(finfo, 1);
}
}