Skip to content

Commit

Permalink
There are no deprecated operators any more
Browse files Browse the repository at this point in the history
  • Loading branch information
pavpanchekha committed Nov 27, 2024
1 parent d58f83e commit 9a008d9
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/syntax/syntax-check.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"syntax.rkt")
(provide assert-program!)

(define (check-expression* stx vars error! deprecated-ops)
(define (check-expression* stx vars error!)
(let loop ([stx stx]
[vars vars])
(match stx
Expand Down Expand Up @@ -50,7 +50,7 @@
(unless (null? args)
(loop (last args) vars))]
[#`(! #,props ... #,body)
(check-properties* props '() error! deprecated-ops)
(check-properties* props '() error!)
(loop body vars)]
[#`(cast #,arg) (loop arg vars)]
[#`(cast #,args ...)
Expand Down Expand Up @@ -106,7 +106,7 @@
(unless (equal? (substring name 0 1) ":")
(error! prop "Invalid property name ~a" prop)))

(define (check-properties* props vars error! deprecated-ops)
(define (check-properties* props vars error!)
(define prop-dict
(let loop ([props props]
[out '()])
Expand Down Expand Up @@ -145,36 +145,31 @@
(error! cite "Invalid :cite ~a; must be a list" cite)))

(when (dict-has-key? prop-dict ':pre)
(check-expression* (dict-ref prop-dict ':pre) vars error! deprecated-ops))
(check-expression* (dict-ref prop-dict ':pre) vars error!))

(when (dict-has-key? prop-dict ':alt)
(check-expression* (dict-ref prop-dict ':alt) vars error! deprecated-ops))
(check-expression* (dict-ref prop-dict ':alt) vars error!))

(void))

(define (check-program* stx vars props body error!)
(unless (list? vars)
(error! stx "Invalid arguments list ~a; must be a list" stx))
(define deprecated-ops (mutable-set))
(define vars*
(reap [sow]
(when (list? vars)
(for ([var (in-list vars)])
(match var
[(? identifier? x) (sow var)]
[#`(! #,props ... #,name)
(check-properties* props (immutable-bound-id-set '()) error! deprecated-ops)
(check-properties* props (immutable-bound-id-set '()) error!)
(cond
[(identifier? name) (sow name)]
[else (error! var "Annotated argument ~a is not a variable name" name)])])))))
(when (check-duplicate-identifier vars*)
(error! stx "Duplicate argument name ~a" (check-duplicate-identifier vars*)))
(check-properties* props (immutable-bound-id-set vars*) error! deprecated-ops)
(check-expression* body (immutable-bound-id-set vars*) error! deprecated-ops)
(for ([op (in-set deprecated-ops)])
(define message
(format (syntax->error-format-string stx) (format "operator `~a` is deprecated." op)))
(warn 'deprecated #:url "faq.html#deprecated-ops" message)))
(check-properties* props (immutable-bound-id-set vars*) error!)
(check-expression* body (immutable-bound-id-set vars*) error!))

(define (check-fpcore* stx error!)
(match stx
Expand Down

0 comments on commit 9a008d9

Please sign in to comment.