@@ -197,7 +197,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
197
197
// we add it back to the stack
198
198
this . pushToStack ( '(value)' ) ;
199
199
} else {
200
- this . emit ( finalOp , location ! ) ;
200
+ this . emit ( finalOp , location ! , 1 ) ;
201
201
202
202
// At this point there is no verification value left on the stack:
203
203
// - scoped stack is cleared inside branch ended by OP_ENDIF
@@ -267,8 +267,9 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
267
267
}
268
268
269
269
visitTimeOp ( node : TimeOpNode ) : Node {
270
+ // const countBefore = this.output.length;
270
271
node . expression = this . visit ( node . expression ) ;
271
- this . emit ( compileTimeOp ( node . timeOp ) , node . location ! ) ;
272
+ this . emit ( compileTimeOp ( node . timeOp ) , node . location ! , 1 ) ;
272
273
273
274
// add debug require message
274
275
if ( node . message ) {
@@ -286,7 +287,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
286
287
visitRequire ( node : RequireNode ) : Node {
287
288
node . expression = this . visit ( node . expression ) ;
288
289
289
- this . emit ( Op . OP_VERIFY , node . location ! ) ;
290
+ this . emit ( Op . OP_VERIFY , node . location ! , 1 ) ;
290
291
291
292
// add debug require message
292
293
if ( node . message ) {
@@ -343,7 +344,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
343
344
this . popFromStack ( ) ;
344
345
}
345
346
346
- this . emit ( compileCast ( node . expression . type as PrimitiveType , node . type ) , node . location ! ) ;
347
+ this . emit ( compileCast ( node . expression . type as PrimitiveType , node . type ) , node . location ! , 1 ) ;
347
348
this . popFromStack ( ) ;
348
349
this . pushToStack ( '(value)' ) ;
349
350
return node ;
@@ -356,7 +357,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
356
357
357
358
node . parameters = this . visitList ( node . parameters ) ;
358
359
359
- this . emit ( compileGlobalFunction ( node . identifier . name as GlobalFunction ) , node . location ! ) ;
360
+ this . emit ( compileGlobalFunction ( node . identifier . name as GlobalFunction ) , node . location ! , 1 ) ;
360
361
this . popFromStack ( node . parameters . length ) ;
361
362
this . pushToStack ( '(value)' ) ;
362
363
@@ -367,7 +368,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
367
368
this . emit ( encodeBool ( false ) , node . location ! ) ;
368
369
this . pushToStack ( '(value)' ) ;
369
370
node . parameters = this . visitList ( node . parameters ) ;
370
- this . emit ( Op . OP_CHECKMULTISIG , node . location ! ) ;
371
+ this . emit ( Op . OP_CHECKMULTISIG , node . location ! , 1 ) ;
371
372
const sigs = node . parameters [ 0 ] as ArrayNode ;
372
373
const pks = node . parameters [ 1 ] as ArrayNode ;
373
374
this . popFromStack ( sigs . elements . length + pks . elements . length + 3 ) ;
@@ -459,10 +460,10 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
459
460
node . tuple = this . visit ( node . tuple ) ;
460
461
461
462
if ( node . index === 0 ) {
462
- this . emit ( Op . OP_DROP , node . location ! ) ;
463
+ this . emit ( Op . OP_DROP , node . location ! , 1 ) ;
463
464
this . popFromStack ( ) ;
464
465
} else if ( node . index === 1 ) {
465
- this . emit ( Op . OP_NIP , node . location ! ) ;
466
+ this . emit ( Op . OP_NIP , node . location ! , 1 ) ;
466
467
this . nipFromStack ( ) ;
467
468
}
468
469
@@ -473,7 +474,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
473
474
node . left = this . visit ( node . left ) ;
474
475
node . right = this . visit ( node . right ) ;
475
476
const isNumeric = resultingType ( node . left . type , node . right . type ) === PrimitiveType . INT ;
476
- this . emit ( compileBinaryOp ( node . operator , isNumeric ) , node . location ! ) ;
477
+ this . emit ( compileBinaryOp ( node . operator , isNumeric ) , node . location ! , 1 ) ;
477
478
this . popFromStack ( 2 ) ;
478
479
this . pushToStack ( '(value)' ) ;
479
480
if ( node . operator === BinaryOperator . SPLIT ) this . pushToStack ( '(value)' ) ;
@@ -496,7 +497,7 @@ export default class GenerateTargetTraversalWithLocation extends AstTraversal {
496
497
497
498
visitArray ( node : ArrayNode ) : Node {
498
499
node . elements = this . visitList ( node . elements ) ;
499
- this . emit ( encodeInt ( BigInt ( node . elements . length ) ) , node . location ! ) ;
500
+ this . emit ( encodeInt ( BigInt ( node . elements . length ) ) , node . location ! , 1 ) ;
500
501
this . pushToStack ( '(value)' ) ;
501
502
return node ;
502
503
}
0 commit comments