From 2487015663e1dd78534a0e01a875e2309ae9b04d Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Sun, 7 Oct 2012 12:55:57 -0700 Subject: [PATCH] Make LOCAL-DECLARE a macro. --- src/runtime/mit-macros.scm | 11 +++++++++++ src/runtime/mit-syntax.scm | 11 ----------- src/runtime/runtime.pkg | 3 +-- src/runtime/syntax-definitions.scm | 1 - src/runtime/syntax-output.scm | 3 --- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 245e5869f..549effe2f 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -631,6 +631,17 @@ USA. ,r-unspecific) (,r-shallow-fluid-bind ,swap! ,body ,swap!))))))) +(define-syntax :local-declare + (er-macro-transformer + (lambda (form rename compare) + compare + (syntax-check '(KEYWORD (* (IDENTIFIER * DATUM)) + FORM) form) + (let ((r-let (rename 'LET)) + (r-declare (rename 'DECLARE))) + `(,r-let () + (,r-declare ,@(cadr form)) + ,@(cddr form)))))) + (define (unspecific-expression) `(,keyword:unspecific)) diff --git a/src/runtime/mit-syntax.scm b/src/runtime/mit-syntax.scm index 17522c64b..6788ff5e5 100644 --- a/src/runtime/mit-syntax.scm +++ b/src/runtime/mit-syntax.scm @@ -332,17 +332,6 @@ USA. (lambda () (classify/declarations (cdr form) environment)))) -(define (classifier:local-declare form environment definition-environment) - (syntax-check '(KEYWORD (* (IDENTIFIER * DATUM)) + FORM) form) - (let ((body - (classify/body (cddr form) - environment - definition-environment))) - (make-expression-item - (lambda () - (output/local-declare (classify/declarations (cadr form) environment) - (compile-body-item body)))))) - (define (classify/declarations declarations environment) (map (lambda (declaration) (classify/declaration declaration environment)) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 494c163b4..86e925883 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4699,7 +4699,6 @@ USA. output/lambda output/let output/letrec - output/local-declare output/named-lambda output/post-process-expression output/runtime-reference @@ -4742,7 +4741,6 @@ USA. classifier:er-macro-transformer classifier:let-syntax classifier:letrec-syntax - classifier:local-declare classifier:non-hygienic-macro-transformer classifier:rsc-macro-transformer classifier:sc-macro-transformer @@ -4785,6 +4783,7 @@ USA. (let*-syntax :let*-syntax) (letrec :letrec) (letrec* :letrec*) + (local-declare :local-declare) (quasiquote :quasiquote) (receive :receive) supported-srfi-features) diff --git a/src/runtime/syntax-definitions.scm b/src/runtime/syntax-definitions.scm index 0a1e21b5d..0378104cc 100644 --- a/src/runtime/syntax-definitions.scm +++ b/src/runtime/syntax-definitions.scm @@ -46,7 +46,6 @@ USA. (define-classifier 'ER-MACRO-TRANSFORMER classifier:er-macro-transformer) (define-classifier 'LET-SYNTAX classifier:let-syntax) (define-classifier 'LETREC-SYNTAX classifier:letrec-syntax) - (define-classifier 'LOCAL-DECLARE classifier:local-declare) (define-classifier 'NON-HYGIENIC-MACRO-TRANSFORMER classifier:non-hygienic-macro-transformer) (define-classifier 'RSC-MACRO-TRANSFORMER classifier:rsc-macro-transformer) diff --git a/src/runtime/syntax-output.scm b/src/runtime/syntax-output.scm index 272891d93..027741ef8 100644 --- a/src/runtime/syntax-output.scm +++ b/src/runtime/syntax-output.scm @@ -150,9 +150,6 @@ USA. (define (output/runtime-reference name) (output/access-reference name system-global-environment)) -(define (output/local-declare declarations body) - (make-declaration declarations body)) - (define lambda-tag:unnamed '|#[unnamed-procedure]|) (define lambda-tag:let '|#[let-procedure]|) (define lambda-tag:fluid-let '|#[fluid-let-procedure]|) -- 2.25.1