aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-02-07 18:28:29 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-02-07 18:28:29 +0100
commit67663e057a35dfee45bf802539738b8ef107bd32 (patch)
treea0bb369bfd343436f59630d31d5bf72ffc87c801 /lib/compiler/src
parent46cad6ef63c4b9adc7b9fd795e8484c03e73dce5 (diff)
downloadotp-67663e057a35dfee45bf802539738b8ef107bd32.tar.gz
otp-67663e057a35dfee45bf802539738b8ef107bd32.tar.bz2
otp-67663e057a35dfee45bf802539738b8ef107bd32.zip
compiler: Fix sys_core_fold let optimization
Map variable was not covered and faulty optimization could occur. Ex. t() -> M0 = id(#{ "a" => 1 }), #{ "a" := _ } = M0, M0#{ "a" := b }. M0 was lost in let expression optimization.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/core_lib.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compiler/src/core_lib.erl b/lib/compiler/src/core_lib.erl
index f506901099..ed181e3baa 100644
--- a/lib/compiler/src/core_lib.erl
+++ b/lib/compiler/src/core_lib.erl
@@ -105,8 +105,8 @@ vu_expr(V, #c_cons{hd=H,tl=T}) ->
vu_expr(V, H) orelse vu_expr(V, T);
vu_expr(V, #c_tuple{es=Es}) ->
vu_expr_list(V, Es);
-vu_expr(V, #c_map{es=Es}) ->
- vu_expr_list(V, Es);
+vu_expr(V, #c_map{var=M,es=Es}) ->
+ vu_expr(V, M) orelse vu_expr_list(V, Es);
vu_expr(V, #c_map_pair{key=Key,val=Val}) ->
vu_expr_list(V, [Key,Val]);
vu_expr(V, #c_binary{segments=Ss}) ->