File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 209209
210210 (define results
211211 (with-handlers ([exn:fail? skip])
212+ (define paths (source-syntax-paths source lines))
212213 (define analysis (source-analyze source
213- #:lines lines
214+ #:paths paths
214215 #:analyzers (refactoring-suite-analyzers effective-suite)
215216 #:timeout-ms timeout-ms))
216217 (refactor-visited-forms
Original file line number Diff line number Diff line change 77(provide
88 (contract-out
99 [source-analyze (->* (source? #:analyzers (sequence/c expansion-analyzer?) #:timeout-ms exact-nonnegative-integer?)
10- (#:lines range -set?)
10+ (#:paths sorted -set?)
1111 source-code-analysis?)]
1212 [source-code-analysis? (-> any/c boolean?)]
1313 [source-code-analysis-code (-> source-code-analysis? source?)]
117117
118118
119119(define (source-analyze code
120- #:lines [lines (range -set (unbounded-range #:comparator natural <=>) )]
120+ #:paths [paths (sorted -set #:comparator syntax-path <=>)]
121121 #:analyzers analyzers
122122 #:timeout-ms timeout-ms)
123123 (define ns (make-base-namespace))
141141 (define/guard (resyntax-should-analyze-syntax? stx #:as-visit? [as-visit? #true ])
142142 (guard (syntax-original-and-from-source? stx program-source-name) #:else #false )
143143 (guard as-visit? #:else #true )
144- (define stx-lines (syntax-line-range stx #:linemap code-linemap))
145- (define overlaps? (range-set-overlaps? lines stx-lines))
146- (unless overlaps?
144+ ;; If no paths were specified (empty set), analyze everything
145+ (guard (not (sorted-set-empty? paths)) #:else #true )
146+ (define stx-path (syntax-original-path stx))
147+ (define should-analyze?
148+ (and stx-path
149+ (sorted-set-contains? paths stx-path)))
150+ (unless should-analyze?
147151 (log-resyntax-debug
148- (string-append "ignoring visited syntax object because it's outside analyzed lines \n "
149- " analyzed lines : ~a\n "
150- " syntax lines : ~a\n "
152+ (string-append "ignoring visited syntax object because it's not in analyzed paths \n "
153+ " analyzed paths : ~a\n "
154+ " syntax path : ~a\n "
151155 " syntax: ~a " )
152- lines
153- stx-lines
156+ paths
157+ stx-path
154158 stx))
155- overlaps ?)
159+ should-analyze ?)
156160
157161 (define/match (observe-event! sig val)
158162 [('visit (? syntax? visited))
You can’t perform that action at this time.
0 commit comments