don't use setter words from classes.struct boa>object, otherwise struct literals of classes in the current compilation unit won't compile
parent
4ea2820f2f
commit
600bf6bcdc
|
@ -44,13 +44,17 @@ MACRO: <struct-boa> ( class -- quot: ( ... -- struct ) )
|
||||||
] bi
|
] bi
|
||||||
] [ ] output>sequence ;
|
] [ ] output>sequence ;
|
||||||
|
|
||||||
: pad-struct-slots ( slots class -- slots' class )
|
: pad-struct-slots ( values class -- values' class )
|
||||||
[ class-slots [ initial>> ] map over length tail append ] keep ;
|
[ class-slots [ initial>> ] map over length tail append ] keep ;
|
||||||
|
|
||||||
|
: (writer-quot) ( slot -- quot )
|
||||||
|
[ class>> c-setter ]
|
||||||
|
[ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
|
||||||
|
|
||||||
M: struct-class boa>object
|
M: struct-class boa>object
|
||||||
swap pad-struct-slots
|
swap pad-struct-slots
|
||||||
[ (struct) swap ] [ "struct-slots" word-prop ] bi
|
[ (struct) ] [ "struct-slots" word-prop ] bi
|
||||||
[ name>> setter-word execute( struct value -- struct ) ] 2each ;
|
[ [ (writer-quot) call( value struct -- ) ] with 2each ] curry keep ;
|
||||||
|
|
||||||
! Struct slot accessors
|
! Struct slot accessors
|
||||||
|
|
||||||
|
@ -59,10 +63,6 @@ M: struct-class reader-quot
|
||||||
[ class>> c-type-getter-boxer ]
|
[ class>> c-type-getter-boxer ]
|
||||||
[ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
|
[ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
|
||||||
|
|
||||||
: (writer-quot) ( slot -- quot )
|
|
||||||
[ class>> c-setter ]
|
|
||||||
[ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
|
|
||||||
|
|
||||||
M: struct-class writer-quot
|
M: struct-class writer-quot
|
||||||
nip (writer-quot) ;
|
nip (writer-quot) ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue