Skip to content

Commit

Permalink
Remove $/ support from CompilerServices
Browse files Browse the repository at this point in the history
This reverts the first commit (and subsequent commits related to this)
that dogbert++ found to be the first that caused failures for him.
  • Loading branch information
lizmat committed Sep 29, 2017
1 parent 03b1feb commit 4959df3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
34 changes: 11 additions & 23 deletions src/Perl6/World.nqp
Expand Up @@ -2950,7 +2950,7 @@ class Perl6::World is HLL::World {

# Composes the package, and stores an event for this action.
method pkg_compose($/, $obj) {
my $compiler_services := self.get_compiler_services($/);
my $compiler_services := self.get_compiler_services;
if nqp::isconcrete($compiler_services) {
self.ex-handle($/, { $obj.HOW.compose($obj, :$compiler_services) })
}
Expand All @@ -2968,7 +2968,7 @@ class Perl6::World is HLL::World {
has $!acc_sig_cache;
has $!acc_sig_cache_type;

method generate_accessor($/, str $meth_name, $package_type, str $attr_name, $type, int $rw) {
method generate_accessor(str $meth_name, $package_type, str $attr_name, $type, int $rw) {
my $native := nqp::objprimspec($type) != 0;
my $acc := QAST::Var.new(
:scope($native && $rw ?? 'attributeref' !! 'attribute'),
Expand All @@ -2985,7 +2985,6 @@ class Perl6::World is HLL::World {
my $block := QAST::Block.new(
:name($meth_name), :blocktype('declaration_static'),
QAST::Stmts.new(
:node($/),
QAST::Var.new(
:decl('param'), :scope('local'), :name('self')
),
Expand Down Expand Up @@ -3034,7 +3033,7 @@ class Perl6::World is HLL::World {
# attributes. Basically a flattened version of Mu.BUILDALL, which
# iterates over the BUILDALLPLAN at runtime with fewer inlining
# and JITting opportunities.
method generate_buildplan_executor($/, $in_object, $in_build_plan) {
method generate_buildplan_executor($in_object, $in_build_plan) {

# low level hash access
my $build_plan := nqp::getattr(
Expand All @@ -3060,7 +3059,7 @@ class Perl6::World is HLL::World {

# The basic statements for object initialization, to be
# filled in later
my $stmts := QAST::Stmts.new(:node($/));
my $stmts := QAST::Stmts.new();

my $declarations := QAST::Stmts.new(
QAST::Var.new(:decl<param>, :scope<local>, :name<self>),
Expand Down Expand Up @@ -3492,24 +3491,13 @@ class Perl6::World is HLL::World {
}
}

method get_compiler_services($/) {
if nqp::isconcrete($!compiler_services) {
nqp::bindattr(
$!compiler_services,
$!compiler_services.WHAT,
'$!current-match',
$/
);
}
else {
try {
my $wtype := self.find_symbol(['Rakudo', 'Internals', 'CompilerServices']);
my $wrapped := CompilerServices.new(w => self);
my $wrapper := nqp::create($wtype);
nqp::bindattr($wrapper, $wtype, '$!compiler', $wrapped);
nqp::bindattr($wrapper, $wtype, '$!current-match', $/);
$!compiler_services := $wrapper;
}
method get_compiler_services() {
try {
my $wtype := self.find_symbol(['Rakudo', 'Internals', 'CompilerServices']);
my $wrapped := CompilerServices.new(w => self);
my $wrapper := nqp::create($wtype);
nqp::bindattr($wrapper, $wtype, '$!compiler', $wrapped);
$!compiler_services := $wrapper;
}
$!compiler_services
}
Expand Down
6 changes: 2 additions & 4 deletions src/core/Rakudo/Internals.pm
Expand Up @@ -19,15 +19,13 @@ my class Rakudo::Internals {

our class CompilerServices {
has Mu $!compiler;
has Mu $!current-match;

method generate_accessor(str $name, Mu \package_type, str $attr_name, Mu \type, int $rw) {
$!compiler.generate_accessor(
$!current-match, $name, package_type, $attr_name, type, $rw);
$name, package_type, $attr_name, type, $rw);
}
method generate_buildplan_executor(Mu \obj, Mu \buildplan) {
$!compiler.generate_buildplan_executor(
$!current-match, obj, buildplan)
$!compiler.generate_buildplan_executor(obj, buildplan)
}
}

Expand Down

0 comments on commit 4959df3

Please sign in to comment.