From: Chris Hanson Date: Tue, 18 Dec 2001 19:35:50 +0000 (+0000) Subject: Guarantee that source binding of an import is defined. Source binding X-Git-Tag: 20090517-FFI~2393 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e9af6a926c530f299a78d0a1345e7e7a1b0a79b3;p=mit-scheme.git Guarantee that source binding of an import is defined. Source binding of an export is always defined by the package description. --- diff --git a/v7/src/runtime/packag.scm b/v7/src/runtime/packag.scm index d6bb9f716..3a3fa5e81 100644 --- a/v7/src/runtime/packag.scm +++ b/v7/src/runtime/packag.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: packag.scm,v 14.36 2001/12/17 17:40:59 cph Exp $ +$Id: packag.scm,v 14.37 2001/12/18 19:35:50 cph Exp $ Copyright (c) 1988-1999, 2001 Massachusetts Institute of Technology @@ -379,12 +379,15 @@ USA. (do ((i 0 (fix:+ i 1))) ((fix:= i n)) (let ((binding (vector-ref bindings i))) - (link-variables environment - (vector-ref binding 0) - (find-package-environment (vector-ref binding 1)) - (if (fix:= (vector-length binding) 3) - (vector-ref binding 2) - (vector-ref binding 0))))))))) + (let ((source-environment + (find-package-environment (vector-ref binding 1))) + (source-name + (if (fix:= (vector-length binding) 3) + (vector-ref binding 2) + (vector-ref binding 0)))) + (guarantee-binding source-environment source-name) + (link-variables environment (vector-ref binding 0) + source-environment source-name)))))))) (define (extend-package-environment environment . name-sources) (let ((n @@ -427,8 +430,18 @@ USA. (define (find-package-environment name) (package/environment (find-package name))) +(define (guarantee-binding environment name) + (if (lexical-unbound? environment name) + (local-assignment environment + name + (primitive-object-set-type (ucode-type reference-trap) + 0)))) + (define-primitives - link-variables) + lexical-unbound? + link-variables + local-assignment + primitive-object-set-type) ;; LOAD-PACKAGES-FROM-FILE is called from the cold load and must only ;; use procedures that are inline-coded by the compiler.