@@ -11,11 +11,10 @@ const indent = { type: 'Indent' };
11
11
const dedent = { type : 'Dedent' } ;
12
12
13
13
/**
14
- * @param {Command[] } children
15
- * @returns {Sequence }
14
+ * @returns {Command[] }
16
15
*/
17
- function create_sequence ( ... children ) {
18
- return { type : 'Sequence' , children } ;
16
+ function create_sequence ( ) {
17
+ return [ ] ;
19
18
}
20
19
21
20
/**
@@ -31,7 +30,7 @@ function measure(commands, from, to = commands.length) {
31
30
if ( typeof command === 'string' ) {
32
31
total += command . length ;
33
32
} else if ( Array . isArray ( command ) ) {
34
- total += measure ( command , 0 , command . length ) ;
33
+ total += 2 ; // TODO ` measure(command, 0, command.length)` ;
35
34
} else if ( command . type === 'Chunk' ) {
36
35
total += command . content . length ;
37
36
}
@@ -287,7 +286,7 @@ const handle_body = (nodes, state) => {
287
286
grouped_expression_types . includes ( last_statement . type ) ) &&
288
287
last_statement . type !== statement . type )
289
288
) {
290
- margin . children . push ( '\n' ) ;
289
+ margin . push ( '\n' ) ;
291
290
}
292
291
293
292
let add_newline = false ;
@@ -331,11 +330,11 @@ const handle_var_declaration = (node, state) => {
331
330
332
331
if ( multiline ) {
333
332
state . multiline = true ;
334
- if ( node . declarations . length > 1 ) open . children . push ( indent ) ;
335
- join . children . push ( ',' , newline ) ;
333
+ if ( node . declarations . length > 1 ) open . push ( indent ) ;
334
+ join . push ( ',' , newline ) ;
336
335
if ( node . declarations . length > 1 ) state . commands . push ( dedent ) ;
337
336
} else {
338
- join . children . push ( ', ' ) ;
337
+ join . push ( ', ' ) ;
339
338
}
340
339
} ;
341
340
@@ -407,13 +406,13 @@ function sequence(nodes, state, spaces, fn, separator = ',') {
407
406
if ( multiline ) {
408
407
state . multiline = true ;
409
408
410
- open . children . push ( indent , newline ) ;
411
- join . children . push ( newline ) ;
412
- close . children . push ( dedent , newline ) ;
409
+ open . push ( indent , newline ) ;
410
+ join . push ( newline ) ;
411
+ close . push ( dedent , newline ) ;
413
412
} else {
414
- if ( spaces ) open . children . push ( ' ' ) ;
415
- join . children . push ( ' ' ) ;
416
- if ( spaces ) close . children . push ( ' ' ) ;
413
+ if ( spaces ) open . push ( ' ' ) ;
414
+ join . push ( ' ' ) ;
415
+ if ( spaces ) close . push ( ' ' ) ;
417
416
}
418
417
}
419
418
@@ -709,11 +708,11 @@ const shared = {
709
708
}
710
709
711
710
if ( multiline ) {
712
- open . children . push ( indent , newline ) ;
713
- join . children . push ( ',' , newline ) ;
714
- close . children . push ( dedent , newline ) ;
711
+ open . push ( indent , newline ) ;
712
+ join . push ( ',' , newline ) ;
713
+ close . push ( dedent , newline ) ;
715
714
} else {
716
- join . children . push ( ', ' ) ;
715
+ join . push ( ', ' ) ;
717
716
}
718
717
} ,
719
718
@@ -905,12 +904,12 @@ const handlers = {
905
904
const multiline = child_state . multiline ;
906
905
907
906
if ( multiline ) {
908
- if_true . children . push ( indent , newline , '? ' ) ;
909
- if_false . children . push ( newline , ': ' ) ;
907
+ if_true . push ( indent , newline , '? ' ) ;
908
+ if_false . push ( newline , ': ' ) ;
910
909
state . commands . push ( dedent ) ;
911
910
} else {
912
- if_true . children . push ( ' ? ' ) ;
913
- if_false . children . push ( ' : ' ) ;
911
+ if_true . push ( ' ? ' ) ;
912
+ if_false . push ( ' : ' ) ;
914
913
}
915
914
} ,
916
915
0 commit comments