1#lang racket/base 2(require "../syntax/syntax.rkt" 3 "../syntax/scope.rkt" 4 "root-expand-context.rkt") 5 6(provide remove-use-site-scopes) 7 8;; Helper to remove any created use-site scopes from the left-hand 9;; side of a definition that was revealed by partial expansion in a 10;; definition context; the `s` argument can be syntax of a list 11;; of syntax 12(define (remove-use-site-scopes s ctx) 13 (define use-sites (root-expand-context-use-site-scopes ctx)) 14 (if (and use-sites 15 (pair? (unbox use-sites))) 16 (if (syntax? s) 17 (remove-scopes s (unbox use-sites)) 18 (for/list ([id (in-list s)]) 19 (remove-scopes id (unbox use-sites)))) 20 s)) 21