~evhan/beaker

a613b5f78c7521d010b5089805edf0e2d59ae3cf — Evan Hanson 3 years ago 9e8f9ff
Avoid false-positive module reference warnings when compiler syntax is applied
1 files changed, 9 insertions(+), 2 deletions(-)

M lib/beaker.scm
M lib/beaker.scm => lib/beaker.scm +9 -2
@@ 112,7 112,7 @@
               (sep (string-index str #\#)))
      (string->symbol (substring str 0 sep))))

  (define (collect-referenced-modules db)
  (define (collect-referenced-values db)
    ((flip hash-table-for-each)
     db
     (lambda (sym props)


@@ 253,6 253,13 @@
    (parameterize ((current-output-port (current-error-port)))
      (emit 'warning warnings)))

  (set! ##sys#compiler-syntax-hook
    (let ((next ##sys#compiler-syntax-hook))
      (lambda (name x)
        (and-let* ((mod (symbol-namespace name)))
          (hash-table-set! referenced-modules mod 'compiler-syntax))
        (next name x))))

  (set! ##sys#expand-0
    (let ((next ##sys#expand-0))
      (lambda (x e c)


@@ 279,7 286,7 @@
                  (or (eq? pass 'scrutiny)
                      (and (eq? pass 'opt) (= count 1))))
         (set! done #t)
         (collect-referenced-modules db)
         (collect-referenced-values db)
         (analyse-imports)
         (print-analysis-results))))))