From 5af30794b9bc52f81330e263e6e7b1dcb67de4d5 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Sat, 5 Sep 2015 09:38:21 +0200 Subject: [PATCH] Rename EnumMap to Map Suggested by jnthn++ --- src/Perl6/Actions.nqp | 2 +- src/Perl6/Compiler.nqp | 4 +- src/Perl6/Metamodel/BOOTSTRAP.nqp | 26 +++--- src/Perl6/Metamodel/EnumHOW.nqp | 2 +- src/Perl6/World.nqp | 6 +- src/core/Any-iterable-methods.pm | 2 +- src/core/CallFrame.pm | 6 +- src/core/Capture.pm | 6 +- src/core/Enumeration.pm | 6 +- src/core/Exception.pm | 2 +- src/core/Hash.pm | 84 +++++++++---------- src/core/{EnumMap.pm => Map.pm} | 68 +++++++-------- src/core/PairMap.pm | 2 +- src/core/PseudoStash.pm | 26 +++--- src/core/Stash.pm | 12 +-- src/core/Supply.pm | 2 +- src/core/control.pm | 2 +- .../jvm/runtime/org/perl6/rakudo/Binder.java | 4 +- .../jvm/runtime/org/perl6/rakudo/RakOps.java | 4 +- tools/build/Makefile-JVM.in | 2 +- tools/build/moar_core_sources | 2 +- 21 files changed, 135 insertions(+), 135 deletions(-) rename src/core/{EnumMap.pm => Map.pm} (75%) diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp index a5bf6868154..6cad6658eca 100644 --- a/src/Perl6/Actions.nqp +++ b/src/Perl6/Actions.nqp @@ -6972,7 +6972,7 @@ Compilation unit '$file' contained the following violations: :op('create'), QAST::WVal.new( :value($*W.find_symbol(['Hash'])) ) ), - QAST::WVal.new( :value($*W.find_symbol(['EnumMap'])) ), + QAST::WVal.new( :value($*W.find_symbol(['Map'])) ), QAST::SVal.new( :value('$!storage') ), QAST::Var.new( :name($name), :scope('local') ) )); diff --git a/src/Perl6/Compiler.nqp b/src/Perl6/Compiler.nqp index 9ec473fb250..fd5ed6556a6 100644 --- a/src/Perl6/Compiler.nqp +++ b/src/Perl6/Compiler.nqp @@ -219,8 +219,8 @@ class Perl6::Compiler is HLL::Compiler { } my $our := nqp::getlexrel($ctx, '$?PACKAGE').WHO; - my $EnumMap := self.eval('EnumMap', :outer_ctx(nqp::null())); - my $storage := nqp::getattr($our, $EnumMap, '$!storage'); + my $Map := self.eval('Map', :outer_ctx(nqp::null())); + my $storage := nqp::getattr($our, $Map, '$!storage'); $it := nqp::iterator($storage); diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp index 5276707a710..4c6c4e18111 100644 --- a/src/Perl6/Metamodel/BOOTSTRAP.nqp +++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp @@ -64,7 +64,7 @@ my stub Num metaclass Perl6::Metamodel::ClassHOW { ... }; my stub List metaclass Perl6::Metamodel::ClassHOW { ... }; my stub Slip metaclass Perl6::Metamodel::ClassHOW { ... }; my stub Array metaclass Perl6::Metamodel::ClassHOW { ... }; -my stub EnumMap metaclass Perl6::Metamodel::ClassHOW { ... }; +my stub Map metaclass Perl6::Metamodel::ClassHOW { ... }; my stub Hash metaclass Perl6::Metamodel::ClassHOW { ... }; my stub Capture metaclass Perl6::Metamodel::ClassHOW { ... }; my stub Bool metaclass Perl6::Metamodel::ClassHOW { ... }; @@ -686,7 +686,7 @@ my class Binder { # that. Otherwise, putting Mu in there is fine; Hash is smart # enough to know what to do. my $hash := nqp::create(Hash); - nqp::bindattr($hash, EnumMap, '$!storage', $named_args || Mu); + nqp::bindattr($hash, Map, '$!storage', $named_args || Mu); $bind_fail := bind_one_param($lexpad, $sig, $param, $no_nom_type_check, $error, 0, $hash, 0, 0.0, ''); return $bind_fail if $bind_fail; @@ -2616,15 +2616,15 @@ BEGIN { Array.HOW.add_attribute(Array, BOOTSTRAPATTR.new(:name<$!descriptor>, :type(Mu), :package(Array))); Array.HOW.compose_repr(Array); - # my class EnumMap is Cool { + # my class Map is Cool { # has Mu $!storage; - EnumMap.HOW.add_parent(EnumMap, Cool); - EnumMap.HOW.add_attribute(EnumMap, scalar_attr('$!storage', Mu, EnumMap, :associative_delegate)); - EnumMap.HOW.compose_repr(EnumMap); + Map.HOW.add_parent(Map, Cool); + Map.HOW.add_attribute(Map, scalar_attr('$!storage', Mu, Map, :associative_delegate)); + Map.HOW.compose_repr(Map); - # my class Hash is EnumMap { + # my class Hash is Map { # has Mu $!descriptor; - Hash.HOW.add_parent(Hash, EnumMap); + Hash.HOW.add_parent(Hash, Map); Hash.HOW.add_attribute(Hash, BOOTSTRAPATTR.new(:name<$!descriptor>, :type(Mu), :package(Hash))); Hash.HOW.compose_repr(Hash); @@ -2672,7 +2672,7 @@ BEGIN { Stash.HOW.compose_repr(Stash); # Configure the stash type. - Perl6::Metamodel::Configuration.set_stash_type(Stash, EnumMap); + Perl6::Metamodel::Configuration.set_stash_type(Stash, Map); # Give everything we've set up so far a Stash. Perl6::Metamodel::ClassHOW.add_stash(Mu); @@ -2780,7 +2780,7 @@ BEGIN { EXPORT::DEFAULT.WHO := List; EXPORT::DEFAULT.WHO := Slip; EXPORT::DEFAULT.WHO := Array; - EXPORT::DEFAULT.WHO := EnumMap; + EXPORT::DEFAULT.WHO := Map; EXPORT::DEFAULT.WHO := Hash; EXPORT::DEFAULT.WHO := Capture; EXPORT::DEFAULT.WHO := ObjAt; @@ -2856,7 +2856,7 @@ Perl6::Metamodel::EnumHOW.set_default_invoke_handler( Mu.HOW.invocation_handler(Mu)); # Configure the MOP (not persisted as it ends up in a lexical...) -Perl6::Metamodel::Configuration.set_stash_type(Stash, EnumMap); +Perl6::Metamodel::Configuration.set_stash_type(Stash, Map); Perl6::Metamodel::Configuration.set_submethod_type(Submethod); # Register default parent types. @@ -2865,7 +2865,7 @@ Perl6::Metamodel::GrammarHOW.set_default_parent_type(Grammar); # Put PROCESS in place, and ensure it's never repossessed. nqp::neverrepossess(PROCESS.WHO); -nqp::neverrepossess(nqp::getattr(PROCESS.WHO, EnumMap, '$!storage')); +nqp::neverrepossess(nqp::getattr(PROCESS.WHO, Map, '$!storage')); nqp::bindhllsym('perl6', 'PROCESS', PROCESS); # HLL configuration: interop, boxing and exit handling. @@ -2884,7 +2884,7 @@ nqp::sethllconfig('perl6', nqp::hash( }, 'foreign_transform_hash', -> $hash { my $result := nqp::create(Hash); - nqp::bindattr($result, EnumMap, '$!storage', $hash); + nqp::bindattr($result, Map, '$!storage', $hash); $result }, 'foreign_transform_code', -> $code { diff --git a/src/Perl6/Metamodel/EnumHOW.nqp b/src/Perl6/Metamodel/EnumHOW.nqp index 3682e909487..fd7f4ff04e8 100644 --- a/src/Perl6/Metamodel/EnumHOW.nqp +++ b/src/Perl6/Metamodel/EnumHOW.nqp @@ -1,5 +1,5 @@ # This is the meta-object for an enumeration (declared with enum). -# It keeps hold of the enumeration values in an EnumMap, which is +# It keeps hold of the enumeration values in an Map, which is # created at composition time. It supports having roles composed in, # one or two of which presumably provide the core enum-ish methods. class Perl6::Metamodel::EnumHOW diff --git a/src/Perl6/World.nqp b/src/Perl6/World.nqp index e082d83d06d..47ee536f748 100644 --- a/src/Perl6/World.nqp +++ b/src/Perl6/World.nqp @@ -655,13 +655,13 @@ class Perl6::World is HLL::World { } if nqp::existskey($module, '&EXPORT') { my $result := $module<&EXPORT>(|@positional_imports); - my $EnumMap := self.find_symbol(['EnumMap']); - if nqp::istype($result, $EnumMap) { + my $Map := self.find_symbol(['Map']); + if nqp::istype($result, $Map) { my $storage := $result.hash.FLATTENABLE_HASH(); self.import($/, $storage, $package_source_name); } else { - nqp::die("&EXPORT sub did not return an EnumMap"); + nqp::die("&EXPORT sub did not return an Map"); } } else { diff --git a/src/core/Any-iterable-methods.pm b/src/core/Any-iterable-methods.pm index 2852ee4a43c..5e229d68394 100644 --- a/src/core/Any-iterable-methods.pm +++ b/src/core/Any-iterable-methods.pm @@ -653,7 +653,7 @@ augment class Any { if nqp::istype($it, Enum) { take $it.key => $it.value } - elsif nqp::istype($it, EnumMap) and !nqp::iscont($it) { + elsif nqp::istype($it, Map) and !nqp::iscont($it) { take Slip.new(|$it.pairs) } elsif $it =:= IterationEnd { diff --git a/src/core/CallFrame.pm b/src/core/CallFrame.pm index f5f47a6a683..9032d1c2bc6 100644 --- a/src/core/CallFrame.pm +++ b/src/core/CallFrame.pm @@ -10,8 +10,8 @@ my class CallFrame { while $i-- { $ctx := nqp::ctxcaller($ctx); } - my $h := nqp::create(EnumMap); - nqp::bindattr($h, EnumMap, '$!storage', $ctx); + my $h := nqp::create(Map); + nqp::bindattr($h, Map, '$!storage', $ctx); nqp::bindattr($self, CallFrame, '%!my', $h); nqp::bindattr($self, CallFrame, '$!level', $l); @@ -34,7 +34,7 @@ my class CallFrame { "%annotations at line %annotations"; } method code() { - my $ctx := nqp::getattr(%!my, EnumMap, '$!storage'); + my $ctx := nqp::getattr(%!my, Map, '$!storage'); nqp::getcodeobj(nqp::ctxcode($ctx)); } diff --git a/src/core/Capture.pm b/src/core/Capture.pm index 13bdd2b4ca8..553c4258df6 100644 --- a/src/core/Capture.pm +++ b/src/core/Capture.pm @@ -12,7 +12,7 @@ my class Capture { # declared in BOOTSTRAP nqp::bindattr(self, Capture, '$!list', nqp::getattr(nqp::decont(@list.List), List, '$!reified') ); - my Mu $hs := nqp::getattr(nqp::decont(%hash), EnumMap, '$!storage'); + my Mu $hs := nqp::getattr(nqp::decont(%hash), Map, '$!storage'); nqp::bindattr(self, Capture, '$!hash', nqp::ishash($hs) ?? $hs !! nqp::hash()); } @@ -53,8 +53,8 @@ my class Capture { # declared in BOOTSTRAP } method hash(Capture:D:) { - my $enum := nqp::create(EnumMap); - nqp::bindattr($enum, EnumMap, '$!storage', $!hash); + my $enum := nqp::create(Map); + nqp::bindattr($enum, Map, '$!storage', $!hash); $enum; } diff --git a/src/core/Enumeration.pm b/src/core/Enumeration.pm index f27e79a1fec..abf7f828173 100644 --- a/src/core/Enumeration.pm +++ b/src/core/Enumeration.pm @@ -70,9 +70,9 @@ sub ANON_ENUM(*@args) { %res{$_} = $prev.=succ; } } - my $r := nqp::create(EnumMap); - nqp::bindattr($r, EnumMap, '$!storage', - nqp::getattr(%res, EnumMap, '$!storage')); + my $r := nqp::create(Map); + nqp::bindattr($r, Map, '$!storage', + nqp::getattr(%res, Map, '$!storage')); $r; } diff --git a/src/core/Exception.pm b/src/core/Exception.pm index 9f802c39a8c..7ed36ab94bc 100644 --- a/src/core/Exception.pm +++ b/src/core/Exception.pm @@ -2009,7 +2009,7 @@ my class X::Inheritance::NotComposed does X::MOP { %c_ex{'X::Inheritance::NotComposed'} = sub ($child-name, $parent-name) { X::Inheritance::NotComposed.new(:$child-name, :$parent-name).throw; } - nqp::bindcurhllsym('P6EX', nqp::getattr(%c_ex, EnumMap, '$!storage')); + nqp::bindcurhllsym('P6EX', nqp::getattr(%c_ex, Map, '$!storage')); 0; } diff --git a/src/core/Hash.pm b/src/core/Hash.pm index e123aa75a29..fcab8ee8e1d 100644 --- a/src/core/Hash.pm +++ b/src/core/Hash.pm @@ -1,5 +1,5 @@ my class Hash { # declared in BOOTSTRAP - # my class Hash is EnumMap { + # my class Hash is Map { # has Mu $!descriptor; multi method Hash() { @@ -7,8 +7,8 @@ my class Hash { # declared in BOOTSTRAP } multi method AT-KEY(Hash:D: \key) is rw { - my Mu $storage := nqp::getattr(self, EnumMap, '$!storage'); - $storage := nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()) + my Mu $storage := nqp::getattr(self, Map, '$!storage'); + $storage := nqp::bindattr(self, Map, '$!storage', nqp::hash()) unless nqp::defined($storage); my str $skey = nqp::istype(key, Str) ?? key !! key.Str; if nqp::existskey($storage, $skey) { @@ -25,8 +25,8 @@ my class Hash { # declared in BOOTSTRAP } multi method ASSIGN-KEY(Hash:D: \key, Mu \assignval) { - my Mu $storage := nqp::getattr(self, EnumMap, '$!storage'); - $storage := nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()) + my Mu $storage := nqp::getattr(self, Map, '$!storage'); + $storage := nqp::bindattr(self, Map, '$!storage', nqp::hash()) unless nqp::defined($storage); my str $key = nqp::istype(key, Str) ?? key !! key.Str; nqp::existskey($storage, $key) @@ -36,8 +36,8 @@ my class Hash { # declared in BOOTSTRAP } method BIND-KEY(Hash:D: \key, Mu \bindval) is rw { - my Mu $storage := nqp::getattr(self, EnumMap, '$!storage'); - $storage := nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()) + my Mu $storage := nqp::getattr(self, Map, '$!storage'); + $storage := nqp::bindattr(self, Map, '$!storage', nqp::hash()) unless nqp::defined($storage); my str $key = nqp::istype(key, Str) ?? key !! key.Str; nqp::bindkey($storage, $key, bindval) @@ -75,13 +75,13 @@ my class Hash { # declared in BOOTSTRAP nqp::push($attrs, '$!descriptor'); nqp::push($attrs, $!descriptor ); nqp::push($attrs, '$!storage' ); - nqp::push($attrs, nqp::getattr(nqp::decont(self), EnumMap, '$!storage')); + nqp::push($attrs, nqp::getattr(nqp::decont(self), Map, '$!storage')); self.DUMP-OBJECT-ATTRS($attrs, :$indent-step, :%ctx); } method STORE_AT_KEY(\key, Mu $x) is rw { my $v := nqp::p6scalarfromdesc($!descriptor); - nqp::findmethod(EnumMap, 'STORE_AT_KEY')(self, key, $v = $x); + nqp::findmethod(Map, 'STORE_AT_KEY')(self, key, $v = $x); } # introspection @@ -107,14 +107,14 @@ my class Hash { # declared in BOOTSTRAP multi method DELETE-KEY(Str() \key) { my Mu $val = self.AT-KEY(key); nqp::deletekey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s(key) ); $val; } multi method DELETE-KEY(Str() \key, :$SINK!) { nqp::deletekey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s(key) ); Nil; @@ -251,25 +251,25 @@ my class Hash { # declared in BOOTSTRAP my role TypedHash[::TValue] does Associative[TValue] { method AT-KEY(::?CLASS:D: Str() $key) is rw { if self.EXISTS-KEY($key) { - nqp::findmethod(EnumMap, 'AT-KEY')(self, $key); + nqp::findmethod(Map, 'AT-KEY')(self, $key); } else { nqp::p6bindattrinvres( (my \v := nqp::p6scalarfromdesc(nqp::getattr(self, Hash, '$!descriptor'))), Scalar, '$!whence', - -> { nqp::findmethod(EnumMap, 'STORE_AT_KEY')(self, $key, v) } + -> { nqp::findmethod(Map, 'STORE_AT_KEY')(self, $key, v) } ); } } method STORE_AT_KEY(Str \key, TValue $x) is rw { my $v := nqp::p6scalarfromdesc(nqp::getattr(self, Hash, '$!descriptor')); - nqp::findmethod(EnumMap, 'STORE_AT_KEY')(self, key, $v = $x); + nqp::findmethod(Map, 'STORE_AT_KEY')(self, key, $v = $x); } multi method ASSIGN-KEY(::?CLASS:D: \key, TValue \assignval) { - my Mu $storage := nqp::getattr(self, EnumMap, '$!storage'); - $storage := nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()) + my Mu $storage := nqp::getattr(self, Map, '$!storage'); + $storage := nqp::bindattr(self, Map, '$!storage', nqp::hash()) unless nqp::defined($storage); my str $key = nqp::istype(key, Str) ?? key !! key.Str; if nqp::existskey($storage, $key) { @@ -281,10 +281,10 @@ my class Hash { # declared in BOOTSTRAP } } method BIND-KEY($key, TValue \bindval) is rw { - nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::defined(nqp::getattr(self, Map, '$!storage')) || + nqp::bindattr(self, Map, '$!storage', nqp::hash()); nqp::bindkey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s($key.Str), bindval) } @@ -307,7 +307,7 @@ my class Hash { # declared in BOOTSTRAP method AT-KEY(::?CLASS:D: TKey \key) is rw { my $key_which = key.WHICH; if self.EXISTS-KEY(key) { - nqp::findmethod(EnumMap, 'AT-KEY')(self, $key_which); + nqp::findmethod(Map, 'AT-KEY')(self, $key_which); } else { nqp::p6bindattrinvres( @@ -317,14 +317,14 @@ my class Hash { # declared in BOOTSTRAP -> { nqp::defined(nqp::getattr(self, $?CLASS, '$!keys')) || nqp::bindattr(self, $?CLASS, '$!keys', nqp::hash()); - nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::defined(nqp::getattr(self, Map, '$!storage')) || + nqp::bindattr(self, Map, '$!storage', nqp::hash()); nqp::bindkey( nqp::getattr(self, $?CLASS, '$!keys'), nqp::unbox_s($key_which), key); nqp::bindkey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s($key_which), v); }); @@ -334,8 +334,8 @@ my class Hash { # declared in BOOTSTRAP my $key_which = key.WHICH; nqp::defined(nqp::getattr(self, $?CLASS, '$!keys')) || nqp::bindattr(self, $?CLASS, '$!keys', nqp::hash()); - nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::defined(nqp::getattr(self, Map, '$!storage')) || + nqp::bindattr(self, Map, '$!storage', nqp::hash()); nqp::bindkey( nqp::getattr(self, $?CLASS, '$!keys'), nqp::unbox_s($key_which), @@ -343,13 +343,13 @@ my class Hash { # declared in BOOTSTRAP my $v := nqp::p6scalarfromdesc(nqp::getattr(self, Hash, '$!descriptor')); nqp::bindkey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s($key_which), $v = $x); } method ASSIGN-KEY(::?CLASS:D: TKey \key, TValue \assignval) { - my Mu $storage := nqp::getattr(self, EnumMap, '$!storage'); - $storage := nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()) + my Mu $storage := nqp::getattr(self, Map, '$!storage'); + $storage := nqp::bindattr(self, Map, '$!storage', nqp::hash()) unless nqp::defined($storage); my str $key_which = nqp::unbox_s(key.WHICH); if nqp::existskey($storage, $key_which) { @@ -367,14 +367,14 @@ my class Hash { # declared in BOOTSTRAP my $key_which = key.WHICH; nqp::defined(nqp::getattr(self, $?CLASS, '$!keys')) || nqp::bindattr(self, $?CLASS, '$!keys', nqp::hash()); - nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::defined(nqp::getattr(self, Map, '$!storage')) || + nqp::bindattr(self, Map, '$!storage', nqp::hash()); nqp::bindkey( nqp::getattr(self, $?CLASS, '$!keys'), nqp::unbox_s($key_which), key); nqp::bindkey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s($key_which), bindval) } @@ -383,7 +383,7 @@ my class Hash { # declared in BOOTSTRAP ?? nqp::p6bool(nqp::existskey($!keys, nqp::unbox_s(key.WHICH))) !! False } - method keys(EnumMap:) { + method keys(Map:) { return ().list unless self.DEFINITE && nqp::defined($!keys); Seq.new(class :: does Iterator { has $!hash-iter; @@ -402,10 +402,10 @@ my class Hash { # declared in BOOTSTRAP } }.new(self, $?CLASS)) } - method kv(EnumMap:) { + method kv(Map:) { return ().list unless self.DEFINITE && nqp::defined($!keys); - my $storage := nqp::getattr(self, EnumMap, '$!storage'); + my $storage := nqp::getattr(self, Map, '$!storage'); Seq.new(class :: does Iterator { has $!hash-iter; has $!storage; @@ -437,12 +437,12 @@ my class Hash { # declared in BOOTSTRAP IterationEnd } } - }.new(self, $?CLASS, nqp::getattr(self, EnumMap, '$!storage'))) + }.new(self, $?CLASS, nqp::getattr(self, Map, '$!storage'))) } - method pairs(EnumMap:) { + method pairs(Map:) { return ().list unless self.DEFINITE && nqp::defined($!keys); - my $storage := nqp::getattr(self, EnumMap, '$!storage'); + my $storage := nqp::getattr(self, Map, '$!storage'); Seq.new(class :: does Iterator { has $!hash-iter; has $!storage; @@ -464,12 +464,12 @@ my class Hash { # declared in BOOTSTRAP IterationEnd } } - }.new(self, $?CLASS, nqp::getattr(self, EnumMap, '$!storage'))) + }.new(self, $?CLASS, nqp::getattr(self, Map, '$!storage'))) } - method antipairs(EnumMap:) { + method antipairs(Map:) { self.map: { .value => .key } } - method invert(EnumMap:) { + method invert(Map:) { self.map: { .value »=>» .key } } multi method perl(::?CLASS:D \SELF:) { @@ -502,14 +502,14 @@ my class Hash { # declared in BOOTSTRAP ); nqp::deletekey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s($key-which) ); $val; } # gotta force capture keys to strings or binder fails - method Capture(EnumMap:D:) { + method Capture(Map:D:) { my $cap := nqp::create(Capture); my $h := nqp::hash(); for self.kv -> \k, \v { diff --git a/src/core/EnumMap.pm b/src/core/Map.pm similarity index 75% rename from src/core/EnumMap.pm rename to src/core/Map.pm index 7d2bd514dd9..6d549cf2a56 100644 --- a/src/core/EnumMap.pm +++ b/src/core/Map.pm @@ -1,7 +1,7 @@ my class X::Hash::Store::OddNumber { ... } -my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP - # my class EnumMap is Iterable is Cool { +my class Map does Iterable does Associative { # declared in BOOTSTRAP + # my class Map is Iterable is Cool { # has Mu $!storage; method new(*@args) { @@ -10,56 +10,56 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP %h; } - multi method Bool(EnumMap:D:) { + multi method Bool(Map:D:) { nqp::p6bool(nqp::defined($!storage) && nqp::elems($!storage)); } - method elems(EnumMap:D:) { + method elems(Map:D:) { nqp::p6box_i(nqp::defined($!storage) && nqp::elems($!storage)); } - multi method Int(EnumMap:D:) { self.elems } - multi method Numeric(EnumMap:D:) { self.elems } - multi method Str(EnumMap:D:) { self.list.Str } + multi method Int(Map:D:) { self.elems } + multi method Numeric(Map:D:) { self.elems } + multi method Str(Map:D:) { self.list.Str } - multi method ACCEPTS(EnumMap:D: Any $topic) { + multi method ACCEPTS(Map:D: Any $topic) { self.EXISTS-KEY($topic.any); } - multi method ACCEPTS(EnumMap:D: Cool:D $topic) { + multi method ACCEPTS(Map:D: Cool:D $topic) { self.EXISTS-KEY($topic); } - multi method ACCEPTS(EnumMap:D: Positional $topic) { + multi method ACCEPTS(Map:D: Positional $topic) { self.EXISTS-KEY($topic.any); } - multi method ACCEPTS(EnumMap:D: Regex $topic) { + multi method ACCEPTS(Map:D: Regex $topic) { so self.keys.any.match($topic); } - multi method EXISTS-KEY(EnumMap:D: Str:D \key) { + multi method EXISTS-KEY(Map:D: Str:D \key) { nqp::p6bool( nqp::defined($!storage) && nqp::existskey($!storage, nqp::unbox_s(key)) ) } - multi method EXISTS-KEY(EnumMap:D: \key) { + multi method EXISTS-KEY(Map:D: \key) { nqp::p6bool( nqp::defined($!storage) && nqp::existskey($!storage, nqp::unbox_s(key.Str)) ) } - multi method perl(EnumMap:D:) { + multi method perl(Map:D:) { self.^name ~ '.new(' ~ self.pairs.sort.map({.perl}).join(', ') ~ ')'; } - method iterator(EnumMap:) { self.pairs.iterator } - method list(EnumMap:) { self.pairs.list } + method iterator(Map:) { self.pairs.iterator } + method list(Map:) { self.pairs.list } - multi method pairs(EnumMap:D:) { + multi method pairs(Map:D:) { $!storage := nqp::hash() unless $!storage.DEFINITE; Seq.new(class :: does Iterator { has $!hash-iter; @@ -67,7 +67,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP method new(\hash) { my \iter = self.CREATE; nqp::bindattr(iter, self, '$!hash-iter', - nqp::iterator(nqp::getattr(hash, EnumMap, '$!storage'))); + nqp::iterator(nqp::getattr(hash, Map, '$!storage'))); iter } @@ -82,7 +82,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP } }.new(self)) } - multi method keys(EnumMap:D:) { + multi method keys(Map:D:) { $!storage := nqp::hash() unless $!storage.DEFINITE; Seq.new(class :: does Iterator { has $!hash-iter; @@ -90,7 +90,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP method new(\hash) { my \iter = self.CREATE; nqp::bindattr(iter, self, '$!hash-iter', - nqp::iterator(nqp::getattr(hash, EnumMap, '$!storage'))); + nqp::iterator(nqp::getattr(hash, Map, '$!storage'))); iter } @@ -101,7 +101,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP } }.new(self)) } - multi method kv(EnumMap:D:) { + multi method kv(Map:D:) { $!storage := nqp::hash() unless $!storage.DEFINITE; Seq.new(class :: does Iterator { has $!hash-iter; @@ -110,7 +110,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP method new(\hash) { my \iter = self.CREATE; nqp::bindattr(iter, self, '$!hash-iter', - nqp::iterator(nqp::getattr(hash, EnumMap, '$!storage'))); + nqp::iterator(nqp::getattr(hash, Map, '$!storage'))); iter } @@ -130,7 +130,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP } }.new(self)) } - multi method values(EnumMap:D:) { + multi method values(Map:D:) { $!storage := nqp::hash() unless $!storage.DEFINITE; Seq.new(class :: does Iterator { has $!hash-iter; @@ -138,7 +138,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP method new(\hash) { my \iter = self.CREATE; nqp::bindattr(iter, self, '$!hash-iter', - nqp::iterator(nqp::getattr(hash, EnumMap, '$!storage'))); + nqp::iterator(nqp::getattr(hash, Map, '$!storage'))); iter } @@ -149,14 +149,14 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP } }.new(self)) } - multi method antipairs(EnumMap:D:) { + multi method antipairs(Map:D:) { self.map: { .value => .key } } - multi method invert(EnumMap:D:) { + multi method invert(Map:D:) { self.map: { (.value »=>» .key).list.Slip } } - multi method AT-KEY(EnumMap:D: \key) is rw { + multi method AT-KEY(Map:D: \key) is rw { my str $skey = nqp::unbox_s(key.Str); nqp::defined($!storage) && nqp::existskey($!storage, $skey) ?? nqp::atkey($!storage, $skey) @@ -172,7 +172,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP if nqp::istype($x,Enum) { self.STORE_AT_KEY($x.key, $x.value) } - elsif nqp::istype($x, EnumMap) and !nqp::iscont($x) { + elsif nqp::istype($x, Map) and !nqp::iscont($x) { for $x.list { self.STORE_AT_KEY(.key, .value) } } elsif (my Mu $y := iter.pull-one) !=:= IterationEnd { @@ -190,16 +190,16 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP proto method STORE_AT_KEY(|) is rw { * } multi method STORE_AT_KEY(Str \key, Mu \value) is rw { nqp::defined($!storage) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::bindattr(self, Map, '$!storage', nqp::hash()); nqp::bindkey($!storage, nqp::unbox_s(key), value) } multi method STORE_AT_KEY(\key, Mu \value) is rw { nqp::defined($!storage) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::bindattr(self, Map, '$!storage', nqp::hash()); nqp::bindkey($!storage, nqp::unbox_s(key.Str), value) } - method Capture(EnumMap:D:) { + method Capture(Map:D:) { my $cap := nqp::create(Capture); nqp::bindattr($cap, Capture, '$!hash', $!storage); $cap @@ -208,11 +208,11 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP method FLATTENABLE_LIST() { nqp::list() } method FLATTENABLE_HASH() { nqp::defined($!storage) || - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + nqp::bindattr(self, Map, '$!storage', nqp::hash()); $!storage } - method fmt(EnumMap: Cool $format = "%s\t\%s", $sep = "\n") { + method fmt(Map: Cool $format = "%s\t\%s", $sep = "\n") { if nqp::p6box_i(nqp::sprintfdirectives( nqp::unbox_s($format.Stringy) )) == 1 { self.keys.fmt($format, $sep); } @@ -224,7 +224,7 @@ my class EnumMap does Iterable does Associative { # declared in BOOTSTRAP method hash() { self } } -multi sub infix:(EnumMap:D $a, EnumMap:D $b) { +multi sub infix:(Map:D $a, Map:D $b) { if +$a != +$b { return Bool::False } for $a.kv -> $k, $v { unless $b.EXISTS-KEY($k) && $b{$k} eqv $v { diff --git a/src/core/PairMap.pm b/src/core/PairMap.pm index f2f201e8e0a..2a5d7130a0d 100644 --- a/src/core/PairMap.pm +++ b/src/core/PairMap.pm @@ -8,7 +8,7 @@ my class PairMap is Hash { nqp::p6scalarfromdesc($descriptor) = $pair.value) } - nqp::bindattr(self, EnumMap, '$!storage', $storage); + nqp::bindattr(self, Map, '$!storage', $storage); self; } diff --git a/src/core/PseudoStash.pm b/src/core/PseudoStash.pm index b8f66c4bc90..9297707fa1b 100644 --- a/src/core/PseudoStash.pm +++ b/src/core/PseudoStash.pm @@ -1,7 +1,7 @@ my class X::Bind { ... } my class X::Caller::NotDynamic { ... } -my class PseudoStash is EnumMap { +my class PseudoStash is Map { has Mu $!ctx; has int $!mode; @@ -16,7 +16,7 @@ my class PseudoStash is EnumMap { my $obj := nqp::create(self); my $ctx := nqp::ctxcaller(nqp::ctx()); nqp::bindattr($obj, PseudoStash, '$!ctx', $ctx); - nqp::bindattr($obj, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($obj, Map, '$!storage', nqp::ctxlexpad($ctx)); $obj } @@ -34,7 +34,7 @@ my class PseudoStash is EnumMap { $ctx := nqp::ctxouterskipthunks($ctx); } my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', PRECISE_SCOPE); nqp::setwho( @@ -45,7 +45,7 @@ my class PseudoStash is EnumMap { my Mu $ctx := nqp::ctxcallerskipthunks( nqp::getattr(nqp::decont($cur), PseudoStash, '$!ctx')); my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', PRECISE_SCOPE +| REQUIRE_DYNAMIC); nqp::setwho( @@ -56,7 +56,7 @@ my class PseudoStash is EnumMap { my Mu $ctx := nqp::ctxouterskipthunks( nqp::getattr(nqp::decont($cur), PseudoStash, '$!ctx')); my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', PRECISE_SCOPE); nqp::setwho( @@ -74,7 +74,7 @@ my class PseudoStash is EnumMap { my Mu $ctx := nqp::ctxouterskipthunks( nqp::getattr(nqp::decont($cur), PseudoStash, '$!ctx')); my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', STATIC_CHAIN); nqp::setwho( @@ -92,7 +92,7 @@ my class PseudoStash is EnumMap { my Mu $ctx := nqp::ctxcallerskipthunks( nqp::getattr(nqp::decont($cur), PseudoStash, '$!ctx')); my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', DYNAMIC_CHAIN +| REQUIRE_DYNAMIC); nqp::setwho( @@ -105,7 +105,7 @@ my class PseudoStash is EnumMap { $ctx := nqp::ctxouterskipthunks($ctx); } my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage',nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage',nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', PRECISE_SCOPE); nqp::setwho( @@ -121,7 +121,7 @@ my class PseudoStash is EnumMap { } $ctx := nqp::ctxouter(nqp::ctxouter($ctx)); my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', STATIC_CHAIN); nqp::setwho( @@ -140,7 +140,7 @@ my class PseudoStash is EnumMap { die "No client package found" unless $ctx; } my $stash := nqp::create(PseudoStash); - nqp::bindattr($stash, EnumMap, '$!storage', nqp::ctxlexpad($ctx)); + nqp::bindattr($stash, Map, '$!storage', nqp::ctxlexpad($ctx)); nqp::bindattr($stash, PseudoStash, '$!ctx', $ctx); nqp::bindattr_i($stash, PseudoStash, '$!mode', PRECISE_SCOPE +| REQUIRE_DYNAMIC); nqp::setwho( @@ -159,7 +159,7 @@ my class PseudoStash is EnumMap { %pseudoers{$key}(self) } elsif nqp::bitand_i($!mode, PRECISE_SCOPE) { - my Mu $store := nqp::getattr(self, EnumMap, '$!storage'); + my Mu $store := nqp::getattr(self, Map, '$!storage'); my Mu $res := nqp::existskey($store, $nkey) ?? nqp::atkey($store, $nkey) !! Any; @@ -191,7 +191,7 @@ my class PseudoStash is EnumMap { X::Bind.new(target => "pseudo-package $key").throw; } elsif nqp::bitand_i($!mode, PRECISE_SCOPE) { - my Mu $store := nqp::getattr(self, EnumMap, '$!storage'); + my Mu $store := nqp::getattr(self, Map, '$!storage'); nqp::bindkey($store, nqp::unbox_s($key), value) } elsif nqp::bitand_i($!mode, nqp::bitor_i(DYNAMIC_CHAIN, PICK_CHAIN_BY_NAME)) && $key.substr-eq("*",1) { @@ -208,7 +208,7 @@ my class PseudoStash is EnumMap { } elsif nqp::bitand_i($!mode, PRECISE_SCOPE) { nqp::p6bool(nqp::existskey( - nqp::getattr(self, EnumMap, '$!storage'), + nqp::getattr(self, Map, '$!storage'), nqp::unbox_s($key))) } elsif nqp::bitand_i($!mode, nqp::bitor_i(DYNAMIC_CHAIN, PICK_CHAIN_BY_NAME)) && $key.substr-eq("*",1) { diff --git a/src/core/Stash.pm b/src/core/Stash.pm index 4549b57e7e7..e1808973b6c 100644 --- a/src/core/Stash.pm +++ b/src/core/Stash.pm @@ -2,9 +2,9 @@ my class Stash { # declared in BOOTSTRAP # class Stash is Hash { multi method AT-KEY(Stash:D: Str() $key, :$global_fallback) is rw { - my Mu $storage := nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) ?? - nqp::getattr(self, EnumMap, '$!storage') !! - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + my Mu $storage := nqp::defined(nqp::getattr(self, Map, '$!storage')) ?? + nqp::getattr(self, Map, '$!storage') !! + nqp::bindattr(self, Map, '$!storage', nqp::hash()); if nqp::existskey($storage, nqp::unbox_s($key)) { nqp::atkey($storage, nqp::unbox_s($key)) } @@ -20,9 +20,9 @@ my class Stash { # declared in BOOTSTRAP } method package_at_key(Stash:D: str $key) { - my Mu $storage := nqp::defined(nqp::getattr(self, EnumMap, '$!storage')) ?? - nqp::getattr(self, EnumMap, '$!storage') !! - nqp::bindattr(self, EnumMap, '$!storage', nqp::hash()); + my Mu $storage := nqp::defined(nqp::getattr(self, Map, '$!storage')) ?? + nqp::getattr(self, Map, '$!storage') !! + nqp::bindattr(self, Map, '$!storage', nqp::hash()); if nqp::existskey($storage, nqp::unbox_s($key)) { nqp::atkey($storage, $key) } diff --git a/src/core/Supply.pm b/src/core/Supply.pm index d4d9e2ca947..0f415538cf8 100644 --- a/src/core/Supply.pm +++ b/src/core/Supply.pm @@ -895,7 +895,7 @@ sub on(&setup) { X::Supply::On::BadSetup.new.throw; } given $what { - when EnumMap { + when Map { @to_close.push(self!add_source($source, $lock, $index, |$what)); } when Callable { diff --git a/src/core/control.pm b/src/core/control.pm index cd6e51a65e3..12d84839a1f 100644 --- a/src/core/control.pm +++ b/src/core/control.pm @@ -268,7 +268,7 @@ sub NOT_ALL_DEFINED_TYPE(\values,\type) { sub CLONE-HASH-DECONTAINERIZED(\hash) { my Mu $clone := nqp::hash(); - my Mu $iter := nqp::iterator(nqp::getattr(hash,EnumMap,'$!storage')); + my Mu $iter := nqp::iterator(nqp::getattr(hash,Map,'$!storage')); my $e; while $iter { $e := nqp::shift($iter); diff --git a/src/vm/jvm/runtime/org/perl6/rakudo/Binder.java b/src/vm/jvm/runtime/org/perl6/rakudo/Binder.java index 671c466413f..640ca4848fe 100644 --- a/src/vm/jvm/runtime/org/perl6/rakudo/Binder.java +++ b/src/vm/jvm/runtime/org/perl6/rakudo/Binder.java @@ -494,7 +494,7 @@ else if ((paramFlags & SIG_ELEM_HASH_SIGIL) != 0) { if ((paramFlags & SIG_ELEM_IS_COPY) != 0) { SixModelObject BOOTHash = tc.gc.BOOTHash; bindee = gcx.Hash.st.REPR.allocate(tc, gcx.Hash.st); - bindee.bind_attribute_boxed(tc, gcx.EnumMap, "$!storage", + bindee.bind_attribute_boxed(tc, gcx.Map, "$!storage", HINT_ENUMMAP_storage, BOOTHash.st.REPR.allocate(tc, BOOTHash.st)); RakOps.p6store(bindee, decontValue, tc); } @@ -778,7 +778,7 @@ else if (i + 1 == numParams) { else if ((flags & SIG_ELEM_SLURPY_NAMED) != 0) { SixModelObject slurpy = vmHashOfRemainingNameds(tc, gcx, namedArgsCopy, args); SixModelObject bindee = gcx.Hash.st.REPR.allocate(tc, gcx.Hash.st); - bindee.bind_attribute_boxed(tc, gcx.EnumMap, "$!storage", + bindee.bind_attribute_boxed(tc, gcx.Map, "$!storage", HINT_ENUMMAP_storage, slurpy); bindFail = bindOneParam(tc, gcx, cf, param, bindee, CallSiteDescriptor.ARG_OBJ, noNomTypeCheck, error); diff --git a/src/vm/jvm/runtime/org/perl6/rakudo/RakOps.java b/src/vm/jvm/runtime/org/perl6/rakudo/RakOps.java index 349660a336f..32b1a8cbf57 100644 --- a/src/vm/jvm/runtime/org/perl6/rakudo/RakOps.java +++ b/src/vm/jvm/runtime/org/perl6/rakudo/RakOps.java @@ -41,7 +41,7 @@ public static class GlobalExt { public SixModelObject Array; public SixModelObject LoL; public SixModelObject Nil; - public SixModelObject EnumMap; + public SixModelObject Map; public SixModelObject Hash; public SixModelObject Junction; public SixModelObject Scalar; @@ -113,7 +113,7 @@ public static SixModelObject p6settypes(SixModelObject conf, ThreadContext tc) { gcx.Array = conf.at_key_boxed(tc, "Array"); gcx.LoL = conf.at_key_boxed(tc, "LoL"); gcx.Nil = conf.at_key_boxed(tc, "Nil"); - gcx.EnumMap = conf.at_key_boxed(tc, "EnumMap"); + gcx.Map = conf.at_key_boxed(tc, "Map"); gcx.Hash = conf.at_key_boxed(tc, "Hash"); gcx.Junction = conf.at_key_boxed(tc, "Junction"); gcx.Scalar = conf.at_key_boxed(tc, "Scalar"); diff --git a/tools/build/Makefile-JVM.in b/tools/build/Makefile-JVM.in index 2327d25da91..3496a9e439a 100644 --- a/tools/build/Makefile-JVM.in +++ b/tools/build/Makefile-JVM.in @@ -108,7 +108,7 @@ J_CORE_SOURCES = \ src/core/native_array.pm \ src/core/Enum.pm \ src/core/Pair.pm \ - src/core/EnumMap.pm \ + src/core/Map.pm \ src/core/Hash.pm \ src/core/Stash.pm \ src/core/Label.pm \ diff --git a/tools/build/moar_core_sources b/tools/build/moar_core_sources index 89512230eb5..4a8ef5f76c2 100644 --- a/tools/build/moar_core_sources +++ b/tools/build/moar_core_sources @@ -57,7 +57,7 @@ src/core/Array.pm src/core/native_array.pm src/core/Enum.pm src/core/Pair.pm -src/core/EnumMap.pm +src/core/Map.pm src/core/Hash.pm src/core/Stash.pm src/core/Label.pm