Easier way for rules to check identifier usages
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- devtools
Hướng nghiên cứu
Bắt đầu bằng cách lần theo mã đối sánh mẫu của các quy tắc tái cấu trúc và mã so sánh mã định danh; issue không nêu các tệp hoặc bài kiểm thử cụ thể. Xác định “hoàn tất” có nghĩa là gì đối với mẫu (~usage id) khớp với các lượt sử dụng free-identifiers, các lượt sử dụng syntax-free-identifiers và giá trị mặc định được đề xuất ở cấp phase, đồng thời kiểm tra các yêu cầu liên quan trong #379.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Consider the hash-ref-set!-to-hash-ref! rule:
(define-refactoring-rule hash-ref-set!-to-hash-ref!
#:description "This expression can be replaced with a simpler, equivalent `hash-ref!` expression."
#:literals (hash-ref hash-set! define)
(hash-ref
h1:id
k1:pure-expression
(_:lambda-by-any-name
()
(define v1:id initializer:value-initializer)
(hash-set! h2:id k2:pure-expression v2:id)
v3:id))
#:when (free-identifier=? #'h1 #'h2)
#:when (syntax-free-identifier=? #'k1 #'k2)
#:when (free-identifier=? #'v1 #'v2)
#:when (free-identifier=? #'v1 #'v3)
(hash-ref! h1 k1 initializer.failure-result-form))
It needs to do quite a bit of work to check that some identifiers are usages of others. Those free-identifier=? checks ought to be easier to write. It might be useful to have a (~usage id) syntax pattern that matches any identifier that's free-identifier=? to #'id. That would let me write the above rule like this:
(define-refactoring-rule hash-ref-set!-to-hash-ref!
#:description "This expression can be replaced with a simpler, equivalent `hash-ref!` expression."
#:literals (hash-ref hash-set! define)
(hash-ref
h:id
k1:pure-expression
(_:lambda-by-any-name
()
(define v:id initializer:value-initializer)
(hash-set! (~usage h) k2:pure-expression (~usage v))
(~usage v)))
#:when (syntax-free-identifier=? #'k1 #'k2)
(hash-ref! h k1 initializer.failure-result-form))
Might be worthwhile to make it match any syntax object that's syntax-free-identifier=? too. This could also help with #379, as ~usage could default to (resyntax-local-phase-level) (or whatever equivalent I come up with) instead of (syntax-local-phase-level) like free-identifier=? does.
- Ngôn ngữ chính
- Racket
- Star
- 70
- Fork
- 11
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của jackfirth/resyntax
-
Grimoire docs need examples Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
documentation
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
testing
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
testing
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
-
testing
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
Tất cả issue của jackfirth/resyntax
Issue tương tự
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Đang mởarea: harness bug status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Human-Agent-Society/reef#625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/just-bash#464 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100