@@ -56,10 +56,11 @@ export function list_into(Type) {
56
56
return entries =>
57
57
always ( new FTL . Resource (
58
58
entries
59
- . reduce ( join_adjacent ( FTL . Junk ) , [ ] )
60
- . reduce ( join_adjacent ( FTL . Comment ) , [ ] )
61
- . reduce ( join_adjacent ( FTL . GroupComment ) , [ ] )
62
- . reduce ( join_adjacent ( FTL . ResourceComment ) , [ ] )
59
+ . reduce ( join_adjacent (
60
+ FTL . Junk ,
61
+ FTL . Comment ,
62
+ FTL . GroupComment ,
63
+ FTL . ResourceComment ) , [ ] )
63
64
. reduce ( attach_comments , [ ] )
64
65
. filter ( remove_blank_lines ) ) ) ;
65
66
case FTL . SelectExpression :
@@ -117,15 +118,16 @@ export function into(Type) {
117
118
}
118
119
}
119
120
120
- function join_adjacent ( Type ) {
121
+ function join_adjacent ( ... types ) {
121
122
return function ( acc , cur ) {
122
123
let prev = acc [ acc . length - 1 ] ;
123
- if ( prev instanceof Type && cur instanceof Type ) {
124
- join_of_type ( Type , prev , cur ) ;
125
- return acc ;
126
- } else {
127
- return acc . concat ( cur ) ;
124
+ for ( let Type of types ) {
125
+ if ( prev instanceof Type && cur instanceof Type ) {
126
+ join_of_type ( Type , prev , cur ) ;
127
+ return acc ;
128
+ }
128
129
}
130
+ return acc . concat ( cur ) ;
129
131
} ;
130
132
}
131
133
0 commit comments