File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
default-recommendations/analyzers Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1717 [in-expanded-id-table-phase
1818 (-> expanded-id-table? (or/c exact-nonnegative-integer? #false ) (sequence/c (entry/c expanded-identifier? any/c)))]
1919 [syntax-label-id-phases (-> syntax? syntax?)]
20+ [binding-site-identifiers (-> syntax? stream?)]
2021 [fully-expanded-syntax-id-table (-> syntax? expanded-id-table?)]))
2122
2223
153154 (map recur (append* (attribute body))))])))
154155
155156
157+ ;; Builds an expanded-id-table from phase-labeled syntax.
158+ ;; The input syntax should already have phase labels added via syntax-label-id-phases.
159+ ;; Returns an expanded-id-table mapping expanded-identifiers to empty lists,
160+ ;; with one entry for each binding site in the syntax.
156161(define (fully-expanded-syntax-id-table stx)
157162 ;; stx is expected to already have phase labels via syntax-label-id-phases
158163 (define table (make-expanded-id-table))
Original file line number Diff line number Diff line change 4747(define (variable-mutability stx)
4848 (define labeled-stx (syntax-label-id-phases (syntax-label-paths stx 'expanded-path )))
4949
50- ;; Create table with all bound identifiers initialized to 'immutable
51- (define variable-table (fully-expanded-syntax-id-table labeled-stx))
52-
53- ;; Initialize all entries with 'immutable
54- (for ([entry (in-expanded-id-table variable-table)])
55- (expanded-id-table-set! variable-table (entry-key entry) 'immutable ))
50+ ;; Create table and initialize all bound identifiers with 'immutable
51+ (define variable-table (make-expanded-id-table))
52+ (for ([id (in-stream (binding-site-identifiers labeled-stx))])
53+ (define phase (syntax-property id 'phase ))
54+ (expanded-id-table-set! variable-table (expanded-identifier id phase) 'immutable ))
5655
5756 ;; Mark mutated variables as 'mutable
5857 (for ([id (in-stream (mutated-variables labeled-stx))])
You can’t perform that action at this time.
0 commit comments