aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-03-31 13:29:17 +0200
committerFredrik Gustafsson <[email protected]>2013-06-05 12:08:39 +0200
commit4e894bafe3e15ad446d73a2ad05adebe0edb3254 (patch)
tree6089cbcc7e0a199add734281d7e1d9e0ebee6d4f /lib/compiler
parent90efeaf21147505b1e8207822e606027f94183cc (diff)
downloadotp-4e894bafe3e15ad446d73a2ad05adebe0edb3254.tar.gz
otp-4e894bafe3e15ad446d73a2ad05adebe0edb3254.tar.bz2
otp-4e894bafe3e15ad446d73a2ad05adebe0edb3254.zip
Simplify v3_core's translation of bit string generators
Now that unsized binary segments are forbidden in patterns of bit string generators, v3_core:append_tail_segment/2 does not need to check for an existing unsized tail segment and can thus be changed to a simple '++'/2 call.
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/v3_core.erl19
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index eea54b30a2..2af7166c86 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -1133,28 +1133,13 @@ bc_tq1(_, {bin,Bl,Elements}, [], AccVar, St0) ->
%%Anno = Anno0#a{anno=[compiler_generated|A]},
{set_anno(E, Anno),Pre,St}.
-append_tail_segment(Segs, St) ->
- app_tail_seg(Segs, St, []).
-
-app_tail_seg([#c_bitstr{val=Var0,size=#c_literal{val=all}}=Seg0]=L,
- St0, Acc) ->
- case Var0 of
- #c_var{name='_'} ->
- {Var,St} = new_var(St0),
- Seg = Seg0#c_bitstr{val=Var},
- {reverse(Acc, [Seg]),Var,St};
- #c_var{} ->
- {reverse(Acc, L),Var0,St0}
- end;
-app_tail_seg([H|T], St, Acc) ->
- app_tail_seg(T, St, [H|Acc]);
-app_tail_seg([], St0, Acc) ->
+append_tail_segment(Segs, St0) ->
{Var,St} = new_var(St0),
Tail = #c_bitstr{val=Var,size=#c_literal{val=all},
unit=#c_literal{val=1},
type=#c_literal{val=binary},
flags=#c_literal{val=[unsigned,big]}},
- {reverse(Acc, [Tail]),Var,St}.
+ {Segs++[Tail],Var,St}.
emasculate_segments(Segs, St) ->
emasculate_segments(Segs, St, []).