Skip to content

Commit

Permalink
Make Supply.Supply do the right thing
Browse files Browse the repository at this point in the history
This also involved making .Supply a multi.  This breaks 2 questionable
spectests.
  • Loading branch information
lizmat committed Jun 11, 2017
1 parent 5c56e9e commit 52d3957
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/core/Any.pm
Expand Up @@ -453,7 +453,8 @@ my class Any { # declared in BOOTSTRAP
multi method MixHash() { MixHash.new-from-pairs(self.list) }

# XXX GLR does this really need to force a list?
method Supply() is nodal { self.list.Supply }
proto method Supply(|) is nodal { * }
multi method Supply() { self.list.Supply }

method nl-out() { "\n" }
method print-nl() { self.print(self.nl-out) }
Expand Down
2 changes: 1 addition & 1 deletion src/core/Channel.pm
Expand Up @@ -106,7 +106,7 @@ my class Channel does Awaitable {
}
}

method Supply(Channel:D:) {
multi method Supply(Channel:D:) {
supply {
# Tap the async notification for new values supply.
whenever $!async-notify.unsanitized-supply.schedule-on($*SCHEDULER) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/CatHandle.pm
Expand Up @@ -158,7 +158,7 @@ my class IO::CatHandle is IO::Handle {
}
multi method lines(::?CLASS:D:) { self!LINES }

method Supply (::?CLASS:D: :$size = $*DEFAULT-READ-ELEMS --> Supply:D) {
multi method Supply (::?CLASS:D: :$size = $*DEFAULT-READ-ELEMS --> Supply:D) {
nqp::if(
nqp::isconcrete($!encoding),
(supply nqp::stmts(
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/Handle.pm
Expand Up @@ -469,7 +469,7 @@ my class IO::Handle {
$result
}

method Supply(IO::Handle:D: :$size = $*DEFAULT-READ-ELEMS --> Supply:D) {
multi method Supply(IO::Handle:D: :$size = $*DEFAULT-READ-ELEMS --> Supply:D) {
if $!decoder { # handle is in character mode
supply {
my int $chars = $size;
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/Socket/Async.pm
Expand Up @@ -41,7 +41,7 @@ my class IO::Socket::Async {
-> Mu \seq, Mu \data, Mu \err { $ss.process(seq, data, err) }
}

method Supply(IO::Socket::Async:D: :$bin, :$buf = buf8.new, :$enc, :$scheduler = $*SCHEDULER) {
multi method Supply(IO::Socket::Async:D: :$bin, :$buf = buf8.new, :$enc, :$scheduler = $*SCHEDULER) {
if $bin {
my $cancellation;
Supply.on-demand:
Expand Down
2 changes: 1 addition & 1 deletion src/core/List.pm
Expand Up @@ -911,7 +911,7 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
}
method FLATTENABLE_HASH() { nqp::hash() }

method Supply(List:D:) { Supply.from-list(self) }
multi method Supply(List:D:) { Supply.from-list(self) }

method CALL-ME(List:U: |c) {
self.new(|c);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Promise.pm
Expand Up @@ -256,7 +256,7 @@ my class Promise does Awaitable {
$p
}

method Supply(Promise:D:) {
multi method Supply(Promise:D:) {
Supply.on-demand: -> $s {
self.then({
if self.status == Kept {
Expand Down
4 changes: 2 additions & 2 deletions src/core/Supply.pm
Expand Up @@ -573,7 +573,7 @@ my class Supply does Awaitable {
## Coercions
##

method Supply(Supply:) { self }
multi method Supply(Supply:D:) { self }

method Channel(Supply:D:) {
my $c = Channel.new();
Expand All @@ -585,7 +585,7 @@ my class Supply does Awaitable {
}

my class ConcQueue is repr('ConcBlockingQueue') { }
method list(Supply:D:) {
multi method list(Supply:D:) {
gather {
my Mu \queue = nqp::create(ConcQueue);
my $exception;
Expand Down

0 comments on commit 52d3957

Please sign in to comment.