1#lang racket/base 2 3(provide add-decl-props) 4(require syntax/intdef) 5 6;; this function copies properties from the declarations expressions 7;; that get dropped. (e.g. (public x) from the body of a class). 8;; It doesn't use syntax-track-origin because there is 9;; no residual code that it would make sense to be the result of expanding 10;; those away. So, instead we only look at a few properties (as below). 11;; Also, add 'disappeared-binding properties from `ctx`. 12(define (add-decl-props def-ctx decls stx) 13 (internal-definition-context-track 14 def-ctx 15 (for/fold ([stx stx]) ([decl (in-list decls)]) 16 (define (copy-prop src dest stx) 17 (syntax-property 18 stx 19 dest 20 (cons (syntax-property decl src) 21 (syntax-property stx dest)))) 22 (copy-prop 23 'origin 'disappeared-use 24 (copy-prop 25 'disappeared-use 'disappeared-use 26 (copy-prop 27 'disappeared-binding 'disappeared-binding 28 stx)))))) 29