|
58 | 58 | (extract-ids origin)) |
59 | 59 |
|
60 | 60 |
|
| 61 | +;; Extract identifiers from the 'disappeared-use syntax property |
| 62 | +;; The 'disappeared-use property can be either: |
| 63 | +;; - A single identifier |
| 64 | +;; - A list of identifiers |
| 65 | +;; We extract all identifiers and label them with the given phase |
| 66 | +(define (disappeared-use-property-identifiers stx phase) |
| 67 | + (define disappeared (syntax-property stx 'disappeared-use)) |
| 68 | + |
| 69 | + (define (extract-ids obj) |
| 70 | + (cond |
| 71 | + [(not obj) (stream)] |
| 72 | + [(identifier? obj) |
| 73 | + ;; Add the phase property to the identifier so it matches correctly |
| 74 | + (stream (syntax-property obj 'phase phase))] |
| 75 | + [(list? obj) |
| 76 | + (apply stream-append (map extract-ids obj))] |
| 77 | + [else (stream)])) |
| 78 | + |
| 79 | + (extract-ids disappeared)) |
| 80 | + |
| 81 | + |
61 | 82 | ;; Find all identifier usage sites (not binding sites) |
62 | 83 | (define (usage-site-identifiers expanded-stx) |
63 | 84 | (let loop ([expanded-stx expanded-stx] [phase 0]) |
|
70 | 91 | (for/list ([stx-node (in-stream (syntax-search-everything expanded-stx))]) |
71 | 92 | (origin-property-identifiers stx-node phase)))) |
72 | 93 |
|
| 94 | + ;; Collect identifiers from disappeared-use properties of all syntax objects |
| 95 | + (define disappeared-ids |
| 96 | + (apply stream-append |
| 97 | + (for/list ([stx-node (in-stream (syntax-search-everything expanded-stx))]) |
| 98 | + (disappeared-use-property-identifiers stx-node phase)))) |
| 99 | + |
73 | 100 | ;; Collect identifiers from the expanded syntax tree |
74 | 101 | (define expanded-ids |
75 | 102 | (syntax-search expanded-stx |
|
126 | 153 | #:when (identifier? this-syntax) |
127 | 154 | (stream (attribute id))])) |
128 | 155 |
|
129 | | - (stream-append origin-ids expanded-ids))) |
| 156 | + (stream-append origin-ids disappeared-ids expanded-ids))) |
130 | 157 |
|
131 | 158 |
|
132 | 159 | (define (fully-expanded-syntax-binding-table stx) |
|
0 commit comments