@@ -549,6 +549,16 @@ export async function runSimulator(prev: TypecheckedStage): Promise<CLIProcedure
549
549
550
550
const elapsedMs = Date . now ( ) - startMs
551
551
552
+ if ( prev . args . outItf ) {
553
+ const trace = toItf ( result . vars , result . states )
554
+ if ( trace . isRight ( ) ) {
555
+ const jsonObj = addItfHeader ( prev . args . input , result . outcome . status , trace . value )
556
+ writeToJson ( prev . args . outItf , jsonObj )
557
+ } else {
558
+ return cliErr ( `ITF conversion failed: ${ trace . value } ` , { ...simulator , errors : [ ] } )
559
+ }
560
+ }
561
+
552
562
switch ( result . outcome . status ) {
553
563
case 'error' :
554
564
return cliErr ( 'Runtime error' , {
@@ -585,16 +595,6 @@ export async function runSimulator(prev: TypecheckedStage): Promise<CLIProcedure
585
595
}
586
596
}
587
597
588
- if ( prev . args . outItf ) {
589
- const trace = toItf ( result . vars , result . states )
590
- if ( trace . isRight ( ) ) {
591
- const jsonObj = addItfHeader ( prev . args . input , result . outcome . status , trace . value )
592
- writeToJson ( prev . args . outItf , jsonObj )
593
- } else {
594
- return cliErr ( `ITF conversion failed: ${ trace . value } ` , { ...simulator , errors : [ ] } )
595
- }
596
- }
597
-
598
598
return cliErr ( 'Invariant violated' , {
599
599
...simulator ,
600
600
status : result . outcome . status ,
0 commit comments