@@ -162,11 +162,11 @@ defmodule Jason.Formatter do
162
162
defp pp_iodata ( input , output_acc , depth , in_str , in_bs , empty , first , opts )
163
163
164
164
defp pp_iodata ( "" , output_acc , depth , in_str , in_bs , empty , first , opts ) do
165
- { :lists . reverse ( output_acc ) , { depth , in_str , in_bs , empty , first , opts } }
165
+ { output_acc , { depth , in_str , in_bs , empty , first , opts } }
166
166
end
167
167
168
168
defp pp_iodata ( [ ] , output_acc , depth , in_str , in_bs , empty , first , opts ) do
169
- { :lists . reverse ( output_acc ) , { depth , in_str , in_bs , empty , first , opts } }
169
+ { output_acc , { depth , in_str , in_bs , empty , first , opts } }
170
170
end
171
171
172
172
defp pp_iodata ( << byte :: size ( 8 ) , rest :: binary >> , output_acc , depth , in_str , in_bs , empty , first , opts ) do
@@ -182,9 +182,9 @@ defmodule Jason.Formatter do
182
182
{ reversed_output , end_state } = Enum . reduce list , { [ ] , starting_state } , fn ( item , { output_acc , state } ) ->
183
183
{ depth , in_str , in_bs , empty , first , opts } = state
184
184
{ item_output , new_state } = pp_iodata ( item , [ ] , depth , in_str , in_bs , empty , first , opts )
185
- { [ item_output | output_acc ] , new_state }
185
+ { [ output_acc , item_output ] , new_state }
186
186
end
187
- { [ :lists . reverse ( reversed_output ) | output_acc ] , end_state }
187
+ { [ output_acc , reversed_output ] , end_state }
188
188
end
189
189
190
190
@@ -204,26 +204,26 @@ defmodule Jason.Formatter do
204
204
## in string, following backslash
205
205
defp pp_byte ( byte , rest , output , depth , true = in_str , true = _in_bs , empty , first , opts ) do
206
206
in_bs = false
207
- pp_iodata ( rest , [ byte | output ] , depth , in_str , in_bs , empty , first , opts )
207
+ pp_iodata ( rest , [ output , byte ] , depth , in_str , in_bs , empty , first , opts )
208
208
end
209
209
210
210
## in string, backslash
211
211
defp pp_byte ( byte , rest , output , depth , true = in_str , _in_bs , empty , first , opts )
212
212
when byte in '\\ ' do
213
213
in_bs = true
214
- pp_iodata ( rest , [ byte | output ] , depth , in_str , in_bs , empty , first , opts )
214
+ pp_iodata ( rest , [ output , byte ] , depth , in_str , in_bs , empty , first , opts )
215
215
end
216
216
217
217
## in string, end quote
218
218
defp pp_byte ( byte , rest , output , depth , true = _in_str , in_bs , empty , first , opts )
219
219
when byte in '"' do
220
220
in_str = false
221
- pp_iodata ( rest , [ byte | output ] , depth , in_str , in_bs , empty , first , opts )
221
+ pp_iodata ( rest , [ output , byte ] , depth , in_str , in_bs , empty , first , opts )
222
222
end
223
223
224
224
## in string, other character
225
225
defp pp_byte ( byte , rest , output , depth , true = in_str , in_bs , empty , first , opts ) do
226
- pp_iodata ( rest , [ byte | output ] , depth , in_str , in_bs , empty , first , opts )
226
+ pp_iodata ( rest , [ output , byte ] , depth , in_str , in_bs , empty , first , opts )
227
227
end
228
228
229
229
## out of string, whitespace
@@ -244,46 +244,46 @@ defmodule Jason.Formatter do
244
244
first = false
245
245
empty = true
246
246
depth = depth + 1
247
- pp_iodata ( rest , [ out | output ] , depth , in_str , in_bs , empty , first , opts )
247
+ pp_iodata ( rest , [ output , out ] , depth , in_str , in_bs , empty , first , opts )
248
248
end
249
249
250
250
## out of string, end empty block
251
251
defp pp_byte ( byte , rest , output , depth , in_str , in_bs , true = _empty , first , opts )
252
252
when byte in '}]' do
253
253
empty = false
254
254
depth = depth - 1
255
- pp_iodata ( rest , [ byte | output ] , depth , in_str , in_bs , empty , first , opts )
255
+ pp_iodata ( rest , [ output , byte ] , depth , in_str , in_bs , empty , first , opts )
256
256
end
257
257
258
258
## out of string, end non-empty block
259
259
defp pp_byte ( byte , rest , output , depth , in_str , in_bs , false = empty , first , opts )
260
260
when byte in '}]' do
261
261
depth = depth - 1
262
262
out = [ opts [ :line_separator ] , tab ( opts , depth ) , byte ]
263
- pp_iodata ( rest , [ out | output ] , depth , in_str , in_bs , empty , first , opts )
263
+ pp_iodata ( rest , [ output , out ] , depth , in_str , in_bs , empty , first , opts )
264
264
end
265
265
266
266
## out of string, comma
267
267
defp pp_byte ( byte , rest , output , depth , in_str , in_bs , _empty , first , opts )
268
268
when byte in ',' do
269
269
empty = false
270
270
out = [ byte , opts [ :line_separator ] , tab ( opts , depth ) ]
271
- pp_iodata ( rest , [ out | output ] , depth , in_str , in_bs , empty , first , opts )
271
+ pp_iodata ( rest , [ output , out ] , depth , in_str , in_bs , empty , first , opts )
272
272
end
273
273
274
274
## out of string, colon
275
275
defp pp_byte ( byte , rest , output , depth , in_str , in_bs , empty , first , opts )
276
276
when byte in ':' do
277
277
out = [ byte , opts [ :after_colon ] ]
278
- pp_iodata ( rest , [ out | output ] , depth , in_str , in_bs , empty , first , opts )
278
+ pp_iodata ( rest , [ output , out ] , depth , in_str , in_bs , empty , first , opts )
279
279
end
280
280
281
281
## out of string, other character (maybe start quote)
282
282
defp pp_byte ( byte , rest , output , depth , _in_str , in_bs , empty , first , opts ) do
283
283
out = if empty , do: [ opts [ :line_separator ] , tab ( opts , depth ) , byte ] , else: byte
284
284
in_str = byte in '"'
285
285
empty = false
286
- pp_iodata ( rest , [ out | output ] , depth , in_str , in_bs , empty , first , opts )
286
+ pp_iodata ( rest , [ output , out ] , depth , in_str , in_bs , empty , first , opts )
287
287
end
288
288
end
289
289
0 commit comments