Skip to content

Commit 30a5cbb

Browse files
committed
Catch adding a null method - it's almost certainly a sign of a problem.
1 parent e199d50 commit 30a5cbb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/metamodel/how/NQPClassHOW.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ knowhow NQPClassHOW {
6161
if %!methods{$name} {
6262
pir::die("This class already has a method named " ~ $name);
6363
}
64+
if pir::isnull__IP($code_obj) || pir::isa__IPs($code_obj, 'Undef') {
65+
pir::die("Cannot add a null method '$name' to class '$!name'");
66+
}
6467
%!methods{$name} := $code_obj;
6568
}
6669

0 commit comments

Comments
 (0)