Changeset 4762


Ignore:
Timestamp:
11/15/03 01:07:35 (18 years ago)
Author:
piso
Message:

PRECOMPILE1: minor refactoring.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/precompiler.lisp

    r4724 r4762  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: precompiler.lisp,v 1.3 2003-11-14 00:06:05 piso Exp $
     4;;; $Id: precompiler.lisp,v 1.4 2003-11-15 01:07:35 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    298298
    299299(defun precompile1 (form)
    300   (when (atom form)
    301     (return-from precompile1 form))
    302   ;; Form is a cons.
    303   (let ((op (car form)))
    304     (when (symbolp op)
    305       (cond ((local-macro-function op)
    306              (let ((result (expand-local-macro form)))
    307                (if (equal result form)
    308                    (return-from precompile1 result)
    309                    (return-from precompile1 (precompile1 result)))))
    310             ((compiler-macro-function op)
    311              (let ((result (compiler-macroexpand form)))
    312                (if (equal result form)
    313                    (return-from precompile1 result)
    314                    (return-from precompile1 (precompile1 result)))))
    315             ((and (not (eq op 'LAMBDA))
    316                   (macro-function op))
    317              ;; It's a macro...
    318              (unless (and (special-operator-p op) (not *in-jvm-compile*))
    319                (let ((result (expand-macro form)))
    320                  (return-from precompile1 (precompile1 result))))))
    321     (let ((handler (get op 'precompile-handler)))
    322       (when handler
    323         (return-from precompile1 (funcall handler form)))))
    324     (when (and (symbolp op) (fboundp op))
    325       (when (special-operator-p op)
    326         (format t "PRECOMPILE1: unsupported special operator ~S~%" op))))
    327   (precompile-cons form))
     300  (if (atom form)
     301      form
     302      (let ((op (car form)))
     303        (when (symbolp op)
     304          (cond ((local-macro-function op)
     305                 (let ((result (expand-local-macro form)))
     306                   (if (equal result form)
     307                       (return-from precompile1 result)
     308                       (return-from precompile1 (precompile1 result)))))
     309                ((compiler-macro-function op)
     310                 (let ((result (compiler-macroexpand form)))
     311                   (if (equal result form)
     312                       (return-from precompile1 result)
     313                       (return-from precompile1 (precompile1 result)))))
     314                ((and (not (eq op 'LAMBDA))
     315                      (macro-function op))
     316                 ;; It's a macro...
     317                 (unless (and (special-operator-p op) (not *in-jvm-compile*))
     318                   (let ((result (expand-macro form)))
     319                     (return-from precompile1 (precompile1 result))))))
     320          (let ((handler (get op 'precompile-handler)))
     321            (when handler
     322              (return-from precompile1 (funcall handler form)))))
     323        (when (and (symbolp op) (special-operator-p op))
     324          (format t "PRECOMPILE1: unsupported special operator ~S~%" op))
     325        (precompile-cons form))))
    328326
    329327(defun precompile-form (form in-jvm-compile)
Note: See TracChangeset for help on using the changeset viewer.