@@ -96,6 +96,9 @@ elixir_to_erl(Tree, Ann) when is_binary(Tree) ->
9696  % % considers a string in a binary to be encoded in latin1, so the bytes
9797  % % are not changed in any fashion.
9898  {bin , Ann , [{bin_element , Ann , {string , Ann , binary_to_list (Tree )}, default , default }]};
99+ elixir_to_erl (Tree , Ann ) when  is_bitstring (Tree ) -> 
100+   Segments  =  [elixir_to_erl_bitstring_segment (X , Ann ) || X  <-  bitstring_to_list (Tree )],
101+   {bin , Ann , Segments };
99102elixir_to_erl (Tree , Ann ) when  is_function (Tree ) -> 
100103  case  (erlang :fun_info (Tree , type ) ==  {type , external }) andalso 
101104       (erlang :fun_info (Tree , env ) ==  {env , []}) of 
@@ -115,6 +118,13 @@ elixir_to_erl(Tree, Ann) ->
115118elixir_to_erl_cons ([H  | T ], Ann ) ->  {cons , Ann , elixir_to_erl (H , Ann ), elixir_to_erl_cons (T , Ann )};
116119elixir_to_erl_cons (T , Ann ) ->  elixir_to_erl (T , Ann ).
117120
121+ elixir_to_erl_bitstring_segment (Int , Ann ) when  is_integer (Int ) -> 
122+   {bin_element , Ann , {integer , Ann , Int }, default , [integer ]};
123+ elixir_to_erl_bitstring_segment (Rest , Ann ) when  is_bitstring (Rest ) -> 
124+   Size  =  bit_size (Rest ),
125+   <<Int :Size >> =  Rest ,
126+   {bin_element , Ann , {integer , Ann , Int }, {integer , Ann , Size }, [integer ]}.
127+ 
118128% % Returns a scope for translation.
119129
120130scope (_Meta , ExpandCaptures ) -> 
0 commit comments