provide-trampoline: Ensure expanded export id has srcloc

1. Forms like rename-out supply the original "export-id" syntax to
make-export as orig-stx, as well as the symbol value as out-sym. In
such a case -- that is, when (eq? (syntax-e (export-orig-stx export))
(export-out-sym export)) -- expand using orig-stx, retaining its
source location and other properties.

2. Otherwise, at least expand using out-sym as an identifier with
srcloc from orig-stx. Rationale: Although that source location might
not be exactly correct it is probably better than none at all.

Note: The spirit of this commit is to treat this as a private
implementation detail -- as opposed to stating some new official API
for renaming provide transformers in general -- so this commit doesn't
update documentation for e.g. `make-export`.
This commit is contained in:
Greg Hendershott 2021-04-04 13:42:12 -04:00 committed by Matthew Flatt
parent 612c1865de
commit b7078dc272

View File

@ -763,7 +763,13 @@
(export-local-id export)
(quasisyntax/loc out
(rename #,(export-local-id export)
#,(export-out-sym export))))]
#,(if (eq? (syntax-e (export-orig-stx export))
(export-out-sym export))
(export-orig-stx export)
(datum->syntax
#f
(export-out-sym export)
(export-orig-stx export))))))]
[mode (export-mode export)])
(let ([phased
(cond