Skip to content

Commit

Permalink
switch IO, PseudoStash, traits, control.pm and stubs.pm to sigilless …
Browse files Browse the repository at this point in the history
…params
  • Loading branch information
moritz committed Aug 14, 2012
1 parent d3d3555 commit c9417ca
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/core/IO.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class IO does IO::FileTestable {
Bool::True Bool::True
} }


multi method say(IO:D: |$) { multi method say(IO:D: |) {
my Mu $args := pir::perl6_current_args_rpa__P(); my Mu $args := pir::perl6_current_args_rpa__P();
nqp::shift($args); nqp::shift($args);
self.print: nqp::shift($args).gist while $args; self.print: nqp::shift($args).gist while $args;
Expand Down
4 changes: 2 additions & 2 deletions src/core/PseudoStash.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ my class PseudoStash is EnumMap {
} }
} }


method bind_key($key is copy, \$value) { method bind_key($key is copy, \value) {
$key = $key.Str; $key = $key.Str;
if %pseudoers.exists($key) { if %pseudoers.exists($key) {
X::Bind.new(target => "pseudo-package $key").throw; X::Bind.new(target => "pseudo-package $key").throw;
} }
elsif $!mode == PRECISE_SCOPE { elsif $!mode == PRECISE_SCOPE {
my Mu $store := nqp::getattr(self, EnumMap, '$!storage'); my Mu $store := nqp::getattr(self, EnumMap, '$!storage');
nqp::bindkey($store, nqp::unbox_s($key), $value) nqp::bindkey($store, nqp::unbox_s($key), value)
} }
elsif $!mode == DYNAMIC_CHAIN || $!mode == PICK_CHAIN_BY_NAME && substr($key, 1, 1) eq '*' { elsif $!mode == DYNAMIC_CHAIN || $!mode == PICK_CHAIN_BY_NAME && substr($key, 1, 1) eq '*' {
die "Binding to dynamic variables not yet implemented"; die "Binding to dynamic variables not yet implemented";
Expand Down
24 changes: 12 additions & 12 deletions src/core/control.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ my class Nil { ... }
my class X::Eval::NoSuchLang { ... } my class X::Eval::NoSuchLang { ... }


my &THROW := my &THROW :=
-> |$ { -> | {
Q:PIR { Q:PIR {
.local pmc args, payload, type, severity, ex .local pmc args, payload, type, severity, ex
args = perl6_current_args_rpa args = perl6_current_args_rpa
Expand All @@ -21,62 +21,62 @@ my &THROW :=
0 0
}; };


my &RETURN-PARCEL := -> Mu \$parcel { my &RETURN-PARCEL := -> Mu \parcel {
my Mu $storage := nqp::getattr($parcel, Parcel, '$!storage'); my Mu $storage := nqp::getattr(parcel, Parcel, '$!storage');
nqp::iseq_i(nqp::elems($storage), 0) nqp::iseq_i(nqp::elems($storage), 0)
?? Nil ?? Nil
!! (nqp::iseq_i(nqp::elems($storage), 1) !! (nqp::iseq_i(nqp::elems($storage), 1)
?? nqp::shift($storage) ?? nqp::shift($storage)
!! $parcel) !! parcel)
} }


my &return-rw := -> |$ { my &return-rw := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
nqp::p6routinereturn($parcel); nqp::p6routinereturn($parcel);
$parcel $parcel
}; };
my &return := -> |$ { my &return := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
nqp::p6routinereturn(nqp::p6recont_ro($parcel)); nqp::p6routinereturn(nqp::p6recont_ro($parcel));
$parcel $parcel
}; };


my &take-rw := -> |$ { my &take-rw := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
THROW($parcel, pir::const::CONTROL_TAKE) THROW($parcel, pir::const::CONTROL_TAKE)
}; };
my &take := -> |$ { my &take := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
THROW(nqp::p6recont_ro($parcel), THROW(nqp::p6recont_ro($parcel),
pir::const::CONTROL_TAKE) pir::const::CONTROL_TAKE)
}; };


my &last := -> |$ { my &last := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
THROW(nqp::p6decont($parcel), THROW(nqp::p6decont($parcel),
pir::const::CONTROL_LOOP_LAST) pir::const::CONTROL_LOOP_LAST)
}; };


my &next := -> |$ { my &next := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
THROW(nqp::p6decont($parcel), THROW(nqp::p6decont($parcel),
pir::const::CONTROL_LOOP_NEXT) pir::const::CONTROL_LOOP_NEXT)
}; };


my &redo := -> |$ { my &redo := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
THROW(nqp::p6decont($parcel), THROW(nqp::p6decont($parcel),
pir::const::CONTROL_LOOP_REDO) pir::const::CONTROL_LOOP_REDO)
}; };


