Skip to content

Commit 2341387

Browse files
Merge pull request #4 from tompassarelli/fix/purity-checks-exports
fix(check): purity check now descends into js/export wrappers
2 parents e9e14aa + 5e18635 commit 2341387

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

beagle-lib/private/check.rkt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3396,7 +3396,14 @@
33963396
[(defn-multi? f)
33973397
(for ([a (in-list (defn-multi-arities f))])
33983398
(check-defn-purity (defn-multi-name f) (arity-clause-body a) st f))]
3399-
;; Descend through wrapper forms (js/export, target-case, …) that may
3399+
;; Descend through STRUCT wrapper forms that carry a defn payload.
3400+
;; js/export / js/export-default parse to jst-export(-default) structs
3401+
;; (not lists), so without these the EXPORTED defns — the public API,
3402+
;; exactly what you most want the purity guarantee on — were skipped.
3403+
[(with-meta? f) (walk (with-meta-expr f))]
3404+
[(jst-export? f) (walk (jst-export-form f))]
3405+
[(jst-export-default? f) (walk (jst-export-default-form f))]
3406+
;; Descend through list-shaped wrapper forms (target-case, …) that may
34003407
;; carry a defn payload — same transitive walk type-check! uses.
34013408
[(and (pair? f) (list? f)) (for-each walk (filter pair? (cdr f)))]
34023409
[else (void)])))))

0 commit comments

Comments
 (0)