Changeset 13526 for trunk/abcl/src/org


Ignore:
Timestamp:
08/21/11 18:46:22 (10 years ago)
Author:
ehuelsmann
Message:

Factor out a function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass1.lisp

    r13525 r13526  
    11741174  (apply fn args))
    11751175
     1176(defun p1-variable-reference (var)
     1177  (let ((variable (find-visible-variable var)))
     1178    (when (null variable)
     1179      (unless (or (special-variable-p var)
     1180                  (memq var *undefined-variables*))
     1181        (compiler-style-warn
     1182         "Undefined variable ~S assumed special" var)
     1183        (push var *undefined-variables*))
     1184      (setf variable (make-variable :name var :special-p t))
     1185      (push variable *visible-variables*))
     1186    (let ((ref (make-var-ref variable)))
     1187      (unless (variable-special-p variable)
     1188        (when (variable-ignore-p variable)
     1189          (compiler-style-warn
     1190           "Variable ~S is read even though it was declared to be ignored."
     1191           (variable-name variable)))
     1192        (push ref (variable-references variable))
     1193        (incf (variable-reads variable))
     1194        (cond
     1195          ((eq (variable-compiland variable) *current-compiland*)
     1196           (dformat t "p1: read ~S~%" var))
     1197          (t
     1198           (dformat t "p1: non-local read ~S variable-compiland = ~S current compiland = ~S~%"
     1199                    var
     1200                    (compiland-name (variable-compiland variable))
     1201                    (compiland-name *current-compiland*))
     1202           (setf (variable-used-non-locally-p variable) t))))
     1203      ref)))
     1204
    11761205(defknown p1 (t) t)
    11771206(defun p1 (form)
     
    11941223          (setf form value))
    11951224         (t
    1196           (let ((variable (find-visible-variable form)))
    1197             (when (null variable)
    1198               (unless (or (special-variable-p form)
    1199                           (memq form *undefined-variables*))
    1200                 (compiler-style-warn
    1201                  "Undefined variable ~S assumed special" form)
    1202                 (push form *undefined-variables*))
    1203               (setf variable (make-variable :name form :special-p t))
    1204               (push variable *visible-variables*))
    1205             (let ((ref (make-var-ref variable)))
    1206               (unless (variable-special-p variable)
    1207                 (when (variable-ignore-p variable)
    1208                   (compiler-style-warn
    1209                    "Variable ~S is read even though it was declared to be ignored."
    1210                    (variable-name variable)))
    1211                 (push ref (variable-references variable))
    1212                 (incf (variable-reads variable))
    1213                 (cond
    1214                   ((eq (variable-compiland variable) *current-compiland*)
    1215                    (dformat t "p1: read ~S~%" form))
    1216                   (t
    1217                    (dformat t "p1: non-local read ~S variable-compiland = ~S current compiland = ~S~%"
    1218                             form
    1219                             (compiland-name (variable-compiland variable))
    1220                             (compiland-name *current-compiland*))
    1221                    (setf (variable-used-non-locally-p variable) t))))
    1222               (setf form ref)))
    1223           form))))
     1225          (p1-variable-reference form)))))
    12241226    ((atom form)
    12251227     form)
Note: See TracChangeset for help on using the changeset viewer.