Skip to content

Commit

Permalink
Implement "grammar"
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jul 24, 2010
1 parent 1e1b8ee commit 52f6d38
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Decl.pm
Expand Up @@ -360,12 +360,14 @@ use CgOp;
CgOp::wrap(CgOp::clr_string($self->name // 'ANON')));
}

sub defsuper { 'Any!HOW' }

sub finish_obj {
my ($self) = @_;
my @r;
if (!grep { $_->isa('Decl::Super') } $self->body->do->local_decls) {
push @r, CgOp::sink(CgOp::methodcall(CgOp::letvar("how"),
"add-super", CgOp::scopedlex("Any!HOW")));
"add-super", CgOp::scopedlex($self->defsuper)));
}
@r, CgOp::scopedlex($self->var,
CgOp::methodcall(CgOp::letvar("how"), "create-protoobject"));
Expand All @@ -375,6 +377,17 @@ use CgOp;
no Moose;
}

{
package Decl::Grammar;
use Moose;
extends 'Decl::Class';

sub defsuper { 'Grammar!HOW' }

__PACKAGE__->meta->make_immutable;
no Moose;
}

{
package Decl::HasMethod;
use Moose;
Expand Down
11 changes: 11 additions & 0 deletions Op.pm
Expand Up @@ -472,6 +472,17 @@ use CgOp;
no Moose;
}

{
package Op::GrammarDef;
use Moose;
extends 'Op::ClassDef';

sub decl_class { 'Decl::Grammar' }

__PACKAGE__->meta->make_immutable;
no Moose;
}

{
package Op::PreInit;
use Moose;
Expand Down

0 comments on commit 52f6d38

Please sign in to comment.