From 405a016a8da0b1e8a2ae8808e0ef9c5244ec44b8 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 3 Jun 2013 08:33:57 -0700 Subject: [PATCH] Fix for bug #36887: Ignore a free variable and sf fails. Ignoring a free variable now just causes a warning (and names the variable). --- src/sf/pardec.scm | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/sf/pardec.scm b/src/sf/pardec.scm index 6e5a75ae4..eae11cd7b 100644 --- a/src/sf/pardec.scm +++ b/src/sf/pardec.scm @@ -325,22 +325,35 @@ USA. ;; not actually use. (define-declaration 'IGNORABLE (lambda (block names) - (for-each (lambda (variable) - (if variable - (variable/may-ignore! variable))) - (block/lookup-names block names #f)) - '())) + (for-each (lambda (name) + (let ((variable (block/lookup-name block name #f))) + (if variable + (variable/may-ignore! variable) + (warn "ignoring IGNORABLE declaration of free variable" + name)))) + names))) ;; IGNORE causes warnings if an ignored variable actually ends ;; up being used. Mentioning the variable in a sequence will ;; have the effect of marking it IGNORED. (define-declaration 'IGNORE (lambda (block names) - (let ((variables (block/lookup-names block names #f))) - (for-each (lambda (variable) - (if variable - (variable/must-ignore! variable))) - variables) + (let ((variables + (let loop + ((names names) + (variables '())) + (if (pair? names) + (let* ((name (car names)) + (variable (block/lookup-name block name #f))) + (if variable + (begin + (variable/must-ignore! variable) + (loop (cdr names) (cons variable variables))) + (begin + (warn "ignoring IGNORE declaration of free variable" + name) + (loop (cdr names) variables)))) + variables)))) (make-declarations 'IGNORE variables 'NO-VALUES -- 2.25.1