fix STRUCT: functor when a slot name is the same as a non-lexical word name
parent
309b11213c
commit
2e3f75fd87
|
@ -161,10 +161,10 @@ WHERE
|
||||||
|
|
||||||
STRUCT: T-class
|
STRUCT: T-class
|
||||||
{ NAME int }
|
{ NAME int }
|
||||||
{ "x" { TYPE 4 } }
|
{ x { TYPE 4 } }
|
||||||
{ "y" { "short" N } }
|
{ y { "short" N } }
|
||||||
{ "z" TYPE initial: 5 }
|
{ z TYPE initial: 5 }
|
||||||
{ "w" { "int" 2 } } ;
|
{ float { "float" 2 } } ;
|
||||||
|
|
||||||
;FUNCTOR
|
;FUNCTOR
|
||||||
|
|
||||||
|
@ -203,11 +203,11 @@ STRUCT: T-class
|
||||||
{ c-type "char" }
|
{ c-type "char" }
|
||||||
}
|
}
|
||||||
T{ struct-slot-spec
|
T{ struct-slot-spec
|
||||||
{ name "w" }
|
{ name "float" }
|
||||||
{ offset 16 }
|
{ offset 16 }
|
||||||
{ class object }
|
{ class object }
|
||||||
{ initial f }
|
{ initial f }
|
||||||
{ c-type { "int" 2 } }
|
{ c-type { "float" 2 } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] [ a-struct struct-slots ] unit-test
|
] [ a-struct struct-slots ] unit-test
|
||||||
|
|
|
@ -58,15 +58,17 @@ M: object (fake-quotations>) , ;
|
||||||
[ parse-definition* ] dip
|
[ parse-definition* ] dip
|
||||||
parsed ;
|
parsed ;
|
||||||
|
|
||||||
|
: >string-param ( string -- string/param )
|
||||||
|
dup search dup lexical? [ nip ] [ drop ] if ;
|
||||||
|
|
||||||
: scan-c-type* ( -- c-type/param )
|
: scan-c-type* ( -- c-type/param )
|
||||||
scan {
|
scan dup "{" = [ drop \ } parse-until >array ] [ >string-param ] if ;
|
||||||
{ [ dup "{" = ] [ drop \ } parse-until >array ] }
|
|
||||||
{ [ dup search ] [ search ] }
|
: scan-string-param ( -- name/param )
|
||||||
[ ]
|
scan >string-param ;
|
||||||
} cond ;
|
|
||||||
|
|
||||||
:: parse-struct-slot* ( accum -- accum )
|
:: parse-struct-slot* ( accum -- accum )
|
||||||
scan-param :> name
|
scan-string-param :> name
|
||||||
scan-c-type* :> c-type
|
scan-c-type* :> c-type
|
||||||
\ } parse-until :> attributes
|
\ } parse-until :> attributes
|
||||||
accum {
|
accum {
|
||||||
|
|
Loading…
Reference in New Issue