Changeset 15335


Ignore:
Timestamp:
Apr 19, 2012, 12:15:11 PM (8 years ago)
Author:
gb
Message:

Error on attempts to lexically bind special-operators.
Quietly allow local functions to shadow standard/builtin definitions if their
names are declared NOTINLINE in the enclosing environment.
Use NX1-CHECK-LOCAL-FUNCTION-BINDING to do what that function's name implies.
Make MACROLET handle SETF names, check local function bindings ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/nx1.lisp

    r15314 r15335  
    203203                    (setq args (cdr args)))))))
    204204
     205(defun nx1-check-local-function-binding (funcname env)
     206  (if (and (symbolp funcname) (special-operator-p funcname))
     207    (nx-error "Can't lexically bind special operator ~s." funcname)
     208    (unless (nx-declared-notinline-p funcname env)
     209      (or (maybe-warn-about-shadowing-cl-function-name funcname)
     210          (when (and (symbolp funcname)
     211                     (gethash funcname *nx1-alphatizers*))
     212            (nx1-whine :special-fbinding funcname))))))
     213
    205214;;; New semantics: expansion functions are defined in current lexical environment
    206215;;; vice null environment.  May be meaningless ...
     
    211220    (dolist (def defs)
    212221      (destructuring-bind (name arglist &body mbody) def
     222        (setq name (nx-need-function-name name))
    213223        (push name names)
     224        (nx1-check-local-function-binding name old-env)
    214225        (push
    215226         (cons
     
    17881799    t))
    17891800
    1790 (defun maybe-warn-about-nx1-alphatizer-binding (funcname)
    1791   (or (maybe-warn-about-shadowing-cl-function-name funcname)
    1792       (when (and (symbolp funcname)
    1793                  (gethash funcname *nx1-alphatizers*))
    1794         (nx1-whine :special-fbinding funcname))))
     1801
    17951802
    17961803
     
    18141821            (setq fname (nx-need-function-name funcname))
    18151822            (push fname fnames)
    1816             (maybe-warn-about-nx1-alphatizer-binding funcname)
     1823            (nx1-check-local-function-binding funcname env)
    18171824            (multiple-value-bind (body decls)
    18181825                                 (parse-body flet-function-body env)
     
    19001907        (dolist (def defs (setq funcs (nreverse funcs) bodies (nreverse bodies)))
    19011908          (destructuring-bind (funcname lambda-list &body labels-function-body) def
    1902             (maybe-warn-about-nx1-alphatizer-binding funcname)
     1909            (nx1-check-local-function-binding funcname env)
    19031910            (push (setq func (make-afunc)) funcs)
    19041911            (setq blockname funcname)
Note: See TracChangeset for help on using the changeset viewer.