From 32fbc38fbb3c7544a45f7be3cf0a981a31681cbb Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 14 Feb 2012 23:22:51 -0500 Subject: [PATCH 3/5] psyntax: access source properties for all supported objects * module/ice-9/psyntax.scm (decorate-source): Set source properties on any object that satisfies 'supports-source-properties?'. Previously we used 'pair?' as the predicate. (source-annotation): Apply 'source-properties' to _any_ kind of source expression, where previously only pairs were queried. If the argument is a syntax-object, apply the source-properties to the syntax-object's expression. In the peculiar case of a syntax-object whose expression is also a syntax-object: previously we would iterate, but with this commit we now call 'syntax-object-expression' only once. * module/ice-9/psyntax-pp.scm: Regenerate. --- module/ice-9/psyntax-pp.scm |12795 ++++++++++++++++++++++--------------------- module/ice-9/psyntax.scm | 15 +- 2 files changed, 6438 insertions(+), 6372 deletions(-) diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 729ae6e..4290069 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -301,7 +301,7 @@ (define (decorate-source e s) - (if (and (pair? e) s) + (if (and s (supports-source-properties? e)) (set-source-properties! e s)) e) @@ -461,14 +461,11 @@ (define source-annotation (lambda (x) - (cond - ((syntax-object? x) - (source-annotation (syntax-object-expression x))) - ((pair? x) (let ((props (source-properties x))) - (if (pair? props) - props - #f))) - (else #f)))) + (let ((props (source-properties + (if (syntax-object? x) + (syntax-object-expression x) + x)))) + (and (pair? props) props)))) (define-syntax-rule (arg-check pred? e who) (let ((x e)) -- 1.7.5.4