errortrace: skip annotation in namespace with wrong base phase
Closes PR 12551
This commit is contained in:
parent
77bd401a2d
commit
284ba01db6
|
@ -436,7 +436,8 @@
|
||||||
|
|
||||||
(define (make-errortrace-compile-handler)
|
(define (make-errortrace-compile-handler)
|
||||||
(let ([orig (current-compile)]
|
(let ([orig (current-compile)]
|
||||||
[reg (namespace-module-registry (current-namespace))])
|
[reg (namespace-module-registry (current-namespace))]
|
||||||
|
[phase (namespace-base-phase (current-namespace))])
|
||||||
(namespace-attach-module (namespace-anchor->namespace orig-namespace) 'racket/base)
|
(namespace-attach-module (namespace-anchor->namespace orig-namespace) 'racket/base)
|
||||||
(namespace-attach-module (namespace-anchor->namespace orig-namespace) 'errortrace/errortrace-key)
|
(namespace-attach-module (namespace-anchor->namespace orig-namespace) 'errortrace/errortrace-key)
|
||||||
(lambda (e immediate-eval?)
|
(lambda (e immediate-eval?)
|
||||||
|
@ -444,6 +445,8 @@
|
||||||
(if (and (instrumenting-enabled)
|
(if (and (instrumenting-enabled)
|
||||||
(eq? reg
|
(eq? reg
|
||||||
(namespace-module-registry (current-namespace)))
|
(namespace-module-registry (current-namespace)))
|
||||||
|
(equal? phase
|
||||||
|
(namespace-base-phase (current-namespace)))
|
||||||
(not (compiled-expression? (if (syntax? e)
|
(not (compiled-expression? (if (syntax? e)
|
||||||
(syntax-e e)
|
(syntax-e e)
|
||||||
e))))
|
e))))
|
||||||
|
|
|
@ -237,7 +237,7 @@ source location information) for the original expression, and the
|
||||||
second element of the pair indicates if the code has been executed.
|
second element of the pair indicates if the code has been executed.
|
||||||
This list is snapshot of the current state of the computation.}
|
This list is snapshot of the current state of the computation.}
|
||||||
|
|
||||||
@defproc[(get-execute-counts) (list (cons/c syntax? number?))])]{
|
@defproc[(get-execute-counts) (list (cons/c syntax? number?))]{
|
||||||
Returns a list of pairs, one for each instrumented expression. The
|
Returns a list of pairs, one for each instrumented expression. The
|
||||||
first element of the pair is a @racket[syntax?] object (usually containing
|
first element of the pair is a @racket[syntax?] object (usually containing
|
||||||
source location information) for the original expression, and the
|
source location information) for the original expression, and the
|
||||||
|
@ -308,7 +308,8 @@ Compiles @racket[stx] using the compilation handler that was active
|
||||||
when the @racketmodname[errortrace/errortrace-lib] module was
|
when the @racketmodname[errortrace/errortrace-lib] module was
|
||||||
executed, but first instruments the code for Errortrace information.
|
executed, but first instruments the code for Errortrace information.
|
||||||
The code is instrumented only if
|
The code is instrumented only if
|
||||||
@racketblock[(namespace-module-registry (current-namespace))]
|
@racketblock[(list (namespace-module-registry (current-namespace))
|
||||||
|
(namespace-base-phase (current-namespace)))]
|
||||||
is the same as when the
|
is the same as when the
|
||||||
@racketmodname[errortrace/errortrace-lib] module was executed. This
|
@racketmodname[errortrace/errortrace-lib] module was executed. This
|
||||||
procedure is suitable for use as a compilation handler via
|
procedure is suitable for use as a compilation handler via
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
(require tests/eli-tester
|
(require tests/eli-tester
|
||||||
"wrap.rkt"
|
"wrap.rkt"
|
||||||
"alert.rkt"
|
"alert.rkt"
|
||||||
"phase-1.rkt")
|
"phase-1.rkt"
|
||||||
|
"phase-1-eval.rkt")
|
||||||
|
|
||||||
(wrap-tests)
|
(wrap-tests)
|
||||||
|
|
||||||
(test do (alert-tests))
|
(test do (alert-tests))
|
||||||
|
|
||||||
(phase-1-tests)
|
(phase-1-tests)
|
||||||
|
(phase-1-eval-tests)
|
||||||
|
|
12
collects/tests/errortrace/phase-1-eval.rkt
Normal file
12
collects/tests/errortrace/phase-1-eval.rkt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
(provide phase-1-eval-tests)
|
||||||
|
|
||||||
|
;; Check that eval at phase 1 doesn't use errortrace.
|
||||||
|
(define (phase-1-eval-tests)
|
||||||
|
(define ns (make-base-namespace))
|
||||||
|
(parameterize ([current-namespace ns])
|
||||||
|
(namespace-require '(for-syntax (only racket/base + eval quote #%app #%datum)))
|
||||||
|
(dynamic-require 'errortrace #f)
|
||||||
|
(eval '(begin-for-syntax (eval '(+ 1 2))))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user