435 - starting to allow type definitions
This commit is contained in:
parent
b93d2cd357
commit
a0bb6c0420
10
mu.arc
10
mu.arc
|
@ -1014,6 +1014,16 @@
|
|||
(assert (is 'make-br-fn _make-br-fn))
|
||||
(= function*.name (join body function*.name)))
|
||||
|
||||
; and-record <type> [ <name:types> ]
|
||||
and-record
|
||||
(let (name (_make-br-fn fields)) rest
|
||||
(assert (is 'make-br-fn _make-br-fn))
|
||||
(let fields (map tokenize-arg fields)
|
||||
(= type*.name (obj size len.fields
|
||||
and-record t
|
||||
elems (map cdar fields)
|
||||
fields (map caar fields)))))
|
||||
|
||||
; before <label> [ <instructions> ]
|
||||
;
|
||||
; multiple before directives => code in order
|
||||
|
|
10
mu.arc.t
10
mu.arc.t
|
@ -3319,6 +3319,16 @@
|
|||
|
||||
) ; section 100 for string utilities
|
||||
|
||||
(reset)
|
||||
(new-trace "parse-and-record")
|
||||
(add-code '((and-record foo [
|
||||
x:string
|
||||
y:integer
|
||||
z:boolean
|
||||
])))
|
||||
(if (~iso type*!foo (obj size 3 and-record t elems '((string) (integer) (boolean)) fields '(x y z)))
|
||||
(prn "F - 'add-code' can add new and-records"))
|
||||
|
||||
;; unit tests for various helpers
|
||||
|
||||
; tokenize-args
|
||||
|
|
Loading…
Reference in New Issue