Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Forbid classes inheriting from themselves.
  • Loading branch information
jnthn committed May 13, 2011
1 parent 509350b commit ad31d07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/how/NQPClassHOW.pm
Expand Up @@ -93,6 +93,9 @@ knowhow NQPClassHOW {
if $!composed {
pir::die("NQPClassHOW does not support adding parents after being composed.");
}
if $obj =:= $parent {
pir::die("Class '$!name' cannot inherit from itself.");
}
for @!parents {
if $_ =:= $parent {
pir::die("Already have " ~ $parent ~ " as a parent class.");
Expand Down

0 comments on commit ad31d07

Please sign in to comment.