Skip to content
This repository
Browse code

Fix all tests which failed in zeroargs_subs_checking branch

  • Loading branch information...
commit 81b0439853acb4dc1cfabc3cbf404e5ca260d901 1 parent 1c33c8f
Léo Grange authored January 06, 2011
4  t/compilers/imcc/reg/alloc.t
@@ -26,8 +26,8 @@ lab:
26 26
 ex:
27 27
 .end
28 28
 .sub alligator
29  
-    get_params "0", $P0
30  
-    invokecc $P0
  29
+    .param pmc foo
  30
+    invokecc foo
31 31
 .end
32 32
 CODE
33 33
 Hi
5  t/compilers/imcc/syn/pcc.t
@@ -511,8 +511,13 @@ OUT
511 511
 
512 512
 my $too_many_args = <<'CODE';
513 513
 .sub main :main
  514
+    push_eh eh
514 515
     'foo'(_ARGS_)
  516
+    goto no_eh
  517
+eh:
  518
+    pop_eh
515 519
     say "didn't segfault"
  520
+no_eh:
516 521
 .end
517 522
 
518 523
 .sub foo
2  t/compilers/imcc/syn/subflags.t
@@ -121,10 +121,12 @@ test flags on PIR subs
121 121
 .end
122 122
 
123 123
 .sub 'xyz' :multi(Integer) :subid('above')
  124
+    .param pmc lure
124 125
     .return('xyz above')
125 126
 .end
126 127
 
127 128
 .sub 'xyz' :multi(String) :subid('below')
  129
+    .param pmc lure
128 130
     .return('xyz below')
129 131
 .end
130 132
 
15  t/compilers/imcc/syn/tail.t
@@ -48,9 +48,8 @@ pir_output_is( <<'CODE', <<'OUT', "tail call optimization, final position" );
48 48
 .end
49 49
 
50 50
 .sub _funcall
51  
-    .local pmc function
52  
-    .local pmc argv
53  
-    get_params "0,0x20", function, argv
  51
+    .param pmc function
  52
+    .param pmc argv :slurpy
54 53
     print "[doing _funcall]\n"
55 54
     $I33 = defined function
56 55
     if $I33 goto doit
@@ -64,9 +63,8 @@ doit:
64 63
 
65 64
 ## Return quotient and remainder as two integers.
66 65
 .sub _floor
67  
-    .local pmc arg1
68  
-    .local pmc arg2
69  
-    get_params "0,0", arg1, arg2
  66
+    .param pmc arg1
  67
+    .param pmc arg2
70 68
     $P1 = new 'Integer'
71 69
     $P1 = arg1 / arg2
72 70
     ## truncate.
@@ -80,9 +78,8 @@ doit:
80 78
 
81 79
 ## Return the sum and the two arguments as three integers.
82 80
 .sub _fib_step
83  
-    .local pmc arg1
84  
-    .local pmc arg2
85  
-    get_params "0,0", arg1, arg2
  81
+    .param pmc arg1
  82
+    .param pmc arg2
86 83
     $P1 = new 'Integer'
87 84
     $P1 = arg1 + arg2
88 85
     set_returns "0,0,0", $P1, arg1, arg2
2  t/oo/composition.t
@@ -46,12 +46,14 @@ Tests role composition in the OO implementation.
46 46
     .return('Snake!')
47 47
 .end
48 48
 .sub fire
  49
+    .param pmc self
49 50
     .return("You're FIRED!")
50 51
 .end
51 52
 .sub fire2
52 53
     .return('BURNINATION!')
53 54
 .end
54 55
 .sub give_payrise
  56
+    .param pmc self
55 57
     .return('You all get a pay rise of 0.0005%.')
56 58
 .end
57 59
 
31  t/oo/objects.t
@@ -263,11 +263,13 @@ Tests the object/class subsystem.
263 263
 .end
264 264
 
265 265
 .sub sayFoo31
  266
