Skip to content

Commit

Permalink
Further simplify native binding check
Browse files Browse the repository at this point in the history
We only need the $expected variable if there is something that was
expected.
  • Loading branch information
lizmat committed Jun 12, 2022
1 parent 750487c commit fc149e2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Perl6/bootstrap.c/BOOTSTRAP.nqp
Expand Up @@ -221,7 +221,7 @@ my class Binder {
my int $is_rw := $flags +& $SIG_ELEM_IS_RW;
if $is_rw && $desired_native {
if $got_native {
my $expected := $desired_native == $SIG_ELEM_NATIVE_INT_VALUE
if $desired_native == $SIG_ELEM_NATIVE_INT_VALUE
&& !nqp::iscont_i($oval)
?? "int"
!! $desired_native == $SIG_ELEM_NATIVE_UINT_VALUE
Expand All @@ -232,8 +232,7 @@ my class Binder {
?? "num"
!! !nqp::iscont_s($oval) # SIG_ELEM_NATIVE_STR_VALUE
?? "str"
!! "";
if $expected {
!! 0 -> $expected {
if nqp::defined($error) {
$error[0] := "Expected a modifiable native $expected argument for '$varname'";
}
Expand Down

0 comments on commit fc149e2

Please sign in to comment.