Skip to content

Commit

Permalink
Add method language-revision
Browse files Browse the repository at this point in the history
This is one more of the 'bypass to the default candidate' methods.
Returns `nqp::null()` if no candidates are added yet.

Also took measures against possible incorrect choice of the default
candidate.
  • Loading branch information
vrurg committed Nov 19, 2020
1 parent b21dd02 commit 38bb244
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Perl6/Metamodel/ParametricRoleGroupHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,19 @@ class Perl6::Metamodel::ParametricRoleGroupHOW
$c.HOW.auth($c)
}

method language-revision($obj) {
my $c := self.'!get_default_candidate'($obj);
nqp::unless(nqp::isnull($c),
$c.HOW.language-revision($c),
nqp::null())
}

method !get_default_candidate($obj) {
self.'!get_nonsignatured_candidate'($obj) || @!candidates[0]
nqp::ifnull(self.'!get_nonsignatured_candidate'($obj),
nqp::if(
+@!candidates,
@!candidates[0],
nqp::null()))
}

method !get_nonsignatured_candidate($obj) {
Expand Down

0 comments on commit 38bb244

Please sign in to comment.