my &succeed := -> |$ { my &succeed := -> | {
my $parcel := my $parcel :=
&RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil)); &RETURN-PARCEL(nqp::p6parcel(pir::perl6_current_args_rpa__P(), Nil));
THROW(nqp::p6decont($parcel), THROW(nqp::p6decont($parcel),
Expand Down
2 changes: 1 addition & 1 deletion src/core/stubs.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sub DYNAMIC(\$name) is rw {
# actually appear in the setting). # actually appear in the setting).
{ {
my class Dummy { my class Dummy {
our proto method AUTOGEN(::T $: |$) { * } our proto method AUTOGEN(::T $: |) { * }
} }
Dummy.HOW.set_autogen_proto(&Dummy::AUTOGEN); Dummy.HOW.set_autogen_proto(&Dummy::AUTOGEN);
} }
Expand Down
34 changes: 17 additions & 17 deletions src/core/traits.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ multi trait_mod:<is>(Parameter:D $param, :$parcel!) {


# TODO: Make this much less cheaty. That'll probably need the # TODO: Make this much less cheaty. That'll probably need the
# full-blown serialization, though. # full-blown serialization, though.
sub EXPORT_SYMBOL(\$exp_name, @tags, Mu \$sym) { sub EXPORT_SYMBOL(\exp_name, @tags, Mu \sym) {
my @export_packages = $*EXPORT; my @export_packages = $*EXPORT;
for pir::perl6ize_type__PP(@*PACKAGES) { for pir::perl6ize_type__PP(@*PACKAGES) {
unless .WHO.exists('EXPORT') { unless .WHO.exists('EXPORT') {
Expand All @@ -100,29 +100,29 @@ sub EXPORT_SYMBOL(\$exp_name, @tags, Mu \$sym) {
$*W.pkg_compose($install_in); $*W.pkg_compose($install_in);
$*W.install_package_symbol($p, $tag, $install_in); $*W.install_package_symbol($p, $tag, $install_in);
} }
if $install_in.WHO.exists($exp_name) { if $install_in.WHO.exists(exp_name) {
unless ($install_in.WHO){$exp_name} =:= $sym { unless ($install_in.WHO){exp_name} =:= sym {
X::Export::NameClash.new(symbol => $exp_name).throw; X::Export::NameClash.new(symbol => exp_name).throw;
} }
} }
$*W.install_package_symbol($install_in, $exp_name, $sym); $*W.install_package_symbol($install_in, exp_name, sym);
} }
} }
} }
multi trait_mod:<is>(Routine:D \$r, :$export!) { multi trait_mod:<is>(Routine:D \r, :$export!) {
my $to_export := $r.multi ?? $r.dispatcher !! $r; my $to_export := r.multi ?? r.dispatcher !! r;
my $exp_name := '&' ~ $r.name; my $exp_name := '&' ~ r.name;
my @tags = 'ALL', ($export ~~ Pair ?? $export.key() !! my @tags = 'ALL', ($export ~~ Pair ?? $export.key() !!
$export ~~ Positional ?? @($export)>>.key !! $export ~~ Positional ?? @($export)>>.key !!
'DEFAULT'); 'DEFAULT');
EXPORT_SYMBOL($exp_name, @tags, $to_export); EXPORT_SYMBOL($exp_name, @tags, $to_export);
} }
multi trait_mod:<is>(Mu:U \$type, :$export!) { multi trait_mod:<is>(Mu:U \type, :$export!) {
my $exp_name := $type.HOW.name($type); my $exp_name := type.HOW.name(type);
my @tags = 'ALL', ($export ~~ Pair ?? $export.key !! my @tags = 'ALL', ($export ~~ Pair ?? $export.key !!
$export ~~ Positional ?? @($export)>>.key !! $export ~~ Positional ?? @($export)>>.key !!
'DEFAULT'); 'DEFAULT');
EXPORT_SYMBOL($exp_name, @tags, $type); EXPORT_SYMBOL($exp_name, @tags, type);
} }


multi trait_mod:<is>(Mu:D $docee, :$docs!) { multi trait_mod:<is>(Mu:D $docee, :$docs!) {
Expand Down Expand Up @@ -202,8 +202,8 @@ multi trait_mod:<handles>(Attribute:D $target, $thunk) {
} }


method add_delegator_method($attr: $pkg, $meth_name, $call_name) { method add_delegator_method($attr: $pkg, $meth_name, $call_name) {
my $meth := method (|$c) is rw { my $meth := method (|c) is rw {
$attr.get_value(self)."$call_name"(|$c) $attr.get_value(self)."$call_name"(|c)
}; };
$meth.set_name($meth_name); $meth.set_name($meth_name);
$pkg.HOW.add_method($pkg, $meth_name, $meth); $pkg.HOW.add_method($pkg, $meth_name, $meth);
Expand All @@ -229,8 +229,8 @@ multi trait_mod:<handles>(Attribute:D $target, $thunk) {
?($name ~~ $expr) ?($name ~~ $expr)
}, },
-> $obj, $name { -> $obj, $name {
-> $self, |$c { -> $self, |c {
$attr.get_value($self)."$name"(|$c) $attr.get_value($self)."$name"(|c)
} }
}); });
} }
Expand All @@ -241,8 +241,8 @@ multi trait_mod:<handles>(Attribute:D $target, $thunk) {
?$expr.can($name) ?$expr.can($name)
}, },
-> $obj, $name { -> $obj, $name {
-> $self, |$c { -> $self, |c {
$attr.get_value($self)."$name"(|$c) $attr.get_value($self)."$name"(|c)
} }
}); });
} }
Expand Down

0 comments on commit c9417ca

Please sign in to comment.