Created
July 2, 2013 10:56
-
-
Save jnthn/5908412 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
index 371e8fe..c4da30d 100644 | |
--- a/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
+++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
@@ -83,23 +83,28 @@ my stub ForeignCode metaclass Perl6::Metamodel::ClassHOW { ... }; | |
BEGIN { | |
# Ensure Rakudo runtime support is initialized. | |
nqp::p6init(); | |
+ | |
+ # We'll want to get hold of static code refs for NQP subs. | |
+ sub staticcode($s) { | |
+ nqp::getstaticcode(nqp::getattr($s, NQPRoutine, '$!do')) | |
+ } | |
# class Mu { ... } | |
#?if parrot | |
Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_integer', | |
- nqp::getstaticcode(sub ($self) { | |
+ staticcode(sub ($self) { | |
nqp::unbox_i($self.Int()) | |
})); | |
Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_number', | |
- nqp::getstaticcode(sub ($self) { | |
+ staticcode(sub ($self) { | |
nqp::unbox_n($self.Num()) | |
})); | |
Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_string', | |
- nqp::getstaticcode(sub ($self) { | |
+ staticcode(sub ($self) { | |
nqp::unbox_s($self.Str()) | |
})); | |
Mu.HOW.add_parrot_vtable_mapping(Mu, 'defined', | |
- nqp::getstaticcode(sub ($self) { nqp::istrue($self.defined()) })); | |
+ staticcode(sub ($self) { nqp::istrue($self.defined()) })); | |
#?endif | |
Mu.HOW.compose_repr(Mu); | |
@@ -140,7 +145,7 @@ BEGIN { | |
# Need new and accessor methods for Attribute in here for now. | |
Attribute.HOW.add_method(Attribute, 'new', | |
- nqp::getstaticcode(sub ($self, :$name!, :$type!, :$package!, :$has_accessor, | |
+ staticcode(sub ($self, :$name!, :$type!, :$package!, :$has_accessor, | |
:$positional_delegate = 0, :$associative_delegate = 0, *%other) { | |
my $attr := nqp::create($self); | |
nqp::bindattr_s($attr, Attribute, '$!name', $name); | |
@@ -167,71 +172,71 @@ BEGIN { | |
nqp::bindattr_i($attr, Attribute, '$!associative_delegate', $associative_delegate); | |
$attr | |
})); | |
- Attribute.HOW.add_method(Attribute, 'name', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'name', staticcode(sub ($self) { | |
nqp::getattr_s(nqp::decont($self), | |
Attribute, '$!name'); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'type', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'type', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), | |
Attribute, '$!type'); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'container_descriptor', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'container_descriptor', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), | |
Attribute, '$!container_descriptor'); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'auto_viv_container', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'auto_viv_container', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), | |
Attribute, '$!auto_viv_container'); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'has_accessor', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'has_accessor', staticcode(sub ($self) { | |
nqp::p6bool(nqp::getattr_i(nqp::decont($self), | |
Attribute, '$!has_accessor')); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'rw', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'rw', staticcode(sub ($self) { | |
nqp::p6bool(nqp::getattr_i(nqp::decont($self), | |
Attribute, '$!rw')); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'set_rw', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'set_rw', staticcode(sub ($self) { | |
nqp::bindattr_i(nqp::decont($self), | |
Attribute, '$!rw', 1); | |
nqp::p6bool(1) | |
})); | |
- Attribute.HOW.add_method(Attribute, 'set_readonly', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'set_readonly', staticcode(sub ($self) { | |
nqp::bindattr_i(nqp::decont($self), | |
Attribute, '$!ro', 1); | |
nqp::p6bool(1) | |
})); | |
- Attribute.HOW.add_method(Attribute, 'default_to_rw', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'default_to_rw', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
unless nqp::getattr_i($dcself, Attribute, '$!ro') { | |
nqp::bindattr_i($dcself, Attribute, '$!rw', 1); | |
} | |
nqp::p6bool(1) | |
})); | |
- Attribute.HOW.add_method(Attribute, 'set_build', nqp::getstaticcode(sub ($self, $closure) { | |
+ Attribute.HOW.add_method(Attribute, 'set_build', staticcode(sub ($self, $closure) { | |
nqp::bindattr(nqp::decont($self), Attribute, '$!build_closure', $closure); | |
$self | |
})); | |
- Attribute.HOW.add_method(Attribute, 'build', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'build', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), | |
Attribute, '$!build_closure'); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'set_box_target', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'set_box_target', staticcode(sub ($self) { | |
nqp::bindattr_i(nqp::decont($self), | |
Attribute, '$!box_target', 1); | |
nqp::p6bool(1) | |
})); | |
- Attribute.HOW.add_method(Attribute, 'box_target', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'box_target', staticcode(sub ($self) { | |
nqp::getattr_i(nqp::decont($self), | |
Attribute, '$!box_target') | |
})); | |
- Attribute.HOW.add_method(Attribute, 'positional_delegate', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'positional_delegate', staticcode(sub ($self) { | |
nqp::getattr_i(nqp::decont($self), Attribute, '$!positional_delegate'); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'associative_delegate', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'associative_delegate', staticcode(sub ($self) { | |
nqp::getattr_i(nqp::decont($self), Attribute, '$!associative_delegate') | |
})); | |
- Attribute.HOW.add_method(Attribute, 'is_generic', nqp::getstaticcode(sub ($self) { | |
+ Attribute.HOW.add_method(Attribute, 'is_generic', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
my $type := nqp::getattr(nqp::decont($dcself), | |
Attribute, '$!type'); | |
@@ -241,7 +246,7 @@ BEGIN { | |
Attribute, '$!build_closure'); | |
nqp::p6bool($type.HOW.archetypes.generic || $package.HOW.archetypes.generic || nqp::defined($build)); | |
})); | |
- Attribute.HOW.add_method(Attribute, 'instantiate_generic', nqp::getstaticcode(sub ($self, $type_environment) { | |
+ Attribute.HOW.add_method(Attribute, 'instantiate_generic', staticcode(sub ($self, $type_environment) { | |
my $dcself := nqp::decont($self); | |
my $type := nqp::getattr($dcself, Attribute, '$!type'); | |
my $cd := nqp::getattr($dcself, Attribute, '$!container_descriptor'); | |
@@ -282,11 +287,11 @@ BEGIN { | |
Scalar.HOW.add_attribute(Scalar, BOOTSTRAPATTR.new(:name<$!descriptor>, :type(Mu), :package(Scalar))); | |
Scalar.HOW.add_attribute(Scalar, BOOTSTRAPATTR.new(:name<$!value>, :type(Mu), :package(Scalar))); | |
Scalar.HOW.add_attribute(Scalar, BOOTSTRAPATTR.new(:name<$!whence>, :type(Mu), :package(Scalar))); | |
- Scalar.HOW.add_method(Scalar, 'is_generic', nqp::getstaticcode(sub ($self) { | |
+ Scalar.HOW.add_method(Scalar, 'is_generic', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
nqp::getattr($dcself, Scalar, '$!descriptor').is_generic() | |
})); | |
- Scalar.HOW.add_method(Scalar, 'instantiate_generic', nqp::getstaticcode(sub ($self, $type_environment) { | |
+ Scalar.HOW.add_method(Scalar, 'instantiate_generic', staticcode(sub ($self, $type_environment) { | |
my $dcself := nqp::decont($self); | |
nqp::bindattr($dcself, Scalar, '$!descriptor', | |
nqp::getattr($dcself, Scalar, '$!descriptor').instantiate_generic( | |
@@ -314,14 +319,14 @@ BEGIN { | |
Proxy.HOW.add_parent(Proxy, Any); | |
Proxy.HOW.add_attribute(Proxy, BOOTSTRAPATTR.new(:name<&!FETCH>, :type(Mu), :package(Proxy))); | |
Proxy.HOW.add_attribute(Proxy, BOOTSTRAPATTR.new(:name<&!STORE>, :type(Mu), :package(Proxy))); | |
- Proxy.HOW.add_method(Proxy, 'FETCH', ($PROXY_FETCH := nqp::getstaticcode(sub ($cont) { | |
+ Proxy.HOW.add_method(Proxy, 'FETCH', ($PROXY_FETCH := staticcode(sub ($cont) { | |
nqp::decont( | |
nqp::getattr($cont, Proxy, '&!FETCH')(nqp::p6var($cont))) | |
}))); | |
- Proxy.HOW.add_method(Proxy, 'STORE', ($PROXY_STORE := nqp::getstaticcode(sub ($cont, $val) { | |
+ Proxy.HOW.add_method(Proxy, 'STORE', ($PROXY_STORE := staticcode(sub ($cont, $val) { | |
nqp::getattr($cont, Proxy, '&!STORE')(nqp::p6var($cont), $val) | |
}))); | |
- Proxy.HOW.add_method(Proxy, 'new', nqp::getstaticcode(sub ($type, :$FETCH, :$STORE) { | |
+ Proxy.HOW.add_method(Proxy, 'new', staticcode(sub ($type, :$FETCH, :$STORE) { | |
my $cont := nqp::create(Proxy); | |
nqp::bindattr($cont, Proxy, '&!FETCH', $FETCH); | |
nqp::bindattr($cont, Proxy, '&!STORE', $STORE); | |
@@ -362,7 +367,7 @@ BEGIN { | |
Signature.HOW.add_attribute(Signature, BOOTSTRAPATTR.new(:name<$!arity>, :type(Mu), :package(Signature))); | |
Signature.HOW.add_attribute(Signature, BOOTSTRAPATTR.new(:name<$!count>, :type(Mu), :package(Signature))); | |
Signature.HOW.add_attribute(Signature, BOOTSTRAPATTR.new(:name<$!code>, :type(Mu), :package(Signature))); | |
- Signature.HOW.add_method(Signature, 'is_generic', nqp::getstaticcode(sub ($self) { | |
+ Signature.HOW.add_method(Signature, 'is_generic', staticcode(sub ($self) { | |
# If any parameter is generic, so are we. | |
my @params := nqp::getattr($self, Signature, '$!params'); | |
for @params { | |
@@ -371,7 +376,7 @@ BEGIN { | |
} | |
return nqp::p6bool(0); | |
})); | |
- Signature.HOW.add_method(Signature, 'instantiate_generic', nqp::getstaticcode(sub ($self, $type_environment) { | |
+ Signature.HOW.add_method(Signature, 'instantiate_generic', staticcode(sub ($self, $type_environment) { | |
# Go through parameters, builidng new list. If any | |
# are generic, instantiate them. Otherwise leave them | |
# as they are. | |
@@ -389,11 +394,11 @@ BEGIN { | |
nqp::bindattr($ins, Signature, '$!params', @ins_params); | |
$ins | |
})); | |
- Signature.HOW.add_method(Signature, 'set_returns', nqp::getstaticcode(sub ($self, $type) { | |
+ Signature.HOW.add_method(Signature, 'set_returns', staticcode(sub ($self, $type) { | |
nqp::bindattr(nqp::decont($self), | |
Signature, '$!returns', nqp::decont($type)); | |
})); | |
- Signature.HOW.add_method(Signature, 'has_returns', nqp::getstaticcode(sub ($self) { | |
+ Signature.HOW.add_method(Signature, 'has_returns', staticcode(sub ($self) { | |
nqp::p6bool( | |
nqp::not_i( | |
nqp::isnull( | |
@@ -433,12 +438,12 @@ BEGIN { | |
Parameter.HOW.add_attribute(Parameter, BOOTSTRAPATTR.new(:name<$!default_value>, :type(Mu), :package(Parameter))); | |
Parameter.HOW.add_attribute(Parameter, BOOTSTRAPATTR.new(:name<$!container_descriptor>, :type(Mu), :package(Parameter))); | |
Parameter.HOW.add_attribute(Parameter, BOOTSTRAPATTR.new(:name<$!attr_package>, :type(Mu), :package(Parameter))); | |
- Parameter.HOW.add_method(Parameter, 'is_generic', nqp::getstaticcode(sub ($self) { | |
+ Parameter.HOW.add_method(Parameter, 'is_generic', staticcode(sub ($self) { | |
# If nonimnal type is generic, so are we. | |
my $type := nqp::getattr($self, Parameter, '$!nominal_type'); | |
nqp::p6bool($type.HOW.archetypes.generic) | |
})); | |
- Parameter.HOW.add_method(Parameter, 'instantiate_generic', nqp::getstaticcode(sub ($self, $type_environment) { | |
+ Parameter.HOW.add_method(Parameter, 'instantiate_generic', staticcode(sub ($self, $type_environment) { | |
# Clone with the type instantiated. | |
my $SIG_ELEM_NOMINAL_GENERIC := 524288; | |
my $ins := nqp::clone($self); | |
@@ -457,7 +462,7 @@ BEGIN { | |
nqp::bindattr($ins, Parameter, '$!container_descriptor', $ins_cd); | |
$ins | |
})); | |
- Parameter.HOW.add_method(Parameter, 'set_rw', nqp::getstaticcode(sub ($self) { | |
+ Parameter.HOW.add_method(Parameter, 'set_rw', staticcode(sub ($self) { | |
my $SIG_ELEM_IS_RW := 256; | |
my $SIG_ELEM_IS_OPTIONAL := 2048; | |
my $dcself := nqp::decont($self); | |
@@ -470,7 +475,7 @@ BEGIN { | |
nqp::bindattr_i($dcself, Parameter, '$!flags', $flags + $SIG_ELEM_IS_RW); | |
nqp::p6bool(nqp::defined($dcself)); | |
})); | |
- Parameter.HOW.add_method(Parameter, 'set_copy', nqp::getstaticcode(sub ($self) { | |
+ Parameter.HOW.add_method(Parameter, 'set_copy', staticcode(sub ($self) { | |
my $SIG_ELEM_IS_COPY := 512; | |
my $dcself := nqp::decont($self); | |
my $cd := nqp::getattr($dcself, Parameter, '$!container_descriptor'); | |
@@ -479,7 +484,7 @@ BEGIN { | |
nqp::getattr_i($dcself, Parameter, '$!flags') + $SIG_ELEM_IS_COPY); | |
$dcself | |
})); | |
- Parameter.HOW.add_method(Parameter, 'set_required', nqp::getstaticcode(sub ($self) { | |
+ Parameter.HOW.add_method(Parameter, 'set_required', staticcode(sub ($self) { | |
my $SIG_ELEM_IS_OPTIONAL := 2048; | |
my $dcself := nqp::decont($self); | |
my $flags := nqp::getattr_i($dcself, Parameter, '$!flags'); | |
@@ -489,7 +494,7 @@ BEGIN { | |
} | |
$dcself | |
})); | |
- Parameter.HOW.add_method(Parameter, 'set_parcel', nqp::getstaticcode(sub ($self) { | |
+ Parameter.HOW.add_method(Parameter, 'set_parcel', staticcode(sub ($self) { | |
my $SIG_ELEM_IS_PARCEL := 1024; | |
my $dcself := nqp::decont($self); | |
my $flags := nqp::getattr_i($dcself, Parameter, '$!flags'); | |
@@ -499,7 +504,7 @@ BEGIN { | |
} | |
$dcself | |
})); | |
- Parameter.HOW.add_method(Parameter, 'set_coercion', nqp::getstaticcode(sub ($self, $type) { | |
+ Parameter.HOW.add_method(Parameter, 'set_coercion', staticcode(sub ($self, $type) { | |
my $dcself := nqp::decont($self); | |
nqp::bindattr_s($dcself, Parameter, '$!coerce_method', $type.HOW.name($type)); | |
nqp::bindattr($dcself, Parameter, '$!coerce_type', $type); | |
@@ -519,7 +524,7 @@ BEGIN { | |
Code.HOW.add_attribute(Code, BOOTSTRAPATTR.new(:name<$!compstuff>, :type(Mu), :package(Code))); | |
# Need clone in here, plus generics instantiation. | |
- Code.HOW.add_method(Code, 'clone', nqp::getstaticcode(sub ($self) { | |
+ Code.HOW.add_method(Code, 'clone', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
my $cloned := nqp::clone($dcself); | |
my $do := nqp::getattr($dcself, Code, '$!do'); | |
@@ -532,12 +537,12 @@ BEGIN { | |
} | |
$cloned | |
})); | |
- Code.HOW.add_method(Code, 'is_generic', nqp::getstaticcode(sub ($self) { | |
+ Code.HOW.add_method(Code, 'is_generic', staticcode(sub ($self) { | |
# Delegate to signature, since it contains all the type info. | |
my $dc_self := nqp::decont($self); | |
nqp::getattr($dc_self, Code, '$!signature').is_generic() | |
})); | |
- Code.HOW.add_method(Code, 'instantiate_generic', nqp::getstaticcode(sub ($self, $type_environment) { | |
+ Code.HOW.add_method(Code, 'instantiate_generic', staticcode(sub ($self, $type_environment) { | |
# Clone the code object, then instantiate the generic signature. Also | |
# need to clone dispatchees list. | |
my $dcself := nqp::decont($self); | |
@@ -551,16 +556,16 @@ BEGIN { | |
$sig.instantiate_generic($type_environment)); | |
$ins | |
})); | |
- Code.HOW.add_method(Code, 'name', nqp::getstaticcode(sub ($self) { | |
+ Code.HOW.add_method(Code, 'name', staticcode(sub ($self) { | |
nqp::getcodename(nqp::getattr(nqp::decont($self), | |
Code, '$!do')) | |
})); | |
- Code.HOW.add_method(Code, 'set_name', nqp::getstaticcode(sub ($self, $name) { | |
+ Code.HOW.add_method(Code, 'set_name', staticcode(sub ($self, $name) { | |
nqp::setcodename( | |
nqp::getattr(nqp::decont($self), Code, '$!do'), | |
$name) | |
})); | |
- Code.HOW.add_method(Code, 'id', nqp::getstaticcode(sub ($self) { | |
+ Code.HOW.add_method(Code, 'id', staticcode(sub ($self) { | |
nqp::where(nqp::getattr(nqp::decont($self), | |
Code, '$!do')) | |
})); | |
@@ -574,7 +579,7 @@ BEGIN { | |
# class Block is Code { ... } | |
Block.HOW.add_parent(Block, Code); | |
Block.HOW.add_attribute(Block, BOOTSTRAPATTR.new(:name<$!phasers>, :type(Mu), :package(Block))); | |
- Block.HOW.add_method(Block, 'clone', nqp::getstaticcode(sub ($self) { | |
+ Block.HOW.add_method(Block, 'clone', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
my $cloned := nqp::clone($dcself); | |
my $do := nqp::getattr($dcself, Code, '$!do'); | |
@@ -603,12 +608,12 @@ BEGIN { | |
Routine.HOW.add_attribute(Routine, BOOTSTRAPATTR.new(:name<$!dispatch_order>, :type(Mu), :package(Routine))); | |
Routine.HOW.add_attribute(Routine, BOOTSTRAPATTR.new(:name<$!dispatch_cache>, :type(Mu), :package(Routine))); | |
- Routine.HOW.add_method(Routine, 'is_dispatcher', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'is_dispatcher', staticcode(sub ($self) { | |
my $dc_self := nqp::decont($self); | |
my $disp_list := nqp::getattr($dc_self, Routine, '$!dispatchees'); | |
nqp::p6bool(nqp::defined($disp_list)); | |
})); | |
- Routine.HOW.add_method(Routine, 'add_dispatchee', nqp::getstaticcode(sub ($self, $dispatchee) { | |
+ Routine.HOW.add_method(Routine, 'add_dispatchee', staticcode(sub ($self, $dispatchee) { | |
my $dc_self := nqp::decont($self); | |
my $disp_list := nqp::getattr($dc_self, Routine, '$!dispatchees'); | |
if nqp::defined($disp_list) { | |
@@ -626,21 +631,21 @@ BEGIN { | |
nqp::die("Cannot add a dispatchee to a non-dispatcher code object"); | |
} | |
})); | |
- Routine.HOW.add_method(Routine, 'derive_dispatcher', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'derive_dispatcher', staticcode(sub ($self) { | |
my $clone := $self.clone(); | |
nqp::bindattr($clone, Routine, '$!dispatchees', | |
nqp::clone(nqp::getattr($self, Routine, '$!dispatchees'))); | |
$clone | |
})); | |
- Routine.HOW.add_method(Routine, 'dispatcher', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'dispatcher', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), | |
Routine, '$!dispatcher') | |
})); | |
- Routine.HOW.add_method(Routine, 'dispatchees', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'dispatchees', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), | |
Routine, '$!dispatchees') | |
})); | |
- Routine.HOW.add_method(Routine, '!sort_dispatchees_internal', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, '!sort_dispatchees_internal', staticcode(sub ($self) { | |
my int $SLURPY_ARITY := nqp::bitshiftl_i(1, 30); | |
my int $EDGE_REMOVAL_TODO := -1; | |
my int $EDGE_REMOVED := -2; | |
@@ -926,14 +931,14 @@ BEGIN { | |
@result | |
})); | |
- Routine.HOW.add_method(Routine, 'sort_dispatchees', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'sort_dispatchees', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
unless nqp::isnull(nqp::getattr($dcself, Routine, '$!dispatch_order')) { | |
nqp::bindattr($dcself, Routine, '$!dispatch_order', | |
$self.'!sort_dispatchees_internal'()); | |
} | |
})); | |
- Routine.HOW.add_method(Routine, 'find_best_dispatchee', nqp::getstaticcode(sub ($self, $capture, int $many = 0) { | |
+ Routine.HOW.add_method(Routine, 'find_best_dispatchee', staticcode(sub ($self, $capture, int $many = 0) { | |
my int $DEFCON_DEFINED := 1; | |
my int $DEFCON_UNDEFINED := 2; | |
my int $DEFCON_MASK := $DEFCON_DEFINED +| $DEFCON_UNDEFINED; | |
@@ -1220,7 +1225,7 @@ BEGIN { | |
} | |
} | |
})); | |
- Routine.HOW.add_method(Routine, 'analyze_dispatch', nqp::getstaticcode(sub ($self, @args, @flags) { | |
+ Routine.HOW.add_method(Routine, 'analyze_dispatch', staticcode(sub ($self, @args, @flags) { | |
# Compile time dispatch result. | |
my $MD_CT_NOT_SURE := 0; # Needs a runtime dispatch. | |
my $MD_CT_DECIDED := 1; # Worked it out; see result. | |
@@ -1408,21 +1413,21 @@ BEGIN { | |
# Otherwise, dunno...we'll have to find out at runtime. | |
return [$MD_CT_NOT_SURE, NQPMu]; | |
})); | |
- Routine.HOW.add_method(Routine, 'set_rw', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'set_rw', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
nqp::bindattr_i($dcself, Routine, '$!rw', 1); | |
$dcself | |
})); | |
- Routine.HOW.add_method(Routine, 'set_inline_info', nqp::getstaticcode(sub ($self, $info) { | |
+ Routine.HOW.add_method(Routine, 'set_inline_info', staticcode(sub ($self, $info) { | |
my $dcself := nqp::decont($self); | |
nqp::bindattr($dcself, Routine, '$!inline_info', $info); | |
$dcself | |
})); | |
- Routine.HOW.add_method(Routine, 'inline_info', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'inline_info', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
nqp::getattr($dcself, Routine, '$!inline_info') | |
})); | |
- Routine.HOW.add_method(Routine, 'set_onlystar', nqp::getstaticcode(sub ($self) { | |
+ Routine.HOW.add_method(Routine, 'set_onlystar', staticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
nqp::bindattr_i($dcself, Routine, '$!onlystar', 1); | |
$dcself | |
@@ -1450,13 +1455,13 @@ BEGIN { | |
Regex.HOW.add_attribute(Regex, scalar_attr('$!caps', Mu, Regex)); | |
Regex.HOW.add_attribute(Regex, scalar_attr('$!nfa', Mu, Regex)); | |
Regex.HOW.add_attribute(Regex, scalar_attr('$!alt_nfas', Mu, Regex)); | |
- Regex.HOW.add_method(Regex, 'SET_CAPS', nqp::getstaticcode(sub ($self, $caps) { | |
+ Regex.HOW.add_method(Regex, 'SET_CAPS', staticcode(sub ($self, $caps) { | |
nqp::bindattr(nqp::decont($self), Regex, '$!caps', $caps) | |
})); | |
- Regex.HOW.add_method(Regex, 'SET_NFA', nqp::getstaticcode(sub ($self, $nfa) { | |
+ Regex.HOW.add_method(Regex, 'SET_NFA', staticcode(sub ($self, $nfa) { | |
nqp::bindattr(nqp::decont($self), Regex, '$!nfa', $nfa) | |
})); | |
- Regex.HOW.add_method(Regex, 'SET_ALT_NFA', nqp::getstaticcode(sub ($self, str $name, $nfa) { | |
+ Regex.HOW.add_method(Regex, 'SET_ALT_NFA', staticcode(sub ($self, str $name, $nfa) { | |
my %alts := nqp::getattr(nqp::decont($self), Regex, '$!alt_nfas'); | |
unless %alts { | |
%alts := nqp::hash(); | |
@@ -1464,13 +1469,13 @@ BEGIN { | |
} | |
nqp::bindkey(%alts, $name, $nfa); | |
})); | |
- Regex.HOW.add_method(Regex, 'CAPS', nqp::getstaticcode(sub ($self) { | |
+ Regex.HOW.add_method(Regex, 'CAPS', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), Regex, '$!caps') | |
})); | |
- Regex.HOW.add_method(Regex, 'NFA', nqp::getstaticcode(sub ($self) { | |
+ Regex.HOW.add_method(Regex, 'NFA', staticcode(sub ($self) { | |
nqp::getattr(nqp::decont($self), Regex, '$!nfa') | |
})); | |
- Regex.HOW.add_method(Regex, 'ALT_NFA', nqp::getstaticcode(sub ($self, str $name) { | |
+ Regex.HOW.add_method(Regex, 'ALT_NFA', staticcode(sub ($self, str $name) { | |
nqp::atkey( | |
nqp::getattr(nqp::decont($self), Regex, '$!alt_nfas'), | |
$name) | |
@@ -1488,7 +1493,7 @@ BEGIN { | |
Str.HOW.publish_boolification_spec(Str); | |
#?if parrot | |
Str.HOW.add_parrot_vtable_mapping(Str, 'get_string', | |
- nqp::getstaticcode(sub ($self) { | |
+ staticcode(sub ($self) { | |
nqp::unbox_s($self) | |
})); | |
#?endif | |
@@ -1683,7 +1688,7 @@ BEGIN { | |
# Default invocation behavior delegates off to postcircumfix:<( )>. | |
my $invoke_forwarder := | |
- nqp::getstaticcode(sub ($self, *@pos, *%named) { | |
+ staticcode(sub ($self, *@pos, *%named) { | |
if !nqp::isconcrete($self) && !nqp::can($self, 'postcircumfix:<( )>') { | |
my $coercer_name := $self.HOW.name($self); | |
if +@pos == 1 { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment