From dc029f9bab472757e0936cb2a85a301c37f9431e Mon Sep 17 00:00:00 2001 From: wlott <wlott> Date: Mon, 24 Feb 1992 01:25:35 +0000 Subject: [PATCH] Changed the %DEFCONSTANT transform to protect against trying to change T, NIL, or keywords. --- compiler/ir1tran.lisp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/compiler/ir1tran.lisp b/compiler/ir1tran.lisp index f544ec563..add30c087 100644 --- a/compiler/ir1tran.lisp +++ b/compiler/ir1tran.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ir1tran.lisp,v 1.65 1992/02/14 23:47:11 wlott Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ir1tran.lisp,v 1.66 1992/02/24 01:25:35 wlott Exp $") ;;; ;;; ********************************************************************** ;;; @@ -3366,15 +3366,23 @@ (newval (eval value))) (unless (symbolp name) (compiler-error "Constant name is not a symbol: ~S." name)) - - (ecase (info variable kind name) - (:constant - (unless (equalp newval (info variable constant-value name)) - (compiler-warning "Redefining constant ~S as:~% ~S" - name newval))) - (:special - (compiler-warning "Redefining special ~S to be a constant." name)) - (:global)) + (when (eq name t) + (compiler-error "Can't change T.")) + (when (eq name nil) + (compiler-error "Nilhil ex nilhil (Can't change NIL).")) + (when (keywordp name) + (compiler-error "Can't change the value of keywords.")) + + (let ((kind (info variable kind name))) + (case kind + (:constant + (unless (equalp newval (info variable constant-value name)) + (compiler-warning "Redefining constant ~S as:~% ~S" + name newval))) + (:global) + (t + (compiler-warning "Redefining ~(~A~) ~S to be a constant." + kind name)))) (setf (info variable kind name) :constant) (setf (info variable where-from name) :defined) -- GitLab