From 3c69a1296a512b35429ce626b26632dfae73760c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 28 Feb 2018 13:08:22 -0700 Subject: [PATCH] expander: pay more attention to `(error-print-source-location)` When source locations are disabled, don't include a source location in an error message from `raise-syntax-error`. --- racket/src/expander/syntax/error.rkt | 5 +++-- racket/src/racket/src/startup.inc | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/racket/src/expander/syntax/error.rkt b/racket/src/expander/syntax/error.rkt index 6e7f69c90a..28d7a04c4d 100644 --- a/racket/src/expander/syntax/error.rkt +++ b/racket/src/expander/syntax/error.rkt @@ -69,8 +69,9 @@ (format "\n in: ~.s" (syntax->datum (datum->syntax #f expr)))) "")) (define src-loc-str - (or (extract-source-location sub-expr) - (extract-source-location expr) + (or (and (error-print-source-location) + (or (extract-source-location sub-expr) + (extract-source-location expr))) "")) (raise (exn:fail:syntax (string-append src-loc-str diff --git a/racket/src/racket/src/startup.inc b/racket/src/racket/src/startup.inc index d89169e119..822f060df7 100644 --- a/racket/src/racket/src/startup.inc +++ b/racket/src/racket/src/startup.inc @@ -12815,11 +12815,12 @@ static const char *startup_source = " #f)))" " (if or-part_151 or-part_151 \"\"))))" "(let-values(((src-loc-str_0)" -"(let-values(((or-part_152)(extract-source-location sub-expr_6)))" -"(if or-part_152" -" or-part_152" -"(let-values(((or-part_144)(extract-source-location expr_8)))" -" (if or-part_144 or-part_144 \"\"))))))" +"(let-values(((or-part_152)" +"(if(error-print-source-location)" +"(let-values(((or-part_144)(extract-source-location sub-expr_6)))" +"(if or-part_144 or-part_144(extract-source-location expr_8)))" +" #f)))" +" (if or-part_152 or-part_152 \"\"))))" "(raise" "(exn:fail:syntax_0" " (string-append src-loc-str_0 name_26 \": \" message_12 at-message_0 in-message_0 message-suffix_2)"