diff --git a/basis/stack-checker/transforms/transforms.factor b/basis/stack-checker/transforms/transforms.factor index e4f8c50eeb..6e11eb1189 100644 --- a/basis/stack-checker/transforms/transforms.factor +++ b/basis/stack-checker/transforms/transforms.factor @@ -90,8 +90,12 @@ IN: stack-checker.transforms \ spread [ spread>quot ] 1 define-transform \ (call-next-method) [ - [ [ inlined-dependency depends-on ] bi@ ] [ next-method-quot ] 2bi -] 2 define-transform + [ + [ "method-class" word-prop ] + [ "method-generic" word-prop ] bi + [ inlined-dependency depends-on ] bi@ + ] [ next-method-quot ] bi +] 1 define-transform ! Constructors \ boa [ diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor index b5f22ec120..35029a3fb0 100644 --- a/core/generic/generic-docs.factor +++ b/core/generic/generic-docs.factor @@ -162,6 +162,6 @@ HELP: forget-methods { sort-classes order } related-words HELP: (call-next-method) -{ $values { "class" class } { "generic" generic } } +{ $values { "method" method-body } } { $description "Low-level word implementing " { $link POSTPONE: call-next-method } "." } { $notes "In most cases, " { $link POSTPONE: call-next-method } " should be used instead." } ; diff --git a/core/generic/generic.factor b/core/generic/generic.factor index e2818a51b2..8d7ed4cb60 100644 --- a/core/generic/generic.factor +++ b/core/generic/generic.factor @@ -49,12 +49,16 @@ GENERIC: effective-method ( generic -- method ) GENERIC: next-method-quot* ( class generic combination -- quot ) -: next-method-quot ( class generic -- quot ) +: next-method-quot ( method -- quot ) next-method-quot-cache get [ - dup "combination" word-prop next-method-quot* - ] 2cache ; + [ "method-class" word-prop ] + [ + "method-generic" word-prop + dup "combination" word-prop + ] bi next-method-quot* + ] cache ; -: (call-next-method) ( class generic -- ) +: (call-next-method) ( method -- ) next-method-quot call ; TUPLE: check-method class generic ; diff --git a/core/generic/parser/parser.factor b/core/generic/parser/parser.factor index 7380399b5c..c6420164d2 100644 --- a/core/generic/parser/parser.factor +++ b/core/generic/parser/parser.factor @@ -13,17 +13,10 @@ ERROR: not-in-a-method-error ; : CREATE-METHOD ( -- method ) scan-word bootstrap-word scan-word create-method-in ; -SYMBOL: current-class -SYMBOL: current-generic +SYMBOL: current-method -: with-method-definition ( quot -- parsed ) - [ - [ - [ "method-class" word-prop current-class set ] - [ "method-generic" word-prop current-generic set ] - [ ] tri - ] dip call - ] with-scope ; inline +: with-method-definition ( method quot -- ) + [ dup current-method ] dip with-variable ; inline : (M:) ( method def -- ) CREATE-METHOD [ parse-definition ] with-method-definition ; diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 105bdc325f..7ab2eefcb9 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -202,13 +202,12 @@ IN: bootstrap.syntax ] define-syntax "call-next-method" [ - current-class get current-generic get - 2dup [ word? ] both? [ - [ literalize parsed ] bi@ + current-method get [ + literalize parsed \ (call-next-method) parsed ] [ not-in-a-method-error - ] if + ] if* ] define-syntax "initial:" "syntax" lookup define-symbol