Merge branch 'improve_str_concat' into optimize_mcode
This commit is contained in:
6
mcode.cm
6
mcode.cm
@@ -1576,8 +1576,10 @@ var mcode = function(ast) {
|
||||
// Standard binary ops
|
||||
left_slot = gen_expr(left, -1)
|
||||
right_slot = gen_expr(right, -1)
|
||||
// Use target slot for ops without multi-type dispatch (add has text+num paths)
|
||||
dest = (target >= 0 && kind != "+") ? target : alloc_slot()
|
||||
// Use target slot for ops without multi-type dispatch (add has text+num paths).
|
||||
// Exception: allow + to write directly to target when target == left_slot
|
||||
// (self-assign pattern like s = s + x) since concat/add reads before writing.
|
||||
dest = (target >= 0 && (kind != "+" || target == left_slot)) ? target : alloc_slot()
|
||||
op = binop_map[kind]
|
||||
if (op == null) {
|
||||
op = "add"
|
||||
|
||||
Reference in New Issue
Block a user