kernel libc literals math multiline namespaces prettyprint
prettyprint.config see sequences specialized-arrays.ushort
system tools.test compiler.tree.debugger struct-arrays
-classes.tuple.private specialized-arrays.direct.int ;
+classes.tuple.private specialized-arrays.direct.int
+compiler.units ;
IN: classes.struct.tests
<<
"f-stdcall" libfactor-ffi-tests-path "stdcall" add-library
>>
+SYMBOL: struct-test-empty
+
+[ [ struct-test-empty { } define-struct-class ] with-compilation-unit ]
+[ struct-must-have-slots? ] must-fail-with
+
STRUCT: struct-test-foo
{ x char }
{ y int initial: 123 }
! struct class
+ERROR: struct-must-have-slots ;
+
TUPLE: struct
{ (underlying) c-ptr read-only } ;
[ c-type>> c-type drop ] each ;
: (define-struct-class) ( class slots offsets-quot -- )
- [ drop struct f define-tuple-class ]
+ [
+ [ struct-must-have-slots ]
+ [ drop struct f define-tuple-class ] if-empty
+ ]
swap '[
make-slots dup
[ check-struct-slots ] _ [ struct-align [ align ] keep ] tri