Skip to content

Commit

Permalink
Support for class Dog { does Smell }.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Dec 5, 2009
1 parent 1f1e259 commit 51c596c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -515,6 +515,16 @@ method package_declarator:sym<class>($/) { make $<package_def>.ast; }
method package_declarator:sym<grammar>($/) { make $<package_def>.ast; }
method package_declarator:sym<role>($/) { make $<package_def>.ast; }

method package_declarator:sym<does>($/) {
our @PACKAGE;
@PACKAGE[0].traits.push(PAST::Op.new(
:pasttype('call'),
:name('&trait_mod:<does>'),
$<typename>.ast
));
make PAST::Stmts.new();
}

method package_def($/, $key?) {
our @PACKAGE;

Expand Down
5 changes: 5 additions & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -466,6 +466,11 @@ token package_declarator:sym<role> {
<sym> <package_def>
}

token package_declarator:sym<does> {
<sym> <.ws>
<typename>
}

rule package_def {
:my $*IN_DECL := 'package';
<def_module_name>?
Expand Down

0 comments on commit 51c596c

Please sign in to comment.