Created
October 16, 2012 11:55
-
-
Save jnthn/3898844 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
class X::Overload::Missing does X::Comp { | |
has $.type; | |
has $.method; | |
method message() { | |
"Method $.method of type $.type doesn't override anything" | |
} | |
} | |
multi trait_mod:<is>(Method:D $m, :$overload!) { | |
my $pkg := $m.signature.params[0].type; | |
my $m_name := $m.name; | |
for $pkg.HOW.parents($pkg) -> $p { | |
return if $p.HOW.methods($p).grep(*.name eq $m_name); | |
} | |
X::Overload::Missing.new(:type($pkg.HOW.name($pkg)), :method($m)).throw; | |
} | |
# testing... | |
class A { | |
#method foo {} | |
} | |
class B is A { | |
method foo is overload {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment