@@ -16,19 +16,20 @@ my class NQPMu {
16
16
my $ i := 0 ;
17
17
while $ i < $ count {
18
18
my $ task := nqp ::atpos($ build_plan , $ i );
19
+ my int $ code := nqp ::atpos($ task , 0 );
19
20
$ i := $ i + 1 ;
20
- if nqp ::iseq_i(nqp ::atpos( $ task , 0 ) , 0 ) {
21
+ if nqp ::iseq_i($ code , 0 ) {
21
22
# Custom BUILD call.
22
23
nqp ::atpos($ task , 1 )(self , | % attrinit );
23
24
}
24
- elsif nqp ::iseq_i(nqp ::atpos( $ task , 0 ) , 1 ) {
25
+ elsif nqp ::iseq_i($ code , 1 ) {
25
26
# See if we have a value to initialize this attr with.
26
27
my $ key_name := nqp ::atpos($ task , 2 );
27
28
if nqp ::existskey(% attrinit , $ key_name ) {
28
29
nqp ::bindattr(self , nqp ::atpos($ task , 1 ), nqp ::atpos_s($ task , 3 ), % attrinit {$ key_name });
29
30
}
30
31
}
31
- elsif nqp ::iseq_i(nqp ::atpos( $ task , 0 ) , 2 ) {
32
+ elsif nqp ::iseq_i($ code , 2 ) {
32
33
# See if we have a value to initialize this attr with;
33
34
# if not, set it to an empty array.
34
35
my $ key_name := nqp ::atpos($ task , 2 );
@@ -39,7 +40,7 @@ my class NQPMu {
39
40
nqp ::bindattr(self , nqp ::atpos($ task , 1 ), nqp ::atpos_s($ task , 3 ), nqp ::list());
40
41
}
41
42
}
42
- elsif nqp ::iseq_i(nqp ::atpos( $ task , 0 ) , 3 ) {
43
+ elsif nqp ::iseq_i($ code , 3 ) {
43
44
# See if we have a value to initialize this attr with;
44
45
# if not, set it to an empty array.
45
46
my $ key_name := nqp ::atpos($ task , 2 );
@@ -50,13 +51,13 @@ my class NQPMu {
50
51
nqp ::bindattr(self , nqp ::atpos($ task , 1 ), nqp ::atpos_s($ task , 3 ), nqp ::hash());
51
52
}
52
53
}
53
- # Uncomment if we get attribute initialization closures in NQP.
54
- # elsif nqp::iseq_i( nqp::atpos($task, 0 ), 4 ) {
55
- # unless nqp::attrinited (self, nqp::atpos($task, 1), nqp::atpos($task, 2)) {
56
- # nqp::bindattr(self, nqp::atpos($task, 1), nqp::atpos($task, 2) ,
57
- # nqp::atpos($task, 3)(self, $attr ));
58
- # }
59
- # }
54
+ elsif nqp ::iseq_i( $ code , 4 ) {
55
+ unless nqp ::attrinited( self , nqp ::atpos($ task , 1 ), nqp ::atpos( $ task , 2 ) ) {
56
+ nqp ::bindattr (self , nqp ::atpos($ task , 1 ), nqp ::atpos($ task , 2 ),
57
+ nqp ::atpos($ task , 3 )( self ,
58
+ nqp ::getattr( self , nqp :: atpos($ task , 1 ), nqp ::atpos( $ task , 2 )) ));
59
+ }
60
+ }
60
61
else {
61
62
nqp ::die(" Invalid BUILDALLPLAN" );
62
63
}
0 commit comments