Changeset 8776


Ignore:
Timestamp:
03/15/05 03:58:55 (16 years ago)
Author:
piso
Message:

PROCESS-TOPLEVEL-MACROLET

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/compile-file.lisp

    r8765 r8776  
    22;;;
    33;;; Copyright (C) 2004-2005 Peter Graves
    4 ;;; $Id: compile-file.lisp,v 1.63 2005-03-13 16:25:45 piso Exp $
     4;;; $Id: compile-file.lisp,v 1.64 2005-03-15 03:58:55 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2121
    2222(require 'jvm)
     23
     24(defvar *compile-file-environment* nil)
    2325
    2426(defvar *fbound-names*)
     
    158160         (case (car form)
    159161           (MACROLET
    160             (let ((new-form (precompiler::precompile-macrolet form)))
    161               (process-toplevel-form new-form stream compile-time-too)
    162               (return-from process-toplevel-form)))
     162            (process-toplevel-macrolet form stream compile-time-too)
     163            (return-from process-toplevel-form))
    163164           ((IN-PACKAGE DEFPACKAGE)
    164165            (eval form))
     
    229230           ((DEFGENERIC DEFMETHOD)
    230231            (jvm::note-name-defined (second form))
    231             (process-toplevel-form (macroexpand-1 form) stream compile-time-too)
     232            (process-toplevel-form (macroexpand-1 form *compile-file-environment*)
     233                                   stream compile-time-too)
    232234            (return-from process-toplevel-form))
    233235           (DEFMACRO
     
    271273           (LOCALLY
    272274            ;; FIXME Need to handle special declarations too!
    273             (let ((jvm:*speed* jvm:*speed*)
     275            (let ((jvm:*speed*  jvm:*speed*)
    274276                  (jvm:*safety* jvm:*safety*)
    275                   (jvm:*debug* jvm:*debug*))
     277                  (jvm:*debug*  jvm:*debug*))
    276278              (jvm::process-optimization-declarations (cdr form))
    277279              (process-toplevel-progn (cdr form) stream compile-time-too)
     
    282284           (t
    283285            (when (and (symbolp (car form))
    284                        (macro-function (car form)))
     286                       (macro-function (car form) *compile-file-environment*))
    285287              ;; Note that we want MACROEXPAND-1 and not MACROEXPAND here, in
    286288              ;; case the form being expanded expands into something that needs
    287289              ;; special handling by PROCESS-TOPLEVEL-FORM (e.g. DEFMACRO).
    288               (process-toplevel-form (macroexpand-1 form) stream compile-time-too)
     290              (process-toplevel-form (macroexpand-1 form *compile-file-environment*)
     291                                     stream compile-time-too)
    289292              (return-from process-toplevel-form))
    290293            (when compile-time-too
    291294              (eval form))))))
    292295  (dump-form form stream))
     296
     297(defun process-toplevel-macrolet (form stream compile-time-too)
     298  (let ((*compile-file-environment* (make-environment *compile-file-environment*)))
     299    (dolist (definition (cadr form))
     300      (environment-add-macro-definition *compile-file-environment*
     301                                        (car definition)
     302                                        (make-macro (car definition)
     303                                                    (make-expander-for-macrolet definition))))
     304    (dolist (body-form (cddr form))
     305      (process-toplevel-form body-form stream compile-time-too))))
    293306
    294307(defun process-toplevel-progn (forms stream compile-time-too)
Note: See TracChangeset for help on using the changeset viewer.