Remove dotted-env.

This commit is contained in:
Sam Tobin-Hochstadt 2010-05-28 12:45:32 -04:00
parent f7b59f78e9
commit a9c34dae6a
2 changed files with 1 additions and 25 deletions

View File

@ -1,16 +0,0 @@
#lang racket/base
(require "type-env-structs.rkt" syntax/id-table)
(provide (all-defined-out))
;; this environment maps lexical identifiers to pairs of types and bounds
;; bounds are type variables which must be bound with ...
;; bounds are represented as symbols
;; the environment for types of ... variables
(define dotted-env (make-parameter (make-empty-env (make-immutable-free-id-table))))
;; run code in an extended dotted env
(define-syntax with-dotted-env/extend
(syntax-rules ()
[(_ i t v . b) (parameterize ([dotted-env (extend (dotted-env) i (cons t v))]) . b)]))

View File

@ -9,7 +9,6 @@
(require "../utils/utils.rkt" (require "../utils/utils.rkt"
"type-env-structs.rkt" "type-env-structs.rkt"
"global-env.rkt" "global-env.rkt"
"dotted-env.rkt"
unstable/mutated-vars syntax/id-table unstable/mutated-vars syntax/id-table
(only-in scheme/contract ->* -> or/c any/c listof cons/c) (only-in scheme/contract ->* -> or/c any/c listof cons/c)
(utils tc-utils) (utils tc-utils)
@ -41,14 +40,7 @@
;; find the type of identifier i, looking first in the lexical env, then in the top-level env ;; find the type of identifier i, looking first in the lexical env, then in the top-level env
;; identifer -> Type ;; identifer -> Type
(define (lookup-type/lexical i [env (lexical-env)] #:fail [fail #f]) (define (lookup-type/lexical i [env (lexical-env)] #:fail [fail #f])
(lookup env i (lookup env i (λ (i) (lookup-type i (λ () ((or fail lookup-fail) i))))))
(lambda (i) (lookup-type
i (lambda ()
(cond [(lookup (dotted-env) i (lambda _ #f))
=>
(lambda (a)
(-lst (substitute Univ (cdr a) (car a))))]
[else ((or fail lookup-fail) i)]))))))
;; refine the type of i in the lexical env ;; refine the type of i in the lexical env
;; (identifier type -> type) identifier -> environment ;; (identifier type -> type) identifier -> environment