+    .param pmc self
266 267
     ok( 1, 'called method added before creating obj' )
267 268
 .end
268 269
 
269 270
 .namespace ['Bar31']
270 271
 .sub sayBar31
  272
+    .param pmc self
271 273
     ok( 1, 'called method added after created obj' )
272 274
 .end
273 275
 
@@ -1638,38 +1640,40 @@ end:
1638 1640
 
1639 1641
 # set(obj: Pvalue, Iattr_idx)
1640 1642
 .sub Foo54__set
1641  
-    get_params "0,0", $P5, $S4
  1643
+    .param pmc arg1
  1644
+    .param string arg2
1642 1645
     ok( 1, "in Foo54__set" )
1643 1646
     interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
1644  
-    setattribute $P2, $S4, $P5
  1647
+    setattribute $P2, arg2, arg1
1645 1648
     set_returns ""
1646 1649
     returncc
1647 1650
 .end
1648 1651
 
1649 1652
 # Pattr = get(obj: Iattr_idx)
1650 1653
 .sub Foo54__get
1651  
-    get_params "0", $S4
  1654
+    .param string arg
1652 1655
     ok( 1, "in Foo54__get" )
1653 1656
     interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
1654  
-    getattribute $P5, $P2, $S4
  1657
+    getattribute $P5, $P2, arg
1655 1658
     set_returns "0", $P5
1656 1659
     returncc
1657 1660
 .end
1658 1661
 
1659 1662
 .sub Bar54__set
1660  
-    get_params "0,0", $P5, $S4
  1663
+    .param pmc arg1
  1664
+    .param string arg2
1661 1665
     interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
1662 1666
     ok( 1, "in Bar54__set" )
1663  
-    setattribute $P2, $S4, $P5
  1667
+    setattribute $P2, arg2, arg1
1664 1668
     set_returns ""
1665 1669
     returncc
1666 1670
 .end
1667 1671
 
1668 1672
 .sub Bar54__get
1669  
-    get_params "0", $S4
  1673
+    .param string arg
1670 1674
     ok( 1, "in Bar54__get" )
1671 1675
     interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
1672  
-    getattribute $P5, $P2, $S4
  1676
+    getattribute $P5, $P2, arg
1673 1677
     set_returns "0", $P5
1674 1678
     returncc
1675 1679
 .end
@@ -1757,18 +1761,21 @@ end:
1757 1761
 
1758 1762
 # set(obj: Pvalue, SClass, Sattr)
1759 1763
 .sub set
1760  
-    get_params "0,0,0", $P5, $S4, $S5
  1764
+    .param pmc value
  1765
+    .param string classname
  1766
+    .param string attrname
1761 1767
     interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
1762  
-    setattribute $P2, $S5, $P5
  1768
+    setattribute $P2, attrname, value
1763 1769
     set_returns ""
1764 1770
     returncc
1765 1771
 .end
1766 1772
 
1767 1773
 # Pattr = get(obj: SClass, Sattr)
1768 1774
 .sub get
1769  
-    get_params "0,0", $S4, $S5
  1775
+    .param string classname
  1776
+    .param string attrname
1770 1777
     interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
1771  
-    getattribute $P5, $P2, $S5
  1778
+    getattribute $P5, $P2, attrname
1772 1779
     set_returns "0", $P5
1773 1780
     returncc
1774 1781
 .end
123  t/op/calling.t
@@ -267,8 +267,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "use it in PIR" );
267 267
     invokecc $P1
268 268
 .end
269 269
 .sub foo
270  
-    get_params "0", $P0
271  
-    print $P0
  270
+    .param pmc arg
  271
+    print arg
272 272
 .end
273 273
 CODE
274 274
 hello
@@ -341,8 +341,8 @@ pir_output_is( <<'CODE', <<'OUTPUT', "use it in PIR" );
341 341
     invokecc $P1
342 342
 .end
343 343
 .sub foo
