Skip to content

Commit

Permalink
Make sure that since we build meta-ops once globally, we install them…
Browse files Browse the repository at this point in the history
… at the top of the tree, otherwise we get nasty problems. This uncovered a bootstrapping issue, so done a little re-ordering.
  • Loading branch information
jnthn committed May 22, 2010
1 parent 1499f20 commit 5cb546e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build/Makefile.in
Expand Up @@ -164,6 +164,7 @@ CHEATS_PIR = \

CORE_SOURCES = \
src/core/traits.pm \
src/core/metaops.pm \
src/core/operators.pm \
src/glue/subset.pm \
src/cheats/trait-export.pm \
Expand Down Expand Up @@ -193,7 +194,6 @@ CORE_SOURCES = \
src/core/Pair.pm \
src/core/Range.pm \
src/core/RangeIter.pm \
src/core/metaops.pm \
src/core/EnumMap.pm \
src/core/Hash.pm \
src/core/Enum.pm \
Expand Down
19 changes: 13 additions & 6 deletions src/Perl6/Actions.pm
Expand Up @@ -2078,7 +2078,7 @@ method prefixish($/) {
my $opsub := '&prefix:<' ~ $<OPER>.Str ~ '<<>';
unless %*METAOPGEN{$opsub} {
my $base_op := '&prefix:<' ~ $<OPER>.Str ~ '>';
@BLOCK[0].loadinit.push(PAST::Op.new(
get_outermost_block().loadinit.push(PAST::Op.new(
:pasttype('bind'),
PAST::Var.new( :name($opsub), :scope('package') ),
PAST::Op.new(
Expand All @@ -2098,7 +2098,7 @@ method infixish($/) {
my $sym := ~$<infix><sym>;
my $opsub := "&infix:<$sym=>";
unless %*METAOPGEN{$opsub} {
@BLOCK[0].loadinit.push(
get_outermost_block().loadinit.push(
PAST::Op.new( :name('!gen_assign_metaop'), $sym,
:pasttype('call') )
);
Expand Down Expand Up @@ -2129,7 +2129,7 @@ method infixish($/) {
$helper := '&zipwith';
}

@BLOCK[0].loadinit.push(
get_outermost_block().loadinit.push(
PAST::Op.new( :pasttype('bind'),
PAST::Var.new( :name($opsub), :scope('package') ),
PAST::Op.new( :pasttype('callmethod'),
Expand All @@ -2149,7 +2149,7 @@ method prefix_circumfix_meta_operator:sym<reduce>($/) {
my $opsub := '&prefix:<' ~ ~$/ ~ '>';
unless %*METAOPGEN{$opsub} {
my $base_op := '&infix:<' ~ $<op>.Str ~ '>';
@BLOCK[0].loadinit.push(PAST::Op.new(
get_outermost_block().loadinit.push(PAST::Op.new(
:pasttype('bind'),
PAST::Var.new( :name($opsub), :scope('package') ),
PAST::Op.new(
Expand Down Expand Up @@ -2180,7 +2180,7 @@ sub make_hyperop($/) {
my $base_op := '&infix:<' ~ $<infixish>.Str ~ '>';
my $dwim_lhs := $<opening> eq '<<' || $<opening> eq '«';
my $dwim_rhs := $<closing> eq '>>' || $<closing> eq '»';
@BLOCK[0].loadinit.push(PAST::Op.new(
get_outermost_block().loadinit.push(PAST::Op.new(
:pasttype('bind'),
PAST::Var.new( :name($opsub), :scope('package') ),
PAST::Op.new(
Expand Down Expand Up @@ -2213,7 +2213,7 @@ method postfixish($/) {
my $opsub := '&postfix:<>>' ~ $<OPER>.Str ~ '>';
unless %*METAOPGEN{$opsub} {
my $base_op := '&postfix:<' ~ $<OPER>.Str ~ '>';
@BLOCK[0].loadinit.push(PAST::Op.new(
get_outermost_block().loadinit.push(PAST::Op.new(
:pasttype('bind'),
PAST::Var.new( :name($opsub), :scope('package') ),
PAST::Op.new(
Expand Down Expand Up @@ -2949,6 +2949,13 @@ sub is_lexical($name) {
return 0;
}

# Gets the outermost block. We sometimes want to install global things in
# it, e.g. generated meta-ops.
sub get_outermost_block() {
our @BLOCK;
return @BLOCK[+@BLOCK - 1];
}

# Looks to see if a variable has been set up as an alias to an attribute.
sub is_attr_alias($name) {
our @BLOCK;
Expand Down

0 comments on commit 5cb546e

Please sign in to comment.