Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix various issues with Seq.(method)
Spotted by lucasb++
  • Loading branch information
lizmat committed Jun 11, 2017
1 parent 56e71d5 commit 5c56e9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/core/Any.pm
Expand Up @@ -65,6 +65,8 @@ my class Any { # declared in BOOTSTRAP
multi method Slip() { self.list.Slip }
proto method Array(|) is nodal { * }
multi method Array() { self.list.Array }
proto method Seq(|) is nodal { * }
multi method Seq() { self.list.Seq }

proto method hash(|) is nodal { * }
multi method hash(Any:U:) { my % = () }
Expand Down
1 change: 0 additions & 1 deletion src/core/List.pm
Expand Up @@ -691,7 +691,6 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP

multi method list(List:D:) { self }

proto method Seq(|) is nodal { * }
multi method Seq(List:D:) { Seq.new(self.iterator) }

method sink(--> Nil) { }
Expand Down
24 changes: 7 additions & 17 deletions src/core/Seq.pm
Expand Up @@ -24,8 +24,8 @@ my role PositionalBindFailover {
?? $!list
!! ($!list := List.from-iterator(self.iterator))
}
method list() {
List.from-iterator(self.iterator)
multi method list(::?CLASS:D:) {
List.from-iterator(self.iterator)
}

method iterator() { ... }
Expand Down Expand Up @@ -74,26 +74,16 @@ my class Seq is Cool does Iterable does PositionalBindFailover {
)
}

method eager {
List.from-iterator(self.iterator).eager;
}
multi method eager(Seq:D:) { List.from-iterator(self.iterator).eager }
multi method List(Seq:D:) { List.from-iterator(self.iterator) }
multi method Slip(Seq:D:) { Slip.from-iterator(self.iterator) }
multi method Array(Seq:D:) { Array.from-iterator(self.iterator) }
multi method Seq(Seq:D:) { self }

method Capture() {
self.List.Capture
}

method List() {
List.from-iterator(self.iterator)
}

method Slip() {
Slip.from-iterator(self.iterator)
}

method Array() {
Array.from-iterator(self.iterator)
}

method elems() {
nqp::if(
self.is-lazy,
Expand Down

0 comments on commit 5c56e9e

Please sign in to comment.