From fc149e22023f4017d2b71bd6c6818ea012358001 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Sun, 12 Jun 2022 11:10:53 +0200 Subject: [PATCH] Further simplify native binding check We only need the $expected variable if there is something that was expected. --- src/Perl6/bootstrap.c/BOOTSTRAP.nqp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Perl6/bootstrap.c/BOOTSTRAP.nqp b/src/Perl6/bootstrap.c/BOOTSTRAP.nqp index 4c6f9518d1f..1156f1a372b 100644 --- a/src/Perl6/bootstrap.c/BOOTSTRAP.nqp +++ b/src/Perl6/bootstrap.c/BOOTSTRAP.nqp @@ -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 @@ -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'"; }