From 9785a84a81bc4087e1f9d53cb402b4a43622fa56 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 9 Jun 2009 15:23:17 -0400 Subject: [PATCH] compile: Superstring compilation bug Before: var a = 5 var b = "{a}" print(a == b) # => true, a was overwrite Signed-off-by: Jean Privat --- src/compiling/compiling_methods.nit | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiling/compiling_methods.nit b/src/compiling/compiling_methods.nit index c823b83..3e20f95 100644 --- a/src/compiling/compiling_methods.nit +++ b/src/compiling/compiling_methods.nit @@ -1323,8 +1323,10 @@ redef class ASuperstringExpr for ne in n_exprs do var e = v.ensure_var(v.compile_expr(ne), "super-string element") if ne.stype != stype then - v.add_assignment(e, meth_to_s.compile_call(v, [e])) + v.cfc.free_var(e) + e = meth_to_s.compile_call(v, [e]) end + v.cfc.free_var(e) meth_add.compile_call(v, [array, e]) end -- 1.7.9.5