fix tests
This commit is contained in:
11
mcode.cm
11
mcode.cm
@@ -1207,6 +1207,8 @@ var mcode = function(ast) {
|
||||
var f = alloc_slot()
|
||||
var val = alloc_slot()
|
||||
var skip = gen_label("filter_skip")
|
||||
var bail = gen_label("filter_bail")
|
||||
var bool_check = alloc_slot()
|
||||
var ctx = {fn: fn_slot, fn_arity: fn_arity, result: val, null_s: null_s,
|
||||
frame: f, zero: zero, one: one, az: az, ao: ao, prefix: "filter"}
|
||||
var L = {arr: arr_slot, len: len, i: i, check: check, item: item, one: one,
|
||||
@@ -1219,12 +1221,19 @@ var mcode = function(ast) {
|
||||
emit_2("length", fn_arity, fn_slot)
|
||||
emit_forward_loop(L, function(L) {
|
||||
emit_arity_call(ctx, [L.item, L.i], 2)
|
||||
emit_jump_cond("wary_false", val, skip)
|
||||
emit_2("is_bool", bool_check, val)
|
||||
emit_jump_cond("jump_false", bool_check, bail)
|
||||
emit_jump_cond("jump_false", val, skip)
|
||||
emit_2("push", result, L.item)
|
||||
emit_label(skip)
|
||||
return null
|
||||
})
|
||||
emit_2("move", dest, result)
|
||||
var end = gen_label("filter_end")
|
||||
emit_jump(end)
|
||||
emit_label(bail)
|
||||
emit_1("null", dest)
|
||||
emit_label(end)
|
||||
return dest
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user