fix merge error
This commit is contained in:
32
mcode.cm
32
mcode.cm
@@ -339,10 +339,6 @@ var mcode = function(ast) {
|
||||
return t == "num" || t == "int"
|
||||
}
|
||||
|
||||
var slot_is_int = function(slot) {
|
||||
return s_slot_types[text(slot)] == "int"
|
||||
}
|
||||
|
||||
var slot_is_text = function(slot) {
|
||||
return s_slot_types[text(slot)] == "text"
|
||||
}
|
||||
@@ -351,6 +347,10 @@ var mcode = function(ast) {
|
||||
s_slot_types[text(slot)] = typ
|
||||
}
|
||||
|
||||
var propagate_slot = function(dest, src) {
|
||||
s_slot_types[text(dest)] = s_slot_types[text(src)]
|
||||
}
|
||||
|
||||
// emit_add_decomposed: emit type-dispatched add (text → concat, num → add)
|
||||
// reads _bp_dest, _bp_left, _bp_right, _bp_ln, _bp_rn from closure
|
||||
var emit_add_decomposed = function() {
|
||||
@@ -444,12 +444,6 @@ var mcode = function(ast) {
|
||||
var t0 = 0
|
||||
var t1 = 0
|
||||
|
||||
// Known-int fast path
|
||||
if ((is_known_int(_bp_ln) || slot_is_int(left))
|
||||
&& (is_known_int(_bp_rn) || slot_is_int(right))) {
|
||||
emit_3("eq_int", dest, left, right)
|
||||
return null
|
||||
}
|
||||
// Known-num fast path
|
||||
if ((is_known_number(_bp_ln) || slot_is_num(left))
|
||||
&& (is_known_number(_bp_rn) || slot_is_num(right))) {
|
||||
@@ -536,12 +530,6 @@ var mcode = function(ast) {
|
||||
var t0 = 0
|
||||
var t1 = 0
|
||||
|
||||
// Known-int fast path
|
||||
if ((is_known_int(_bp_ln) || slot_is_int(left))
|
||||
&& (is_known_int(_bp_rn) || slot_is_int(right))) {
|
||||
emit_3("ne_int", dest, left, right)
|
||||
return null
|
||||
}
|
||||
// Known-num fast path
|
||||
if ((is_known_number(_bp_ln) || slot_is_num(left))
|
||||
&& (is_known_number(_bp_rn) || slot_is_num(right))) {
|
||||
@@ -636,24 +624,17 @@ var mcode = function(ast) {
|
||||
var right = _bp_right
|
||||
var t0 = 0
|
||||
var t1 = 0
|
||||
var left_is_int = is_known_int(_bp_ln) || slot_is_int(left)
|
||||
var left_is_num = is_known_number(_bp_ln) || slot_is_num(left)
|
||||
var left_is_text = is_known_text(_bp_ln) || slot_is_text(left)
|
||||
var right_is_int = is_known_int(_bp_rn) || slot_is_int(right)
|
||||
var right_is_num = is_known_number(_bp_rn) || slot_is_num(right)
|
||||
var right_is_text = is_known_text(_bp_rn) || slot_is_text(right)
|
||||
var not_num = null
|
||||
var done = null
|
||||
var err = null
|
||||
|
||||
// Both known int
|
||||
if (left_is_int && right_is_int) {
|
||||
emit_3(int_op, dest, left, right)
|
||||
return null
|
||||
}
|
||||
// Both known number
|
||||
if (left_is_num && right_is_num) {
|
||||
emit_3(float_op, dest, left, right)
|
||||
emit_3(poly_op, dest, left, right)
|
||||
return null
|
||||
}
|
||||
// Both known text
|
||||
@@ -1645,6 +1626,7 @@ var mcode = function(ast) {
|
||||
local = find_var(name)
|
||||
if (local >= 0) {
|
||||
emit_2("move", local, dest)
|
||||
propagate_slot(local, dest)
|
||||
}
|
||||
} else if (level > 0) {
|
||||
_lv = level - 1
|
||||
@@ -1744,9 +1726,11 @@ var mcode = function(ast) {
|
||||
if (level == 0 || level == -1) {
|
||||
slot = find_var(name)
|
||||
if (slot >= 0) {
|
||||
mark_slot(slot, null)
|
||||
val_slot = gen_expr(right, slot)
|
||||
if (val_slot != slot) {
|
||||
emit_2("move", slot, val_slot)
|
||||
propagate_slot(slot, val_slot)
|
||||
}
|
||||
return val_slot
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user