From 997667abbb63db4cd64c81b9fe18b7fb8d1cc51d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 29 Jan 2018 21:32:43 -0800 Subject: [PATCH] Change seq-item to flatten its arguments. Also rename flatten-seq-items to flatten-items. --- src/runtime/runtime.pkg | 2 +- src/runtime/syntax-compile.scm | 2 +- src/runtime/syntax-items.scm | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 565e2cf81..d69099c57 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4435,7 +4435,7 @@ USA. expr-item-compiler expr-item? extract-declarations-from-body - flatten-seq-items + flatten-items item->list keyword-item? keyword-value-item diff --git a/src/runtime/syntax-compile.scm b/src/runtime/syntax-compile.scm index 8085a3dca..b437d3c4b 100644 --- a/src/runtime/syntax-compile.scm +++ b/src/runtime/syntax-compile.scm @@ -48,7 +48,7 @@ USA. (map compile-item/top-level body-items)))) (define (compile-body-items items) - (let ((items (flatten-seq-items items))) + (let ((items (flatten-items items))) (if (not (pair? items)) (syntax-error "Empty body")) (output/sequence diff --git a/src/runtime/syntax-items.scm b/src/runtime/syntax-items.scm index 4c571ac8e..d6d46e59b 100644 --- a/src/runtime/syntax-items.scm +++ b/src/runtime/syntax-items.scm @@ -121,20 +121,23 @@ USA. ;;; Sequence items. +(define (seq-item elements) + (%seq-item (flatten-items elements))) + (define-record-type - (seq-item elements) + (%seq-item elements) seq-item? (elements seq-item-elements)) (define (extract-declarations-from-body seq-item) (partition decl-item? (seq-item-elements seq-item))) -(define (flatten-seq-items items) +(define (flatten-items items) (append-map item->list items)) (define (item->list item) (if (seq-item? item) - (flatten-seq-items (seq-item-elements item)) + (seq-item-elements item) (list item))) ;;; Expression items represent any kind of expression other than a -- 2.25.1