344  
-    get_params "0", $P0
345  
-    print $P0
  344
+    .param pmc arg
  345
+    print arg
346 346
 .end
347 347
 CODE
348 348
 hello
@@ -358,14 +358,14 @@ pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - autobox" );
358 358
     invokecc $P1
359 359
 .end
360 360
 .sub foo
361  
-    get_params "0x20", $P0
362  
-    $S0 = $P0[0]
  361
+    .param pmc slurpy_arg :slurpy
  362
+    $S0 = slurpy_arg[0]
363 363
     print $S0
364 364
     print ' '
365  
-    $S0 = $P0[1]
  365
+    $S0 = slurpy_arg[1]
366 366
     print $S0
367 367
     print ' '
368  
-    $S0 = $P0[2]
  368
+    $S0 = slurpy_arg[2]
369 369
     print $S0
370 370
     print "\n"
371 371
 .end
@@ -419,14 +419,18 @@ pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - fetch" );
419 419
     invokecc $P10
420 420
 .end
421 421
 .sub foo
422  
-    get_params "0,0,0,0", $P0, $I0, $S0, $N0
423  
-    print $P0
  422
+    .param pmc arg_pmc
  423
+    .param int arg_int
  424
+    .param string arg_str
  425
+    .param num arg_num
  426
+
  427
+    print arg_pmc
424 428
     print ' '
425  
-    print $I0
  429
+    print arg_int
426 430
     print ' '
427  
-    print $S0
  431
+    print arg_str
428 432
     print ' '
429  
-    print $N0
  433
+    print arg_num
430 434
     print "\n"
431 435
     returncc
432 436
 .end
@@ -445,15 +449,16 @@ pir_error_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too few" );
445 449
     invokecc $P1
446 450
 .end
447 451
 .sub foo
448  
-    get_params "0,0", $P0, $P1
  452
+    .param pmc arg1
  453
+    .param pmc arg2
449 454
     print $P0
450 455
 .end
451 456
 CODE
452 457
 /too few positional arguments/
453 458
 OUTPUT
454 459
 
455  
-pir_output_like(
456  
-    <<'CODE', <<'OUTPUT', "argc mismatch, too many - no getparams", todo => 'no get_params at all' );
  460
+pir_error_output_like(
  461
+    <<'CODE', <<'OUTPUT', "argc mismatch, too many - no getparams");
457 462
 .sub main :main
458 463
     .include "errors.pasm"
459 464
     errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
