@@ -85,7 +85,7 @@ my class MASTCompilerInstance {
85
85
elsif $ kind == $ MVM_reg_uint32 { @ arr := @ ! uint32s ; $ type := uint32 }
86
86
elsif $ kind == $ MVM_reg_uint16 { @ arr := @ ! uint16s ; $ type := uint16 }
87
87
elsif $ kind == $ MVM_reg_uint8 { @ arr := @ ! uint8s ; $ type := uint8 }
88
- else { nqp ::die(" unhandled reg kind $ kind" ) }
88
+ else { nqp ::die(" Unhandled reg kind $ kind" ) }
89
89
90
90
my $ reg ;
91
91
if nqp :: elems (@ arr ) && ! $ new {
@@ -119,7 +119,7 @@ my class MASTCompilerInstance {
119
119
return nqp :: push (@ ! uint32s , $ reg ) if $ kind == $ MVM_reg_uint32 ;
120
120
return nqp :: push (@ ! uint16s , $ reg ) if $ kind == $ MVM_reg_uint16 ;
121
121
return nqp :: push (@ ! uint8s , $ reg ) if $ kind == $ MVM_reg_uint8 ;
122
- nqp ::die(" unhandled reg kind $ kind" );
122
+ nqp ::die(" Unhandled reg kind $ kind" );
123
123
}
124
124
}
125
125
@@ -263,7 +263,7 @@ my class MASTCompilerInstance {
263
263
264
264
method return_kind (* @ value ) {
265
265
if @ value {
266
- nqp ::die(" inconsistent immediate block return type" )
266
+ nqp ::die(" Inconsistent immediate block return type" )
267
267
if ($ ! qast . blocktype eq ' immediate' || $ ! qast . blocktype eq ' immediate_static' ) &&
268
268
nqp :: defined ($ ! return_kind ) && @ value [0 ] != $ ! return_kind ;
269
269
$ ! return_kind := @ value [0 ];
@@ -305,7 +305,7 @@ my class MASTCompilerInstance {
305
305
$ out ++ ;
306
306
$ block := $ block . outer;
307
307
}
308
- nqp ::die(" could not resolve lexical $ name" );
308
+ nqp ::die(" Could not resolve lexical $ name" );
309
309
}
310
310
311
311
method capture_inner ($ block ) {
@@ -737,9 +737,14 @@ my class MASTCompilerInstance {
737
737
proto method compile_node ($ node , : $ want ) { * }
738
738
739
739
multi method compile_node (QAST ::CompUnit $ cu , : $ want ) {
740
- # Should have a single child which is the outer block.
741
- if + @ ($ cu ) != 1 || ! nqp ::istype($ cu [0 ], QAST ::Block) {
742
- nqp ::die(" QAST::CompUnit should have one child that is a QAST::Block" );
740
+ # Should have a single child
741
+ if + @ ($ cu ) != 1 {
742
+ nqp ::die(" QAST::CompUnit should have 1 child, got " ~ + @ ($ cu ));
743
+ }
744
+
745
+ # Which is the outer block.
746
+ if ! nqp ::istype($ cu [0 ], QAST ::Block) {
747
+ nqp ::die(" QAST::CompUnit should have 1 child that is a QAST::Block, got " ~ $ cu [0 ]. HOW . name ($ cu [0 ]));
743
748
}
744
749
745
750
# Set HLL and serialization context.
@@ -1090,7 +1095,7 @@ my class MASTCompilerInstance {
1090
1095
# build up instructions to bind the params
1091
1096
for $ block . params -> $ var {
1092
1097
my $ scope := $ var . scope;
1093
- nqp ::die(" Param scope must be 'local' or 'lexical'" )
1098
+ nqp ::die(" Param scope must be 'local' or 'lexical', got ' $ scope ' " )
1094
1099
if $ scope ne ' lexical' && $ scope ne ' local' ;
1095
1100
1096
1101
my $ param_kind := self . type_to_register_kind($ var . returns );
@@ -1118,7 +1123,7 @@ my class MASTCompilerInstance {
1118
1123
my $ name := $ var . named;
1119
1124
if nqp ::islist($ name ) {
1120
1125
unless nqp :: elems ($ name ) == 2 {
1121
- nqp ::die(" Can only support a single fallback name for a named parameter" );
1126
+ nqp ::die(" Can only support 1 fallback name for a named parameter, ' " ~ $ name [ 0 ] ~ " ' has " ~ nqp :: elems ( $ name ) - 1 );
1122
1127
}
1123
1128
$ val := MAST::SVal. new ( : value($ name [0 ]) );
1124
1129
$ val2 := MAST::SVal. new ( : value($ name [1 ]) );
@@ -1315,7 +1320,7 @@ my class MASTCompilerInstance {
1315
1320
1316
1321
multi method compile_node (QAST ::Stmts $ node , : $ want ) {
1317
1322
my $ resultchild := $ node . resultchild;
1318
- nqp ::die(" resultchild out of range" )
1323
+ nqp ::die(" resultchild out of range, max allowed is " ~ + @ ( $ node ) - 1 ~ " , got $ resultchild " )
1319
1324
if (nqp :: defined ($ resultchild ) && $ resultchild >= + @ ($ node ));
1320
1325
self . compile_all_the_stmts(@ ($ node ), $ resultchild )
1321
1326
}
@@ -1335,7 +1340,7 @@ my class MASTCompilerInstance {
1335
1340
my % * STMTTEMPS := % stmt_temps ;
1336
1341
my $ * INSTMT := 1 ;
1337
1342
my $ resultchild := $ node . resultchild;
1338
- nqp ::die(" resultchild out of range" )
1343
+ nqp ::die(" resultchild out of range, max allowed is " ~ + @ ( $ node ) - 1 ~ " , got $ resultchild " )
1339
1344
if (nqp :: defined ($ resultchild ) && $ resultchild >= + @ ($ node ));
1340
1345
self . compile_all_the_stmts(@ ($ node ), $ resultchild );
1341
1346
}
@@ -1429,7 +1434,7 @@ my class MASTCompilerInstance {
1429
1434
}
1430
1435
1431
1436
sub check_kinds ($ a , $ b ) {
1432
- nqp ::die(" register types $ a and $ b don't match" ) unless $ a == $ b ;
1437
+ nqp ::die(" Register types $ a and $ b don't match" ) unless $ a == $ b ;
1433
1438
}
1434
1439
1435
1440
my @ lex_n_opnames := [
@@ -1545,7 +1550,7 @@ my class MASTCompilerInstance {
1545
1550
}
1546
1551
elsif $ decl eq ' static' {
1547
1552
if $ scope ne ' lexical' {
1548
- nqp ::die(" Can only use 'static' decl with scope 'lexical'" );
1553
+ nqp ::die(" Can only use 'static' decl with scope 'lexical', got scope ' $ scope ' " );
1549
1554
}
1550
1555
$ * BLOCK . add_lexical($ node , : is_static);
1551
1556
}
@@ -1557,12 +1562,12 @@ my class MASTCompilerInstance {
1557
1562
$ * BLOCK . add_lexical($ node , : is_cont);
1558
1563
}
1559
1564
else {
1560
- nqp ::die(" Can only use 'contvar' decl with scope 'lexical' or 'local'" );
1565
+ nqp ::die(" Can only use 'contvar' decl with scope 'lexical' or 'local', got scope ' $ scope ' " );
1561
1566
}
1562
1567
}
1563
1568
elsif $ decl eq ' statevar' {
1564
1569
if $ scope ne ' lexical' {
1565
- nqp ::die(" Can only use 'statevar' decl with scope 'lexical'" );
1570
+ nqp ::die(" Can only use 'statevar' decl with scope 'lexical', got scope ' $ scope ' " );
1566
1571
}
1567
1572
$ * BLOCK . add_lexical($ node , : is_state);
1568
1573
}
@@ -1789,7 +1794,7 @@ my class MASTCompilerInstance {
1789
1794
# Ensure we have object and class handle.
1790
1795
my @ args := $ node . list();
1791
1796
if + @ args != 2 {
1792
- nqp ::die(" An attribute lookup needs an object and a class handle" );
1797
+ nqp ::die(" An attribute lookup needs 2 args ( an object and a class handle), got " ~ + @ args );
1793
1798
}
1794
1799
1795
1800
# Compile object and handle.
@@ -1842,7 +1847,7 @@ my class MASTCompilerInstance {
1842
1847
# Ensure we have object and class handle, and aren't binding.
1843
1848
my @ args := $ node . list();
1844
1849
if + @ args != 2 {
1845
- nqp ::die(" An attribute reference needs an object and a class handle" );
1850
+ nqp ::die(" An attribute reference needs 2 args ( an object and a class handle), got " ~ + @ args );
1846
1851
}
1847
1852
if $ * BINDVAL {
1848
1853
nqp ::die(" Cannot bind to QAST::Var '{ $ name } ' with scope attributeref" );
@@ -1930,10 +1935,10 @@ my class MASTCompilerInstance {
1930
1935
if $ op . op eq ' const' && nqp ::existskey(% const_map , $ op . name ) {
1931
1936
return MAST::IVal. new ( : value(% const_map {$ op . name }) );
1932
1937
}
1933
- nqp ::die(" expected QAST constant; got op " ~ $ op . op);
1938
+ nqp ::die(" Expected QAST constant, got op ' " ~ $ op . op ~ " ' " );
1934
1939
}
1935
1940
multi method as_mast_constant (QAST ::Node $ qast ) {
1936
- nqp ::die(" expected QAST constant; didn't get one " );
1941
+ nqp ::die(" Expected QAST constant, got QAST::Node " );
1937
1942
}
1938
1943
1939
1944
multi method compile_node (QAST ::Want $ node , : $ want ) {
@@ -2059,7 +2064,7 @@ my class MASTCompilerInstance {
2059
2064
elsif $ size == 32 { $ MVM_reg_uint32 }
2060
2065
elsif $ size == 16 { $ MVM_reg_uint16 }
2061
2066
elsif $ size == 8 { $ MVM_reg_uint8 }
2062
- else { nqp ::die(" Unknown int size $ size" ) }
2067
+ else { nqp ::die(" Unknown uint size $ size" ) }
2063
2068
}
2064
2069
else {
2065
2070
if $ size == 64 { $ MVM_reg_int64 }
0 commit comments