Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Resyntax fixes #716

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions drracket-tool-text-lib/drracket/private/syncheck/traversals.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1144,39 +1144,39 @@
;; records the src locs of each 'end' position of each arrow)
;; to do this, but maybe lets leave that for another day.
(define (annotate-counts connections)
(for ([(key val) (in-hash connections)])
(when (list? val)
(define start (first val))
(define end (second val))
(define color? (third val))
(define (show-starts)
(when (zero? start)
(define defs-text (current-annotations))
(when defs-text
(send defs-text syncheck:unused-binder
(list-ref key 0) (list-ref key 1) (list-ref key 2))))
(add-mouse-over/loc (list-ref key 0) (list-ref key 1) (list-ref key 2)
(cond
[(zero? start)
(string-constant cs-zero-varrefs)]
[(= 1 start)
(string-constant cs-one-varref)]
[else
(format (string-constant cs-n-varrefs) start)])))
(define (show-ends)
(unless (= 1 end)
(add-mouse-over/loc (list-ref key 0) (list-ref key 1) (list-ref key 2)
(format (string-constant cs-binder-count) end))))
(cond
[(zero? end) ;; assume this is a binder, show uses
#;(when (and color? (zero? start))
(color-unused-binder (list-ref key 0) (list-ref key 1) (list-ref key 2)))
(show-starts)]
[(zero? start) ;; assume this is a use, show bindings (usually just one, so do nothing)
(show-ends)]
[else ;; crazyness, show both
(show-starts)
(show-ends)]))))
(for ([(key val) (in-hash connections)]
#:when (list? val))
(define start (first val))
(define end (second val))
(define color? (third val))
(define (show-starts)
(when (zero? start)
(define defs-text (current-annotations))
(when defs-text
(send defs-text syncheck:unused-binder (list-ref key 0) (list-ref key 1) (list-ref key 2))))
(add-mouse-over/loc (list-ref key 0)
(list-ref key 1)
(list-ref key 2)
(cond
[(zero? start) (string-constant cs-zero-varrefs)]
[(= 1 start) (string-constant cs-one-varref)]
[else (format (string-constant cs-n-varrefs) start)])))
(define (show-ends)
(unless (= 1 end)
(add-mouse-over/loc (list-ref key 0)
(list-ref key 1)
(list-ref key 2)
(format (string-constant cs-binder-count) end))))
(cond
;; assume this is a binder, show uses
#;(when (and color? (zero? start))
(color-unused-binder (list-ref key 0) (list-ref key 1) (list-ref key 2)))
[(zero? end) (show-starts)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong here. The code should behave the same but the comment went into the wrong place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional, but it's undesirable in this case. Will try to make an adjustment, thanks!

;; assume this is a use, show bindings (usually just one, so do nothing)
[(zero? start) (show-ends)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, although this one is less wrong, I'd say.

[else ;; crazyness, show both
(show-starts)
(show-ends)])))

;; color-variable : syntax phase-level identifier-mapping -> void
(define (color-variable var phase-level varsets)
Expand Down
6 changes: 3 additions & 3 deletions drracket/drracket/private/syncheck/online-comp.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
(make-traversal (current-namespace)
(get-init-dir path)))
(parameterize ([current-annotations obj])
(for ([stx (in-list stxes)])
(when (equal? (syntax-source stx) the-source)
(expanded-expression stx)))
(for ([stx (in-list stxes)]
#:when (equal? (syntax-source stx) the-source))
(expanded-expression stx))
(expansion-completed))
(send obj get-trace)))

Expand Down