@@ -579,59 +579,63 @@ method routine_def($/) {
579
579
580
580
581
581
method method_def ($/ ) {
582
- if $ * PACKAGE-SETUP {
583
- # Set up block including adding self (invocant) parameter.
584
- my $ past := $ < blockoid > . ast;
585
- $ past . control(' return_pir' );
586
- $ past [0 ]. unshift ( PAST::Var. new ( : name(' self' ), : scope(' parameter' ) ) );
587
- $ past . symbol(' self' , : scope(' lexical' ) );
588
-
589
- # Install it where it should go (methods table / namespace).
590
- if $ < deflongname > {
591
- my $ name := ~ $ < deflongname > [0 ]. ast;
592
- $ past . name ($ name );
593
- $ * PACKAGE-SETUP . push (PAST::Op. new (
594
- : pasttype(' callmethod' ), : name($ * MULTINESS eq ' multi' ?? ' add_multi_method' !! ' add_method' ),
595
- PAST::Op. new (
596
- # XXX Should be nqpop at some point.
597
- : pirop(' get_how PP' ),
598
- PAST::Var. new ( : name(' type_obj' ), : scope(' register' ) )
599
- ),
600
- PAST::Var. new ( : name(' type_obj' ), : scope(' register' ) ),
601
- PAST::Val. new ( : value($ name ) ),
602
- PAST::Val. new ( : value($ past ) )
603
- ));
604
- }
605
- if $ * SCOPE eq ' our' {
606
- $ past . pirflags(' :nsentry' );
607
- }
582
+ # XXX Remove this when grammar switches over to using 6model.
583
+ unless $ * PACKAGE-SETUP {
584
+ return OLD_method_def($/ );
585
+ }
608
586
609
- $ past <block_past > := $ past ;
610
- make $ past ;
587
+ # Set up block including adding self (invocant) parameter.
588
+ my $ past := $ < blockoid > . ast;
589
+ $ past . control(' return_pir' );
590
+ $ past [0 ]. unshift ( PAST::Var. new ( : name(' self' ), : scope(' parameter' ) ) );
591
+ $ past . symbol(' self' , : scope(' lexical' ) );
592
+
593
+ # Install it where it should go (methods table / namespace).
594
+ if $ < deflongname > {
595
+ my $ name := ~ $ < deflongname > [0 ]. ast;
596
+ $ past . name ($ name );
597
+ $ * PACKAGE-SETUP . push (PAST::Op. new (
598
+ : pasttype(' callmethod' ), : name($ * MULTINESS eq ' multi' ?? ' add_multi_method' !! ' add_method' ),
599
+ PAST::Op. new (
600
+ # XXX Should be nqpop at some point.
601
+ : pirop(' get_how PP' ),
602
+ PAST::Var. new ( : name(' type_obj' ), : scope(' register' ) )
603
+ ),
604
+ PAST::Var. new ( : name(' type_obj' ), : scope(' register' ) ),
605
+ PAST::Val. new ( : value($ name ) ),
606
+ PAST::Val. new ( : value($ past ) )
607
+ ));
611
608
}
612
- else {
613
- my $ past := $ < blockoid > . ast;
614
- $ past . blocktype(' method' );
615
- if $ * SCOPE eq ' our' {
616
- $ past . pirflags(' :nsentry' );
617
- }
618
- $ past . control(' return_pir' );
619
- $ past [0 ]. unshift ( PAST::Op. new ( : inline(' .lex "self", self' ) ) );
620
- $ past . symbol(' self' , : scope(' lexical' ) );
621
- if $ < deflongname > {
622
- my $ name := ~ $ < deflongname > [0 ]. ast;
623
- $ past . name ($ name );
624
- }
625
- if $ * MULTINESS eq ' multi' { $ past . multi(). unshift (' _' ); }
626
- $ past <block_past > := $ past ;
627
- make $ past ;
609
+ if $ * SCOPE eq ' our' {
610
+ $ past . pirflags(' :nsentry' );
628
611
}
612
+
613
+ $ past <block_past > := $ past ;
614
+ make $ past ;
615
+ }
616
+
617
+ # XXX Toss this when grammar moves over to 6model.
618
+ sub OLD_method_def ($/ ) {
619
+ my $ past := $ < blockoid > . ast;
620
+ $ past . blocktype(' method' );
621
+ if $ * SCOPE eq ' our' {
622
+ $ past . pirflags(' :nsentry' );
623
+ }
624
+ $ past . control(' return_pir' );
625
+ $ past [0 ]. unshift ( PAST::Op. new ( : inline(' .lex "self", self' ) ) );
626
+ $ past . symbol(' self' , : scope(' lexical' ) );
627
+ if $ < deflongname > {
628
+ my $ name := ~ $ < deflongname > [0 ]. ast;
629
+ $ past . name ($ name );
630
+ }
631
+ if $ * MULTINESS eq ' multi' { $ past . multi(). unshift (' _' ); }
632
+ $ past <block_past > := $ past ;
629
633
if $ < trait > {
630
634
for $ < trait > { $ _ . ast()($/ ); }
631
635
}
636
+ make $ past ;
632
637
}
633
638
634
-
635
639
method signature ($/ ) {
636
640
my $ BLOCKINIT := @ BLOCK [0 ][0 ];
637
641
0 commit comments