From 96aaa7307583eea9c1b749edb05555aeb12162a7 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Mon, 18 Apr 2011 20:51:24 -0400 Subject: [PATCH] Remove unused macro. Convert function to macro for inlining. original commit: e7beef3f4fd407c7ba7f8d6c46e4f9f37fced091 --- collects/typed-scheme/env/lexical-env.rkt | 27 ++++++++--------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/collects/typed-scheme/env/lexical-env.rkt b/collects/typed-scheme/env/lexical-env.rkt index 1445435d..6f339ee8 100644 --- a/collects/typed-scheme/env/lexical-env.rkt +++ b/collects/typed-scheme/env/lexical-env.rkt @@ -16,7 +16,7 @@ (typecheck tc-metafunctions) (except-in (types utils convenience) -> ->*)) -(provide lexical-env with-lexical-env with-lexical-env/extend with-update-type/lexical +(provide lexical-env with-lexical-env with-lexical-env/extend with-lexical-env/extend/props) (p/c [lookup-type/lexical ((identifier?) (prop-env? #:fail (or/c #f (-> any/c #f))) . ->* . (or/c Type/c #f))] @@ -44,26 +44,17 @@ ;; refine the type of i in the lexical env ;; (identifier type -> type) identifier -> environment -(define (update-type/lexical f i [env (lexical-env)]) - ;; do the updating on the given env - ;; (identifier type -> type) identifier environment -> environment - (define (update f k env) - (parameterize - ([current-orig-stx k]) - (let* ([v (lookup-type/lexical k env #:fail (lambda _ Univ))] - [new-v (f k v)] - [new-env (extend env k new-v)]) - new-env))) +;; a macro for inlining :( +(define-syntax-rule (update-type/lexical f i env) ;; check if i is ever the target of a set! (if (is-var-mutated? i) ;; if it is, we do nothing env ;; otherwise, refine the type - (update f i env))) - -;; convenience macro for typechecking in the context of an updated env -(define-syntax with-update-type/lexical - (syntax-rules () - [(_ f i . b) - (with-lexical-env (update-type/lexical f i) . b)])) + (parameterize + ([current-orig-stx i]) + (let* ([v (lookup-type/lexical i env #:fail (lambda _ Univ))] + [new-v (f i v)] + [new-env (extend env i new-v)]) + new-env))))