Fix delegate for slot property change, declarations and inheritance

db4
Slava Pestov 2008-07-14 13:37:24 -05:00
parent 021fce44ba
commit 54fc3316fa
3 changed files with 19 additions and 4 deletions

View File

@ -0,0 +1 @@

View File

@ -79,3 +79,15 @@ CONSULT: beta hey value>> 1- ;
[ -1 ] [ 1 <hey> four ] unit-test
[ ] [ "IN: delegate.tests FORGET: alpha" eval ] unit-test
[ f ] [ hey \ one method ] unit-test
TUPLE: slot-protocol-test-1 a b ;
TUPLE: slot-protocol-test-2 < slot-protocol-test-1 { c integer } ;
TUPLE: slot-protocol-test-3 d ;
CONSULT: slot-protocol-test-2 slot-protocol-test-3 d>> ;
[ "a" "b" 5 ] [
T{ slot-protocol-test-3 f T{ slot-protocol-test-2 f "a" "b" 5 } }
[ a>> ] [ b>> ] [ c>> ] tri
] unit-test

View File

@ -1,4 +1,4 @@
! Copyright (C) 2007 Daniel Ehrenberg
! Copyright (C) 2007, 2008 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: accessors parser generic kernel classes classes.tuple
words slots assocs sequences arrays vectors definitions
@ -14,9 +14,11 @@ IN: delegate
GENERIC: group-words ( group -- words )
M: tuple-class group-words
"slot-names" word-prop [
[ reader-word ] [ writer-word ] bi
2array [ 0 2array ] map
all-slots [
name>>
[ reader-word 0 2array ]
[ writer-word 0 2array ] bi
2array
] map concat ;
! Consultation