Skip to content

Commit

Permalink
Make task[2] always contain the full attribute name
Browse files Browse the repository at this point in the history
To make the first 3 values of the task in the BUILDALLPLAN always
the same: 0 = type of action, 1 = object type, 2 = full attribute name.

This makes refactoring the BUILDPLAN logic easier.
  • Loading branch information
lizmat committed Sep 24, 2017
1 parent b02da4d commit ebd6440
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Metamodel/BUILDPLAN.nqp
Expand Up @@ -58,8 +58,8 @@ role Perl6::Metamodel::BUILDPLAN {
nqp::push(@plan,[
nqp::add_i(0,nqp::objprimspec($_.type)),
$obj,
nqp::substr((my $attr_name := $_.name), 2),
$attr_name
$_.name,
nqp::substr($_.name, 2)
]);
}
}
Expand Down
40 changes: 20 additions & 20 deletions src/core/Mu.pm
Expand Up @@ -174,25 +174,25 @@ Perhaps it can be found at https://docs.perl6.org/type/$name"
nqp::if( # >0
nqp::isle_i($code,3),
nqp::if( # 1|2|3
nqp::existskey($init,nqp::atpos($task,2)),
nqp::existskey($init,nqp::atpos($task,3)),
nqp::if( # can initialize
nqp::iseq_i($code,1),
nqp::bindattr_i(self, # 1
nqp::atpos($task,1),
nqp::atpos($task,3),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,2)))
nqp::atpos($task,2),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,3)))
),
nqp::if(
nqp::iseq_i($code,2),
nqp::bindattr_n(self, # 2
nqp::atpos($task,1),
nqp::atpos($task,3),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,2)))
nqp::atpos($task,2),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,3)))
),
nqp::bindattr_s(self, # 3
nqp::atpos($task,1),
nqp::atpos($task,3),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,2)))
nqp::atpos($task,2),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,3)))
)
)
)
Expand Down Expand Up @@ -280,9 +280,9 @@ Perhaps it can be found at https://docs.perl6.org/type/$name"
))))))),

nqp::if( # 0
nqp::existskey($init,nqp::atpos($task,2)),
(nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,3))
= %attrinit.AT-KEY(nqp::atpos($task,2))),
nqp::existskey($init,nqp::atpos($task,3)),
(nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,2))
= %attrinit.AT-KEY(nqp::atpos($task,3))),
)
)
)
Expand Down Expand Up @@ -320,25 +320,25 @@ Perhaps it can be found at https://docs.perl6.org/type/$name"
nqp::if( # >0
nqp::isle_i($code,3),
nqp::if( # 1|2|3
nqp::existskey($init,nqp::atpos($task,2)),
nqp::existskey($init,nqp::atpos($task,3)),
nqp::if( # can initialize
nqp::iseq_i($code,1),
nqp::bindattr_i(self, # 1
nqp::atpos($task,1),
nqp::atpos($task,3),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,2)))
nqp::atpos($task,2),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,3)))
),
nqp::if(
nqp::iseq_i($code,2),
nqp::bindattr_n(self, # 2
nqp::atpos($task,1),
nqp::atpos($task,3),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,2)))
nqp::atpos($task,2),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,3)))
),
nqp::bindattr_s(self, # 3
nqp::atpos($task,1),
nqp::atpos($task,3),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,2)))
nqp::atpos($task,2),
nqp::decont(%attrinit.AT-KEY(nqp::atpos($task,3)))
)
)
)
Expand Down Expand Up @@ -451,9 +451,9 @@ Perhaps it can be found at https://docs.perl6.org/type/$name"
)))))))),

nqp::if( # 0
nqp::existskey($init,nqp::atpos($task,2)),
(nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,3))
= %attrinit.AT-KEY(nqp::atpos($task,2))),
nqp::existskey($init,nqp::atpos($task,3)),
(nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,2))
= %attrinit.AT-KEY(nqp::atpos($task,3))),
)
)
)
Expand Down

0 comments on commit ebd6440

Please sign in to comment.