@@ -178,7 +178,7 @@ class QAST::MASTOperations {
178
178
# if we've already seen a type-var
179
179
if ($ arg_kind != $ type_var_kind ) {
180
180
# the arg types must match
181
- nqp ::die(" variable-type op requires same-typed args" );
181
+ nqp ::die(" variable-type op ' $ op ' requires same-typed args" );
182
182
}
183
183
}
184
184
else {
@@ -328,7 +328,7 @@ class QAST::MASTOperations {
328
328
else {
329
329
nqp ::die(" MoarVM op '$ moarop ' is unknown as a core or extension op" );
330
330
}
331
- nqp ::die(" moarop $ moarop return arg index out of range" )
331
+ nqp ::die(" moarop $ moarop return arg index $ ret out of range -1.. " ~ $ num_operands - 1 )
332
332
if $ ret < -1 || $ret >= $ num_operands ;
333
333
nqp ::die(" moarop $ moarop is not void" )
334
334
if $ num_operands && (nqp ::atpos_i(@ operands_values , $ operands_offset ) +& $ MVM_operand_rw_mask ) ==
@@ -584,7 +584,7 @@ QAST::MASTOperations.add_core_op('list_b', -> $qastcomp, $op {
584
584
# Push things to the list.
585
585
my $ item_reg := $ regalloc . fresh_register($ MVM_reg_obj );
586
586
for $ op . list {
587
- nqp ::die(" list_b must have a list of blocks" )
587
+ nqp ::die(" The ' list_b' op needs a list of blocks, got " ~ $ _ . HOW . name ( $ _ ) )
588
588
unless nqp ::istype($ _ , QAST ::Block);
589
589
my $ cuid := $ _ . cuid();
590
590
my $ frame := $ qastcomp . mast_frames{$ cuid };
@@ -689,7 +689,7 @@ for <if unless with without> -> $op_name {
689
689
QAST ::MASTOperations. add_core_op($ op_name , -> $ qastcomp , $ op {
690
690
# Check operand count.
691
691
my $ operands := + $ op . list;
692
- nqp ::die(" Operation '$ op_name ' needs either 2 or 3 operands" )
692
+ nqp ::die(" The '$ op_name ' op needs 2 or 3 operands, got $ operands" )
693
693
if $ operands < 2 || $operands > 3 ;
694
694
695
695
# Create labels.
@@ -749,7 +749,7 @@ for <if unless with without> -> $op_name {
749
749
}
750
750
751
751
if (@ comp_ops [0 ]. result_kind == $ MVM_reg_void ) {
752
- nqp ::die(" operation '$ op_name ' condition cannot be void" );
752
+ nqp ::die(" The '$ op_name ' op condition cannot be void, cannot use the results of ' " ~ $ op [ 0 ] . op ~ " ' " );
753
753
}
754
754
755
755
my $ res_kind ;
@@ -850,7 +850,7 @@ for <if unless with without> -> $op_name {
850
850
851
851
QAST ::MASTOperations. add_core_op(' defor' , -> $ qastcomp , $ op {
852
852
if + $ op . list != 2 {
853
- nqp ::die(" Operation 'defor' needs 2 operands" );
853
+ nqp ::die(" The 'defor' op needs 2 operands, got " ~ + $ op . list );
854
854
}
855
855
856
856
# Compile the expression.
@@ -960,7 +960,7 @@ QAST::MASTOperations.add_core_op('xor', -> $qastcomp, $op {
960
960
961
961
QAST ::MASTOperations. add_core_op(' ifnull' , -> $ qastcomp , $ op {
962
962
if + $ op . list != 2 {
963
- nqp ::die(" The 'ifnull' op expects two children " );
963
+ nqp ::die(" The 'ifnull' op needs 2 operands, got " ~ + $ op . list );
964
964
}
965
965
966
966
# Compile the expression.
@@ -1051,7 +1051,7 @@ for ('', 'repeat_') -> $repness {
1051
1051
1052
1052
# Check operand count.
1053
1053
my $ operands := + @ comp_ops ;
1054
- nqp ::die(" Operation '$ repness$ op_name ' needs 2 or 3 operands" )
1054
+ nqp ::die(" The '$ repness$ op_name ' op needs 2 or 3 operands, got $ operands" )
1055
1055
if $ operands != 2 && $ operands != 3 ;
1056
1056
1057
1057
# Test the condition and jump to the loop end if it's
@@ -1172,10 +1172,10 @@ QAST::MASTOperations.add_core_op('for', -> $qastcomp, $op {
1172
1172
}
1173
1173
1174
1174
if + @ operands != 2 {
1175
- nqp ::die(" Operation 'for' needs 2 operands" );
1175
+ nqp ::die(" The 'for' op needs 2 operands, got " ~ + @ operands );
1176
1176
}
1177
1177
unless nqp ::istype(@ operands [1 ], QAST ::Block) {
1178
- nqp ::die(" Operation 'for' expects a block as its second operand" );
1178
+ nqp ::die(" The 'for' op expects a block as its second operand, got " ~ @ operands [ 1 ] . HOW . name ( @ operands [ 1 ]) );
1179
1179
}
1180
1180
1181
1181
@@ -1330,10 +1330,10 @@ sub handle_arg($arg, $qastcomp, @ins, @arg_regs, @arg_flags, @arg_kinds) {
1330
1330
$ arg_mast := $ qastcomp . coerce($ arg_mast , $ MVM_reg_int64 );
1331
1331
}
1332
1332
1333
- nqp ::die(" arg expression cannot be void" )
1333
+ nqp ::die(" Arg expression cannot be void, cannot use the return of " ~ $ arg . op )
1334
1334
if $ arg_mast . result_kind == $ MVM_reg_void ;
1335
1335
1336
- nqp ::die(" arg code did not result in a MAST::Local" )
1336
+ nqp ::die(" Arg code did not result in a MAST::Local" )
1337
1337
unless $ arg_mast . result_reg && $ arg_mast . result_reg ~~ MAST::Local;
1338
1338
1339
1339
nqp :: push (@ arg_kinds , $ arg_mast . result_kind);
@@ -1391,7 +1391,7 @@ my $call_gen := sub ($qastcomp, $op) {
1391
1391
}
1392
1392
@ args := arrange_args(@ args );
1393
1393
1394
- nqp ::die(" callee code did not result in a MAST::Local" )
1394
+ nqp ::die(" Callee code did not result in a MAST::Local" )
1395
1395
unless $ callee . result_reg && $ callee . result_reg ~~ MAST::Local;
1396
1396
1397
1397
# main instruction list
@@ -1466,10 +1466,10 @@ QAST::MASTOperations.add_core_op('callmethod', -> $qastcomp, $op {
1466
1466
}
1467
1467
@ args := arrange_args(@ args );
1468
1468
1469
- nqp ::die(" invocant expression must be an object" )
1469
+ nqp ::die(" Invocant expression must be an object, got " ~ $ invocant . result_kind )
1470
1470
unless $ invocant . result_kind == $ MVM_reg_obj ;
1471
1471
1472
- nqp ::die(" invocant code did not result in a MAST::Local" )
1472
+ nqp ::die(" Invocant code did not result in a MAST::Local" )
1473
1473
unless $ invocant . result_reg && $ invocant . result_reg ~~ MAST::Local;
1474
1474
1475
1475
# main instruction list
@@ -1583,10 +1583,10 @@ QAST::MASTOperations.add_core_op('bind', -> $qastcomp, $op {
1583
1583
# Sanity checks.
1584
1584
my @ children := $ op . list;
1585
1585
if + @ children != 2 {
1586
- nqp ::die(" A 'bind' op must have exactly two children" );
1586
+ nqp ::die(" The 'bind' op needs two children, got " ~ + @ children );
1587
1587
}
1588
1588
unless nqp ::istype(@ children [0 ], QAST ::Var) {
1589
- nqp ::die(" First child of a 'bind' op must be a QAST::Var" );
1589
+ nqp ::die(" First child of a 'bind' op must be a QAST::Var, got " ~ @ children [ 0 ] . HOW . name ( @ children [ 0 ]) );
1590
1590
}
1591
1591
1592
1592
# Set the QAST of the think we're to bind, then delegate to
@@ -1727,7 +1727,7 @@ QAST::MASTOperations.add_core_op('handle', :!inlinable, sub ($qastcomp, $op) {
1727
1727
QAST ::MASTOperations. add_core_op(' handlepayload' , :! inlinable, sub ($ qastcomp , $ op ) {
1728
1728
my @ children := $ op . list;
1729
1729
if @ children != 3 {
1730
- nqp ::die(" The 'handlepayload' op requires three children" );
1730
+ nqp ::die(" The 'handlepayload' op needs 3 children, got " ~ + @ children );
1731
1731
}
1732
1732
my str $ type := @ children [1 ];
1733
1733
unless nqp ::existskey(% handler_names , $ type ) {
@@ -2274,7 +2274,7 @@ QAST::MASTOperations.add_core_moarop_mapping('indexingoptimized', 'indexingoptim
2274
2274
QAST ::MASTOperations. add_core_op(' tclc' , -> $ qastcomp , $ op {
2275
2275
my @ operands := $ op . list;
2276
2276
unless + @ operands == 1 {
2277
- nqp ::die(' tclc op requires one argument' );
2277
+ nqp ::die(" The 'tclc' op needs 1 argument, got " ~ + @ operands );
2278
2278
}
2279
2279
$ qastcomp . as_mast(
2280
2280
QAST ::Op. new ( : op(' concat' ),
@@ -2674,7 +2674,7 @@ sub add_native_assign_op($op_name, $kind) {
2674
2674
QAST ::MASTOperations. add_core_op($ op_name , -> $ qastcomp , $ op {
2675
2675
my @ operands := $ op . list;
2676
2676
unless + @ operands == 2 {
2677
- nqp ::die($ op ~ ' op requires two arguments' );
2677
+ nqp ::die(" The ' $ op ' op needs 2 arguments, got " ~ + @ operands );
2678
2678
}
2679
2679
my $ target := @ operands [0 ];
2680
2680
if try_get_bind_scope($ target ) -> $ bind_scope {
@@ -2740,7 +2740,7 @@ QAST::MASTOperations.add_core_op('locallifetime', -> $qastcomp, $op {
2740
2740
# XXX explicit takeclosure will go away under new model; for now, no-op it.
2741
2741
QAST ::MASTOperations. add_core_op(' takeclosure' , -> $ qastcomp , $ op {
2742
2742
unless + @ ($ op ) == 1 {
2743
- nqp ::die(' takeclosure op requires one argument' );
2743
+ nqp ::die(" The 'takeclosure' op needs 1 argument, got " ~ + @ ( $ op ) );
2744
2744
}
2745
2745
$ qastcomp . as_mast($ op [0 ])
2746
2746
});
@@ -2754,7 +2754,7 @@ QAST::MASTOperations.add_core_moarop_mapping('setdispatcherfor', 'setdispatcherf
2754
2754
QAST ::MASTOperations. add_core_op(' takedispatcher' , -> $ qastcomp , $ op {
2755
2755
my $ regalloc := $ * REGALLOC ;
2756
2756
unless nqp ::istype($ op [0 ], QAST ::SVal) {
2757
- nqp ::die(" takedispatcher must have a single QAST::SVal child" );
2757
+ nqp ::die(" The ' takedispatcher' op must have a single QAST::SVal child, got " ~ $ op [ 0 ] . HOW . name ( $ op [ 0 ]) );
2758
2758
}
2759
2759
my @ ops ;
2760
2760
my $ disp_reg := $ regalloc . fresh_register($ MVM_reg_obj );
@@ -2915,12 +2915,12 @@ sub resolve_condition_op($kind, $negated) {
2915
2915
$ kind == $ MVM_reg_num64 ?? ' unless_n' !!
2916
2916
$ kind == $ MVM_reg_str ?? ' unless_s0' !!
2917
2917
$ kind == $ MVM_reg_obj ?? ' unless_o' !!
2918
- nqp ::die(" unhandled kind $ kind" )
2918
+ nqp ::die(" Unhandled kind $ kind" )
2919
2919
!! $ kind == $ MVM_reg_int64 ?? ' if_i' !!
2920
2920
$ kind == $ MVM_reg_num64 ?? ' if_n' !!
2921
2921
$ kind == $ MVM_reg_str ?? ' if_s0' !!
2922
2922
$ kind == $ MVM_reg_obj ?? ' if_o' !!
2923
- nqp ::die(" unhandled kind $ kind" )
2923
+ nqp ::die(" Unhandled kind $ kind" )
2924
2924
}
2925
2925
2926
2926
sub push_op (@ dest , str $ op , * @ args ) {
0 commit comments