@@ -463,7 +468,7 @@ pir_output_like(
463 468
     print "nada"
464 469
 .end
465 470
 CODE
466  
-/too many arguments passed/
  471
+/too many positional arguments/
467 472
 OUTPUT
468 473
 
469 474
 pir_error_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too many - force get_params" );
@@ -507,15 +512,9 @@ pir_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too many - catch exceptio
507 512
     errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
508 513
     $P0 = new 'String'
509 514
     $P0 = "hello\n"
510  
-    find_name $P1, "foo"
511  
-    set_args "0,0", $P0, 77
512  
-    invokecc $P1
513  
-.end
514  
-.sub foo
515 515
     push_eh arg_handler
516  
-    get_params "0", $P0
517  
-    print $P0
518  
-    print "never\n"
  516
+    foo($P0, 77)
  517
+    goto no_eh
519 518
 arg_handler:
520 519
     get_results "0", $P1
521 520
     $S0 = $P1
@@ -524,6 +523,13 @@ arg_handler:
524 523
 #    $S1 = typeof $P1
525 524
 #    print "\nexception type: "
526 525
 #    print $S1
  526
+no_eh:
  527
+.end
  528
+.sub foo
  529
+    .param pmc arg
  530
+    print arg
  531
+    print "never\n"
  532
+
527 533
 .end
528 534
 CODE
529 535
 /^caught: too many positional arguments/
@@ -540,9 +546,11 @@ pir_output_is( <<'CODE', <<'OUTPUT', "argc mismatch, optional" );
540 546
     invokecc $P1
541 547
 .end
542 548
 .sub foo
543  
-    get_params "0,0x80,0x100", $P0, $P1, $I0
544  
-    print $P0
545  
-    if_null $P1, ok
  549
+    .param pmc arg1
  550
+    .param pmc arg2 :optional
  551
+    .param int flag_arg2 :opt_flag
  552
+    print arg1
  553
+    if_null arg2, ok
546 554
     print "not "
547 555
 ok:
548 556
     print "ok\n"
@@ -646,9 +654,9 @@ pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 2 - pass arg" );
646 654
     tailcall b
647 655
 .end
648 656
 .sub bar
649  
-    get_params "0", $S0
  657
+    .param string arg
650 658
     print "bar\n"
651  
-    print $S0
  659
+    print arg
652 660
     set_returns "0", "bar_ret\n"
653 661
     returncc
654 662
 .end
@@ -675,9 +683,9 @@ pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 3 - pass arg" );
675 683
     tailcall b
676 684
 .end
677 685
 .sub bar
678  
-    get_params "0", $S0
  686
+    .param string arg
679 687
     print "bar\n"
680  
-    print $S0
  688
+    print arg
681 689
     set_returns "0", "bar_ret\n"
682 690
     returncc
683 691
 .end
@@ -717,8 +725,9 @@ pir_output_is( <<'CODE', <<'OUTPUT', "optional args" );
717 725
     invokecc $P1
718 726
 .end
719 727
 .sub foo
720  
-    get_params "0x80, 0x100", $P1, $I0
721  
-    unless_null $P1, ok
  728
+    .param pmc arg :optional
  729
+    .param int flag_arg :opt_flag
  730
+    unless_null arg, ok
722 731
     print "not "
723 732
 ok:
724 733
     print "ok\n"
@@ -735,10 +744,11 @@ pir_output_is( <<'CODE', <<'OUTPUT', "pir uses no ops" );
735 744
 .end
736 745
 
737 746
 .sub foo
738  
-    get_params "0, 0", $I16, $I17
739  
-    print $I16
  747
+    .param int arg1
  748
+    .param int arg2
  749
+    print arg1
740 750
     print "\n"
741  
-    print $I17
  751
+    print arg2
742 752
     print "\n"
743 753
     set_returns ""
744 754
     returncc
@@ -808,30 +818,36 @@ pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - native" );
808 818
     foo_string(42, "42", 42.20)
809 819
 .end
810 820
 .sub foo_int
811  
-    get_params "0,0,0", $I0, $I1, $I2
812  
-    print $I0
  821
+    .param int arg1
  822
+    .param int arg2
  823
+    .param int arg3
  824
+    print arg1
813 825
     print ' '
814  
-    print $I1
  826
+    print arg2
815 827
     print ' '
816  
-    print $I2
  828
+    print arg3
817 829
     print "\n"
818 830
 .end
819 831
 .sub foo_float
820  
-    get_params "0,0,0", $N0, $N1, $N2
821  
-    print $N0
  832
+    .param num arg1
  833
+    .param num arg2
  834
+    .param num arg3
  835
+    print arg1
822 836
     print ' '
823  
-    print $N1
  837
+    print arg2
824 838
     print ' '
825  
-    print $N2
  839
+    print arg3
826 840
     print "\n"
827 841
 .end
828 842
 .sub foo_string
829  
-    get_params "0,0,0", $S0, $S1, $S2
830  
-    print $S0
  843
+    .param string arg1
  844
+    .param string arg2
  845
+    .param string arg3
  846
+    print arg1
831 847
     print ' '
832  
-    print $S1
  848
+    print arg2
833 849
     print ' '
834  
-    print $S2
  850
+    print arg3
835 851
     print "\n"
836 852
 .end
837 853
 CODE
@@ -1353,7 +1369,10 @@ pir_output_is( <<'CODE', <<'OUTPUT', "tailcall - overlapping Ix" );
1353 1369
     tailcall b
1354 1370
 .end
1355 1371
 .sub bar
1356  
-    get_params "0,0", $I0, $I1
  1372
+    .param int arg1
  1373
+    .param int arg2
  1374
+    $I0 = arg1
  1375
+    $I1 = arg2
1357 1376
     .return ($I0, $I1)
1358 1377
 .end
1359 1378
 CODE
@@ -2451,7 +2470,7 @@ CODE
2451 2470
 2
2452 2471
 OUTPUT
2453 2472
 
2454  
-pir_error_output_like( <<'CODE', <<'OUTPUT', "arg mismatch with no params", todo=> 'TT #1033' );
  2473
+pir_error_output_like( <<'CODE', <<'OUTPUT', "arg mismatch with no params");
2455 2474
 .sub main :main
2456 2475
   foo(1)
2457 2476
 .end
@@ -2459,7 +2478,7 @@ pir_error_output_like( <<'CODE', <<'OUTPUT', "arg mismatch with no params", todo
2459 2478
 .sub foo
2460 2479
 .end
2461 2480
 CODE
2462  
-/too many arguments passed\(1\) - 0 params expected/
  2481
+/too many positional arguments: 1 passed, 0 expected/
2463 2482
 OUTPUT
2464 2483
 
2465 2484
 # See Rakudo queue http://rt.perl.org/rt3/Ticket/Display.html?id=62730
4  t/pmc/class.t
@@ -398,6 +398,8 @@ t_class_meth:
398 398
     ok($I0, 'add_vtable_override() with invalid name fails')
399 399
 .end
400 400
 .sub 'new_add_role'
  401
+    .param pmc lure1
  402
+    .param pmc lure2
401 403
     ok(1, 'overridden vtable method called')
402 404
 .end
403 405
 
@@ -817,10 +819,12 @@ t_class_meth:
817 819
 .end
818 820
 
819 821
 .sub 'foo1'
  822
+    .param pmc self
820 823
     .return(1)
821 824
 .end
822 825
 
823 826
 .sub 'foo2'
  827
+    .param pmc self
824 828
     .return(2)
825 829
 .end
826 830
 
12  t/pmc/multidispatch.t
@@ -1025,11 +1025,14 @@ pir_output_is( <<'CODE', <<'OUTPUT', "multisub w/o .HLL" );
1025 1025
 .end
1026 1026
 
1027 1027
 .sub 'foo' :multi(Integer)
  1028
+    .param pmc lure
1028 1029
     print "foo(Integer)\n"
1029 1030
     .return (0)
1030 1031
 .end
1031 1032
 
1032 1033
 .sub 'foo' :multi(ResizablePMCArray, _)
  1034
+    .param pmc lure1
  1035
+    .param pmc lure2
1033 1036
     print "foo(ResizablePMCArray,_)\n"
1034 1037
     .return (0)
1035 1038
 .end
@@ -1053,11 +1056,14 @@ pir_output_is( <<'CODE', <<'OUTPUT', "multisub w/ .HLL, rt #39161" );
1053 1056
 .end
1054 1057
 
1055 1058
 .sub 'foo' :multi(Integer)
  1059
+    .param pmc lure
1056 1060
     print "foo(Integer)\n"
1057 1061
     .return (0)
1058 1062
 .end
1059 1063
 
1060 1064
 .sub 'foo' :multi(ResizablePMCArray, _)
  1065
+    .param pmc lure1
  1066
+    .param pmc lure2
1061 1067
     print "foo(ResizablePMCArray,_)\n"
1062 1068
     .return (0)
1063 1069
 .end
@@ -1089,10 +1095,12 @@ pir_output_is( <<'CODE', <<'OUTPUT', "multisub w/ flatten" );
1089 1095
 .end
1090 1096
 
1091 1097
 .sub 'foo' :multi(Integer)
  1098
+    .param pmc lure
1092 1099
     print "foo(Integer)\n"
1093 1100
 .end
1094 1101
 
1095 1102
 .sub 'foo' :multi(String)
  1103
+    .param pmc lure
1096 1104
     print "foo(String)\n"
1097 1105
 .end
1098 1106
 CODE
@@ -1133,10 +1141,12 @@ pir_output_is( <<'CODE', <<'OUTPUT', "keyed class name and multi" );
1133 1141
 .end
1134 1142
 
1135 1143
 .sub 'foo' :multi( [ 'Some'; 'Class' ])
  1144
+    .param pmc lure
1136 1145
     print "Called multi for class\n"
1137 1146
 .end
1138 1147
 
1139 1148
 .sub 'foo' :multi(_)
  1149
+    .param pmc lure
1140 1150
     print "Called wrong multi\n"
1141 1151
 .end
1142 1152
 CODE
@@ -1328,9 +1338,11 @@ pir_output_is( <<'CODE', <<'OUTPUT', "multi-dispatch on PMCNULL" );
1328 1338
     foo($P0)
1329 1339
 .end
1330 1340
 .sub foo :multi(String)
  1341
+    .param pmc lure
1331 1342
     say "string"
1332 1343
 .end
1333 1344
 .sub foo :multi(_)
  1345
+    .param pmc lure
1334 1346
     say "any"
1335 1347
 .end
1336 1348
 CODE
3  t/pmc/namespace-subs.t
@@ -148,12 +148,15 @@ specified behavior for :method, :vtable, :nsentry, and :anon.
148 148
 
149 149
 .namespace ['MultiSubTest']
150 150
 .sub 'multisubtest' :multi(int)
  151
+    .param pmc lure
151 152
    .return("called int variant")
152 153
 .end
153 154
 .sub 'multisubtest' :multi(string)
  155
+    .param pmc lure
154 156
    .return("called string variant")
155 157
 .end
156 158
 .sub 'multisubtest' :anon :multi(num)
  159
+    .param pmc lure
157 160
    .return("called num variant")
158 161
 .end
159 162
 
11  t/pmc/nci.t
@@ -1666,21 +1666,22 @@ ERROR:
1666 1666
 .end
1667 1667
 
1668 1668
 .sub _call_back
1669  
-  get_params "0,0", $P5, $P6
  1669
+  .param pmc arg1
  1670
+  .param pmc arg2
1670 1671
   print "in callback\n"
1671 1672
   print "user data: "
1672  
-  print $P5
  1673
+  print arg1
1673 1674
   print "\n"
1674 1675
 
1675  
-  # P6 is a UnManagedStruct PMC containing a pointer to an integer
  1676
+  # arg2 is a UnManagedStruct PMC containing a pointer to an integer
1676 1677
   new $P2, ['ResizablePMCArray']
1677 1678
   push $P2, .DATATYPE_INT
1678 1679
   push $P2, 0
1679 1680
   push $P2, 0
1680  
-  assign $P6, $P2
  1681
+  assign arg2, $P2
1681 1682
 
1682 1683
   # print referenced integer in libnci_test.so
1683  
-  $I17 = $P6[0]
  1684
+  $I17 = arg2[0]
1684 1685
   print "external data: "
1685 1686
   print $I17
1686 1687
   print "\n"
2  t/pmc/object-meths.t
@@ -747,6 +747,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "method cache invalidation" );
747 747
     print o
748 748
 .end
749 749
 .sub ok2
  750
+    .param pmc self
750 751
     .return("ok 2\n")
751 752
 .end
752 753
 .namespace [ "Foo" ]
@@ -1070,6 +1071,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "overloading find_method vtable" );
1070 1071
 .end
1071 1072
 
1072 1073
 .sub foo
  1074
+  .param pmc lure
1073 1075
   print "foo was called\n"
1074 1076
 .end
1075 1077
 

0 notes on commit 81b0439

Please sign in to comment.
Something went wrong with that request. Please try again.