From 7d5ff4dec308236c54f188689ed0d5e74de82a6b Mon Sep 17 00:00:00 2001 From: felix Date: Sat, 27 Jan 2024 23:36:35 +0100 Subject: [PATCH] Including forms must preserve ##sys#current-source-filename Found by "Reid": invocation of "k" in ##sys#include-forms-from-file must be outside the fluid-binding of ##sys#current-source-filename or later inclusions while expanding a body will not see the original, outer binding of the var and "include-relative" will refer to the wrong original source --- eval.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/eval.scm b/eval.scm index e760aad0..f67aa847 100644 --- a/eval.scm +++ b/eval.scm @@ -1170,21 +1170,21 @@ (define ##sys#include-forms-from-file (let ((call-with-input-file call-with-input-file) - (reverse reverse)) + (reverse reverse)) (lambda (filename source k) (let ((path (##sys#resolve-include-filename filename #t #f source)) - (read-with-source-info chicken.syntax#read-with-source-info)) ; OBSOLETE - after bootstrapping we can get rid of this explicit namespacing - (when (not path) - (##sys#signal-hook #:file-error 'include "cannot open file" filename)) - (when (load-verbose) - (print "; including " path " ...")) - (call-with-input-file path - (lambda (in) - (fluid-let ((##sys#current-source-filename path)) - (do ((x (read-with-source-info in) (read-with-source-info in)) - (xs '() (cons x xs))) - ((eof-object? x) - (k (reverse xs))))))))))) + (read-with-source-info chicken.syntax#read-with-source-info)) ; OBSOLETE - after bootstrapping we can get rid of this explicit namespacing + (when (not path) + (##sys#signal-hook #:file-error 'include "cannot open file" filename)) + (when (load-verbose) + (print "; including " path " ...")) + (call-with-input-file path + (lambda (in) + (k (fluid-let ((##sys#current-source-filename path)) + (do ((x (read-with-source-info in) (read-with-source-info in)) + (xs '() (cons x xs))) + ((eof-object? x) + (reverse xs))))))))))) ;;; Extensions: -- 2.40.0