Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Parameter.ACCEPTS a bit smarter
- non-optional is tighter than optional
- non-slurpy is tighter than slurpy

All part of a cunning plan to make Signature.ACCEPTS a lot simpler.
  • Loading branch information
lizmat committed Mar 9, 2016
1 parent 693be1d commit 4f5831f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/core/Parameter.pm
Expand Up @@ -185,6 +185,26 @@ my class Parameter { # declared in BOOTSTRAP
nqp::bitand_i($!flags,$SIG_ELEM_IS_RW),
nqp::bitand_i($oflags,$SIG_ELEM_IS_RW))

# other is optional, or both are optional
&& nqp::isle_i(
nqp::bitand_i($oflags,$SIG_ELEM_IS_OPTIONAL),
nqp::bitand_i($!flags,$SIG_ELEM_IS_OPTIONAL))

# other is slurpy positional, or both are slurpy positional
&& nqp::isle_i(
nqp::bitand_i($oflags,$SIG_ELEM_SLURPY_POS),
nqp::bitand_i($!flags,$SIG_ELEM_SLURPY_POS))

# other is slurpy named, or both are slurpy named
&& nqp::isle_i(
nqp::bitand_i($oflags,$SIG_ELEM_SLURPY_NAMED),
nqp::bitand_i($!flags,$SIG_ELEM_SLURPY_NAMED))

# other is slurpy one arg, or both are slurpy one arg
&& nqp::isle_i(
nqp::bitand_i($oflags,$SIG_ELEM_SLURPY_ONEARG),
nqp::bitand_i($!flags,$SIG_ELEM_SLURPY_ONEARG))

# here is part of MMD, or both are part of MMD
&& nqp::isle_i(
nqp::bitand_i($!flags,$SIG_ELEM_MULTI_INVOCANT),
Expand Down

0 comments on commit 4f5831f

Please sign in to comment.