From 33e9a90d7b66d174c41b2cf0c8c89d4a3fa88443 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 23 Oct 2013 16:57:14 +0200 Subject: [PATCH] Always resolve-primitives in the root module. * module/language/tree-il/primitives.scm (resolve-primitives): If we are compiling in the root module, ignore local definitions. --- module/language/tree-il/primitives.scm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/module/language/tree-il/primitives.scm b/module/language/tree-il/primitives.scm index 0fe444567..c18d2b8a9 100644 --- a/module/language/tree-il/primitives.scm +++ b/module/language/tree-il/primitives.scm @@ -255,14 +255,17 @@ (define local-definitions (make-hash-table)) - (let collect-local-definitions ((x x)) - (record-case x - (( name) - (hashq-set! local-definitions name #t)) - (( head tail) - (collect-local-definitions head) - (collect-local-definitions tail)) - (else #f))) + ;; Assume that any definitions with primitive names in the root module + ;; have the same semantics as the primitives. + (unless (eq? mod the-root-module) + (let collect-local-definitions ((x x)) + (record-case x + (( name) + (hashq-set! local-definitions name #t)) + (( head tail) + (collect-local-definitions head) + (collect-local-definitions tail)) + (else #f)))) (post-order (lambda (x)