~ chicken-core (chicken-5) 37706c9e55fd9cb9d18b2068c80ccd722c9c142d
commit 37706c9e55fd9cb9d18b2068c80ccd722c9c142d Author: felix <felix@call-with-current-continuation.org> AuthorDate: Tue Sep 7 10:58:44 2010 +0200 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Tue Sep 7 10:58:44 2010 +0200 safer proc check for cfold diff --git a/support.scm b/support.scm index 2edaeebe..cfc2261b 100644 --- a/support.scm +++ b/support.scm @@ -1405,9 +1405,12 @@ EOF (debugging 'o "folding constant expression failed" form) (k #f form #f)) ;; op must have toplevel binding, result must be single-valued - (let ((result (apply (##sys#slot op 0) args))) - (debugging 'o "folded constant expression" form) - (k #t form result))))) + (let ((proc (##sys#slot op 0))) + (if (procedure? proc) + (let ((result (apply proc args))) + (debugging 'o "folded constant expression" form) + (k #t form result)) + (bomb "attempt to constant-fold call to non-procedure" form)))))) ;;; Dump node structure:Trap