(lambda (form environment)
(let ((name (cadr form)))
(if (not (syntactic-environment/top-level? environment))
- (syntactic-environment/define environment
- name
- (make-reserved-name-item)))
+ (syntactic-environment/reserve environment name))
(variable-binder environment name
(classify/expression (caddr form) environment))))))
(let ((bindings (cadr form))
(body (cddr form))
(binding-env (make-internal-syntactic-environment env)))
- (for-each (let ((item (make-reserved-name-item)))
- (lambda (binding)
- (syntactic-environment/define binding-env
- (car binding)
- item)))
+ (for-each (lambda (binding)
+ (syntactic-environment/reserve binding-env (car binding)))
bindings)
;; Classify right-hand sides first, in order to catch references to
;; reserved names. Then bind names prior to classifying body.
syntactic-environment->environment
syntactic-environment/define
syntactic-environment/lookup
+ syntactic-environment/reserve
syntactic-environment/top-level?
syntactic-environment?))
(guarantee identifier? identifier 'syntactic-environment/lookup)
((senv-lookup senv) identifier))
+(define (syntactic-environment/reserve senv identifier)
+ (guarantee identifier? identifier 'syntactic-environment/reserve)
+ ((senv-store senv) identifier (make-reserved-name-item)))
+
(define (syntactic-environment/define senv identifier item)
(guarantee identifier? identifier 'syntactic-environment/define)
- (guarantee senv-value-item? item 'syntactic-environment/define)
+ (guarantee keyword-item? item 'syntactic-environment/define)
((senv-store senv) identifier item))
-(define (senv-value-item? object)
- (or (reserved-name-item? object)
- (keyword-item? object)
- (variable-item? object)))
-(register-predicate! senv-value-item? 'syntactic-environment-value-item)
-
-(define (syntactic-environment/rename senv identifier)
- (guarantee identifier? identifier 'syntactic-environment/rename)
- ((senv-rename senv) identifier))
-
(define (bind-variable! senv identifier)
(guarantee identifier? identifier 'bind-variable!)
(let ((rename ((senv-rename senv) identifier)))