Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Nil handling.

  • Loading branch information...
commit a56af91824fd4c81b8b5f3f25aa866a72ea8fa6a 1 parent 33c6b6c
@pmichaud pmichaud authored
View
1  src/core/Any.pm
@@ -5,6 +5,7 @@ my class Any {
# List-like methods for Any.
method flat() { self.list.flat }
method list() { (self,).list }
+ method elems() { self.list.elems }
method join($separator = ' ') {
my $list = (self,).flat.eager;
View
4 src/core/ListIter.pm
@@ -1,5 +1,3 @@
-class Parcel { ... }
-
my class ListIter {
# Attributes defined in BOOTSTRAP.pm:
# has $!reified; # return value for already-reified iterator
@@ -29,7 +27,7 @@ my class ListIter {
pir__perl6_unbox_rpa__PP($x),
0, 0);
}
- else {
+ elsif !Nil.ACCEPTS($x) {
$x := $!list.STORE_AT_POS($pos, $x) if $!list.defined;
pir::push__vPP($rpa, $x);
$n = $n - 1;
View
10 src/core/Parcel.pm
@@ -31,12 +31,20 @@ my class Parcel {
$perl ~ ')';
}
- method DUMP() {
+ multi method DUMP(Parcel:D:) {
self.DUMP-ID() ~ '(:storage(' ~ DUMP($!storage) ~ '))'
}
}
+my class Nil is Parcel {
+ method new() { Nil }
+ method flat() { ().flat }
+ method list() { ().list }
+ method gist() { 'Nil' }
+}
+
+
my sub infix:<,>(|$) {
# pir::perl6_box_rpa__PP(pir::perl6_current_args_rpa__P())
pir::setattribute__0PPsP(
View
2  tools/build/Makefile.in
@@ -124,6 +124,7 @@ CORE_SOURCES = \
src/core/Any.pm \
src/core/Code.pm \
src/core/Attribute.pm \
+ src/core/Parcel.pm \
src/core/Cool.pm \
src/core/Bool.pm \
src/core/Numeric.pm \
@@ -137,7 +138,6 @@ CORE_SOURCES = \
src/core/MapIter.pm \
src/core/GatherIter.pm \
src/core/List.pm \
- src/core/Parcel.pm \
src/core/Array.pm \
src/core/RangeIter.pm \
src/core/Range.pm \
Please sign in to comment.
Something went wrong with that request. Please try again.