Skip to content
Permalink
Browse files

Change some blocks returning True/False to use return value

In the hopes that these will one day optimize even better, cause it can
be observed from the code block that the return value is constant (rather
than monitoring return values as they are being returned).
  • Loading branch information...
lizmat committed Nov 1, 2018
1 parent 5598f37 commit 5f1a81e0fa9106dfdf9ca596daca83170213c688
Showing with 8 additions and 8 deletions.
  1. +1 −1 src/core/HyperSeq.pm6
  2. +1 −1 src/core/Iterable.pm6
  3. +1 −1 src/core/List.pm6
  4. +1 −1 src/core/Match.pm6
  5. +2 −2 src/core/Mu.pm6
  6. +1 −1 src/core/RaceSeq.pm6
  7. +1 −1 src/core/traits.pm6
@@ -34,7 +34,7 @@ my class HyperSeq does Iterable does Sequence {
RaceSeq.new(:$!configuration, :$!work-stage-head)
}

method is-lazy() { False }
method is-lazy(--> False) { }

multi method serial(HyperSeq:D:) { self.Seq }

@@ -100,7 +100,7 @@ my role Iterable {
$!iterator.push-exactly($target, $n);
}

method is-lazy() { True }
method is-lazy(--> True) { }
}
method lazy() {
# Return a Seq with an iterator wrapping this Iterable, claiming to
@@ -673,7 +673,7 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
)
}

multi method ACCEPTS(List:D: Iterable:U) { True }
multi method ACCEPTS(List:D: Iterable:U --> True) { }
multi method ACCEPTS(List:D: Iterable:D $topic) {
CATCH { default { return False } } # .elems on lazies throws
return True if nqp::eqaddr(self, nqp::decont($topic));
@@ -857,7 +857,7 @@ my class Match is Capture is Cool does NQPMatchRole {
}
proto method Bool(|) {*}
multi method Bool(Match:U:) { False }
multi method Bool(Match:U: --> False) { }
multi method Bool(Match:D:) { nqp::hllbool($!pos >= $!from) }
multi method Numeric(Match:D:) {
@@ -964,8 +964,8 @@ multi sub infix:<eqv>($?) { Bool::True }
multi sub infix:<eqv>(Any:U \a, Any:U \b) {
nqp::hllbool(nqp::eqaddr(nqp::decont(a),nqp::decont(b)))
}
multi sub infix:<eqv>(Any:D \a, Any:U \b) { False }
multi sub infix:<eqv>(Any:U \a, Any:D \b) { False }
multi sub infix:<eqv>(Any:D \a, Any:U \b --> False) { }
multi sub infix:<eqv>(Any:U \a, Any:D \b --> False) { }
multi sub infix:<eqv>(Any:D \a, Any:D \b) {
nqp::hllbool(
nqp::eqaddr(a,b)
@@ -37,7 +37,7 @@ my class RaceSeq does Iterable does Sequence {

method race(RaceSeq:D:) { self }

method is-lazy() { False }
method is-lazy(--> False) { }

multi method serial(RaceSeq:D:) { self.Seq }

@@ -453,7 +453,7 @@ multi sub trait_mod:<handles>(Attribute:D $target, $thunk) {
}
elsif nqp::istype($expr, HyperWhatever) {
$pkg.^add_fallback(
-> $obj, $name { True },
-> $, $ --> True { },
-> $obj, $name {
-> $self, |c {
$attr.get_value($self)."$name"(|c)

0 comments on commit 5f1a81e

Please sign in to comment.
You can’t perform that action at this time.