Skip to content

Commit

Permalink
Push automatic is Any down and out of the parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jul 22, 2010
1 parent 2ed08c1 commit e337510
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
3 changes: 3 additions & 0 deletions Decl.pm
Expand Up @@ -240,6 +240,9 @@ use CgOp;
CgOp::wrap(CgOp::clr_string($self->name // 'ANON'))),

CgOp::proto_var($self->var . '!HOW', CgOp::letvar("how")),
((grep { $_->isa('Decl::Super') } @{ $self->body->decls }) ? () :
CgOp::sink(CgOp::methodcall(CgOp::letvar("how"), "add-super",
CgOp::scopedlex("Any!HOW")))),

# TODO: Initialize the protoobject to a failure here so an awesome
# error is produced if someone tries to use an incomplete class in
Expand Down
17 changes: 2 additions & 15 deletions Niecza/Actions.pm
Expand Up @@ -959,21 +959,8 @@ sub package_def { my ($cl, $M) = @_;
my $blocktype = $::PKGDECL;
my $bodyvar = $cl->gensym;

if (($blocktype eq 'class' || $blocktype eq 'grammar')
&& !$M->{decl}{stub}) {
unshift @{ $::CURLEX->{'!decls'} //= [] },
map { $_->{_ast} } @{ $M->{trait} };

AUTOANY: {
for my $d (@{ $::CURLEX->{'!decls'} //= [] }) {
next unless $d->isa('Decl::Super');
last AUTOANY;
}

$cl->add_decl(Decl::Super->new(name => ($blocktype eq 'grammar' ?
'Cursor' : 'Any')));
}
}
unshift @{ $::CURLEX->{'!decls'} //= [] },
map { $_->{_ast} } @{ $M->{trait} };

if (!$M->{decl}{stub}) {
my $stmts = $M->{statementlist} // $M->{blockoid};
Expand Down

0 comments on commit e337510

Please sign in to comment.