File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ abstract class Emitter {
10
10
const METHOD = 1 ;
11
11
12
12
protected $ out ;
13
+ protected $ line = 1 ;
13
14
protected $ meta = [];
14
15
15
16
/**
@@ -635,11 +636,19 @@ protected function emitFrom($node) {
635
636
636
637
public function emit ($ arg ) {
637
638
if ($ arg instanceof Node) {
639
+ while ($ arg ->line > $ this ->line ) {
640
+ $ this ->out ->write ("\n" );
641
+ $ this ->line ++;
642
+ }
638
643
$ this ->{'emit ' .$ arg ->arity }($ arg );
639
644
} else {
640
645
foreach ($ arg as $ node ) {
646
+ while ($ node ->line > $ this ->line ) {
647
+ $ this ->out ->write ("\n" );
648
+ $ this ->line ++;
649
+ }
641
650
$ this ->{'emit ' .$ node ->arity }($ node );
642
- isset ($ node ->symbol ->std ) || $ this ->out ->write (" ; \n" );
651
+ isset ($ node ->symbol ->std ) || $ this ->out ->write (' ; ' );
643
652
}
644
653
}
645
654
}
You can’t perform that action at this time.
0 commit comments