aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-02-19 15:51:03 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-02-19 15:51:03 +0100
commit70d3c4d51f58f0e95fd28f6735cd54cad9ca87ce (patch)
tree650dfd3e7e2bf9fb0e76576b0067b76eb44e46f2 /lib/compiler
parentfddad198019039ade815aedb38f44d54945e56a5 (diff)
downloadotp-70d3c4d51f58f0e95fd28f6735cd54cad9ca87ce.tar.gz
otp-70d3c4d51f58f0e95fd28f6735cd54cad9ca87ce.tar.bz2
otp-70d3c4d51f58f0e95fd28f6735cd54cad9ca87ce.zip
compiler: Transform list of Args to exact literal type
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/beam_z.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_z.erl b/lib/compiler/src/beam_z.erl
index c204eac25d..c2a6ef604e 100644
--- a/lib/compiler/src/beam_z.erl
+++ b/lib/compiler/src/beam_z.erl
@@ -79,7 +79,17 @@ undo_rename({put_map,Fail,assoc,S,D,R,L}) ->
undo_rename({put_map,Fail,exact,S,D,R,L}) ->
{put_map_exact,Fail,S,D,R,L};
undo_rename({test,has_map_fields,Fail,[Src|List]}) ->
- {test,has_map_fields,Fail,Src,{list,List}};
+ {test,has_map_fields,Fail,Src,{list,[to_typed_literal(V)||V<-List]}};
+undo_rename({get_map_elements,Fail,Src,{list, List}}) ->
+ {get_map_elements,Fail,Src,{list,[to_typed_literal(V)||V<-List]}};
undo_rename({select,I,Reg,Fail,List}) ->
{I,Reg,Fail,{list,List}};
undo_rename(I) -> I.
+
+%% to_typed_literal(Arg)
+%% transform Arg to specific literal i.e. float | integer | atom if applicable
+to_typed_literal({literal, V}) when is_float(V) -> {float, V};
+to_typed_literal({literal, V}) when is_atom(V) -> {atom, V};
+to_typed_literal({literal, V}) when is_integer(V) -> {integer, V};
+to_typed_literal({literal, []}) -> nil;
+to_typed_literal(V) -> V.