tidy what the fixes wrote around existing helpers
written-type? matches the shapes instead of measuring them, array-form? and pub-form? replace their spelled-out copies, both test files share one fails-with?, and moved test comments are back above their groups.
This commit was merged in pull request #66.
This commit is contained in:
16
semen.scm
16
semen.scm
@@ -795,14 +795,12 @@
|
||||
;;; (* char) (* const char) (* size-t) (unsigned int) types
|
||||
;;; (* p) (* (g)) (¤ xs 0) expressions
|
||||
(define (written-type? form env)
|
||||
(and (pair? form)
|
||||
;; the length a dereference and a subscript have
|
||||
(if (= (length form) (case (car form) ((*) 2) ((¤) 3) (else -1)))
|
||||
(let ((operand (second form)))
|
||||
(if (symbol? operand)
|
||||
(not (or (lookup-name env operand) (get-name-type operand)))
|
||||
(written-type? operand env)))
|
||||
(type-head? form))))
|
||||
(match form
|
||||
((or ('* operand) ('¤ operand _))
|
||||
(if (symbol? operand)
|
||||
(not (or (lookup-name env operand) (get-name-type operand)))
|
||||
(written-type? operand env)))
|
||||
(_ (type-head? form))))
|
||||
|
||||
;;; `(var n _ (strlen s))' becomes `(var n size-t (strlen s))'.
|
||||
(define (resolve-wildcard form env)
|
||||
@@ -1143,7 +1141,7 @@
|
||||
|
||||
;;; A field of a path, indexed or not: xs, [xs 0] -> xs
|
||||
(define (field-name field)
|
||||
(if (and (pair? field) (eq? '¤ (car field)) (pair? (cdr field)))
|
||||
(if (and (array-form? field) (pair? (cdr field)))
|
||||
(second field)
|
||||
field))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user