Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Array.new and List.new to be more robust.

  • Loading branch information...
commit 3c225982386c67bf0077d6c32b6cbfdecbb31ea9 1 parent e6459bc
Patrick R. Michaud pmichaud authored
Showing with 10 additions and 2 deletions.
  1. +4 −2 src/core/Array.pm
  2. +6 −0 src/core/List.pm
6 src/core/Array.pm
View
@@ -1,8 +1,10 @@
class Array {
# Has attributes and parent List declared in BOOTSTRAP.
- method new(*@values) {
- my @a = @values;
+ method new(|$) {
+ my Mu $args := pir::perl6_current_args_rpa__P();
+ nqp::shift($args);
+ nqp::p6list($args, self.WHAT, 1.Bool);
}
method at_pos($pos) {
6 src/core/List.pm
View
@@ -5,6 +5,12 @@ class List does Positional {
# has $!flattens; # true if this list flattens its parcels
# has $!nextiter; # iterator for generating remaining elements
+ method new(|$) {
+ my Mu $args := pir::perl6_current_args_rpa__P();
+ nqp::shift($args);
+ nqp::p6list($args, self.WHAT, Mu);
+ }
+
method Bool() { self.gimme(1).Bool }
method Int() { self.elems }
method Numeric() { self.elems }
Please sign in to comment.
Something went wrong with that request. Please try again.