@@ -21,7 +21,7 @@ translate(Meta, Args, Return, S) ->
21
21
22
22
case comprehension_expr (TInto , TExpr ) of
23
23
{inline , TIntoExpr } ->
24
- { build_inline (Ann , TCases , TIntoExpr , TInto , TUniq , SF ), SF } ;
24
+ build_inline (Ann , TCases , TIntoExpr , TInto , TUniq , SF );
25
25
{into , TIntoExpr } ->
26
26
build_into (Ann , TCases , TIntoExpr , TInto , TUniq , SF )
27
27
end .
@@ -91,17 +91,17 @@ collect_filters([], Acc) ->
91
91
92
92
build_inline (Ann , Clauses , Expr , Into , Uniq , S ) ->
93
93
case not Uniq and lists :all (fun (Clause ) -> element (1 , Clause ) == bin end , Clauses ) of
94
- true -> build_comprehension (Ann , Clauses , Expr , Into );
94
+ true -> { build_comprehension (Ann , Clauses , Expr , Into ), S } ;
95
95
false -> build_inline_each (Ann , Clauses , Expr , Into , Uniq , S )
96
96
end .
97
97
98
98
build_inline_each (Ann , Clauses , Expr , false , Uniq , S ) ->
99
99
InnerFun = fun (InnerExpr , _InnerAcc ) -> InnerExpr end ,
100
- build_reduce (Ann , Clauses , InnerFun , Expr , {nil , Ann }, Uniq , S );
100
+ { build_reduce (Ann , Clauses , InnerFun , Expr , {nil , Ann }, Uniq , S ), S } ;
101
101
build_inline_each (Ann , Clauses , Expr , {nil , _ } = Into , Uniq , S ) ->
102
102
InnerFun = fun (InnerExpr , InnerAcc ) -> {cons , Ann , InnerExpr , InnerAcc } end ,
103
103
ReduceExpr = build_reduce (Ann , Clauses , InnerFun , Expr , Into , Uniq , S ),
104
- elixir_erl :remote (Ann , lists , reverse , [ReduceExpr ]);
104
+ { elixir_erl :remote (Ann , lists , reverse , [ReduceExpr ]), S } ;
105
105
build_inline_each (Ann , Clauses , Expr , {bin , _ , []}, Uniq , S ) ->
106
106
{InnerValue , SV } = build_var (Ann , S ),
107
107
@@ -135,11 +135,21 @@ build_inline_each(Ann, Clauses, Expr, {bin, _, []}, Uniq, S) ->
135
135
end ,
136
136
137
137
ReduceExpr = build_reduce (Ann , Clauses , InnerFun , Expr , {nil , Ann }, Uniq , SV ),
138
- elixir_erl :remote (Ann , erlang , iolist_to_binary , [ReduceExpr ]).
138
+
139
+ {{'case' , Ann , ReduceExpr , [
140
+ {clause , Ann ,
141
+ [InnerValue ],
142
+ [[elixir_erl :remote (Ann , erlang , is_bitstring , [InnerValue ])]],
143
+ [InnerValue ]},
144
+ {clause , Ann ,
145
+ [InnerValue ],
146
+ [],
147
+ [elixir_erl :remote (Ann , erlang , iolist_to_binary , [InnerValue ])]}
148
+ ]}, SV }.
139
149
140
150
build_into (Ann , Clauses , Expr , {map , _ , []}, Uniq , S ) ->
141
- ReduceExpr = build_inline_each (Ann , Clauses , Expr , {nil , Ann }, Uniq , S ),
142
- {elixir_erl :remote (Ann , maps , from_list , [ReduceExpr ]), S };
151
+ { ReduceExpr , SR } = build_inline_each (Ann , Clauses , Expr , {nil , Ann }, Uniq , S ),
152
+ {elixir_erl :remote (Ann , maps , from_list , [ReduceExpr ]), SR };
143
153
build_into (Ann , Clauses , Expr , Into , Uniq , S ) ->
144
154
{Fun , SF } = build_var (Ann , S ),
145
155
{Acc , SA } = build_var (Ann , SF ),
0 commit comments