Changing method combination would delete methods

db4
Slava Pestov 2008-05-10 15:56:30 -05:00
parent 1c7b9079a9
commit 5d61651cb2
2 changed files with 32 additions and 6 deletions

View File

@ -123,12 +123,13 @@ M: method-body definer
M: method-body forget*
dup "forgotten" word-prop [ drop ] [
[
[ ]
[ "method-class" word-prop ]
[ "method-generic" word-prop ] bi
dup generic? [
[ delete-at* ] with-methods
[ call-next-method ] [ drop ] if
] [ 2drop ] if
[ "method-generic" word-prop ] tri
3dup method eq? [
[ delete-at ] with-methods
call-next-method
] [ 3drop ] if
]
[ t "forgotten" set-word-prop ] bi
] if ;

View File

@ -435,3 +435,28 @@ must-fail-with
[ 92 ] [ "CHAR: \\" eval ] unit-test
[ 92 ] [ "CHAR: \\\\" eval ] unit-test
[ ] [
{
"IN: parser.tests"
"USING: math arrays ;"
"GENERIC: change-combination"
"M: integer change-combination 1 ;"
"M: array change-combination 2 ;"
} "\n" join <string-reader> "change-combination-test" parse-stream drop
] unit-test
[ ] [
{
"IN: parser.tests"
"USING: math arrays ;"
"GENERIC# change-combination 1"
"M: integer change-combination 1 ;"
"M: array change-combination 2 ;"
} "\n" join <string-reader> "change-combination-test" parse-stream drop
] unit-test
[ 2 ] [
"change-combination" "parser.tests" lookup
"methods" word-prop assoc-size
] unit-test