Reduce more dependencies.

Use `syntax/parse/pre` (checked with @rmculpepper).
Use new `begin-encourage-inline` submodule.
Remove use of `match` in TR runtime-loaded code.
This commit is contained in:
Sam Tobin-Hochstadt 2015-03-19 21:41:58 -04:00
parent 4709536653
commit 0dce19e4bf
10 changed files with 39 additions and 39 deletions

View File

@ -5,7 +5,7 @@
;; This file is loaded by all Typed Racket programs, so it should not
;; have expensive runtime dependencies.
(require (for-syntax syntax/parse "../private/syntax-properties.rkt"
(require (for-syntax syntax/parse/pre "../private/syntax-properties.rkt"
racket/base)
"colon.rkt")

View File

@ -1,6 +1,6 @@
#lang racket/base
(require syntax/parse
(require syntax/parse/pre
syntax/parse/experimental/template
"../private/parse-classes.rkt"
"../private/syntax-properties.rkt"

View File

@ -9,7 +9,7 @@
(require (for-syntax "annotate-classes.rkt"
"../private/syntax-properties.rkt"
racket/base
syntax/parse))
syntax/parse/pre))
(provide (rename-out [-case-lambda case-lambda]
[-case-lambda case-lambda:])

View File

@ -1,6 +1,6 @@
#lang racket/base
(require (for-syntax racket/base syntax/parse unstable/syntax
(require (for-syntax racket/base syntax/parse/pre unstable/syntax
"../private/parse-classes.rkt"
"../utils/disappeared-use.rkt"
(only-in "../utils/tc-utils.rkt" tc-error/stx))

View File

@ -1,6 +1,6 @@
#lang racket/base
(require syntax/parse
(require syntax/parse/pre
(for-template (only-in racket/base quote))
"annotate-classes.rkt")

View File

@ -53,7 +53,7 @@
(rename-in racket/contract/base [-> c->] [->* c->*] [case-> c:case->])))
(require racket/lazy-require
syntax/parse
syntax/parse/pre
syntax/stx
racket/syntax
unstable/syntax

View File

@ -13,9 +13,8 @@
"colon.rkt"
"base-types-extra.rkt"
"ann-inst.rkt"
(for-syntax racket/base syntax/parse
(for-syntax racket/base syntax/parse/pre
racket/lazy-require
syntax/parse/experimental/template
syntax/stx
racket/list
racket/syntax

View File

@ -118,7 +118,7 @@ the typed racket language.
(only-in racket/base values))
(for-syntax
racket/lazy-require
syntax/parse
syntax/parse/pre
syntax/parse/experimental/template
syntax/stx
racket/list

View File

@ -1,7 +1,7 @@
#lang racket/base
(require racket/unsafe/ops
racket/performance-hint)
(submod racket/performance-hint begin-encourage-inline))
(provide index? exact-rational?)

View File

@ -6,8 +6,8 @@ don't depend on any other portion of the system
|#
(require syntax/source-syntax "disappeared-use.rkt"
racket/match racket/promise racket/string
syntax/parse (for-syntax racket/base syntax/parse)
racket/promise racket/string
syntax/parse/pre (for-syntax racket/base syntax/parse/pre)
(only-in unstable/sequence in-slice))
(provide ;; parameters
@ -113,40 +113,40 @@ don't depend on any other portion of the system
(define (reset-errors!) (set! delayed-errors null))
(define (report-first-error)
(match (reverse delayed-errors)
[(list) (void)]
[(cons (struct err (msg stx)) _)
(reset-errors!)
(raise-typecheck-error msg stx)]))
(define r (reverse delayed-errors))
(unless (null? r)
(define f (car r))
(reset-errors!)
(raise-typecheck-error (err-msg f) (err-stx f))))
(define (report-all-errors)
(match (reverse delayed-errors)
[(list) (void)]
;; if there's only one, we don't need multiple-error handling
[(list (struct err (msg stx)))
(reset-errors!)
(log-type-error msg stx)
(raise-typecheck-error msg stx)]
[l
(let ([stxs
(for/list ([e (in-list l)])
(with-handlers ([exn:fail:syntax?
(λ (e) ((error-display-handler) (exn-message e) e))])
(log-type-error (err-msg e) (err-stx e))
(raise-typecheck-error (err-msg e) (err-stx e)))
(err-stx e))])
(reset-errors!)
(unless (null? stxs)
(raise-typecheck-error (format "Summary: ~a errors encountered"
(length stxs))
(apply append stxs))))]))
(define l (reverse delayed-errors))
(cond [(null? l) (void)]
;; if there's only one, we don't need multiple-error handling
[(null? (cdr l))
(define f (car l))
(reset-errors!)
(log-type-error (err-msg f) (err-stx f))
(raise-typecheck-error (err-msg f) (err-stx f))]
[else (let ([stxs
(for/list ([e (in-list l)])
(with-handlers ([exn:fail:syntax?
(λ (e) ((error-display-handler) (exn-message e) e))])
(log-type-error (err-msg e) (err-stx e))
(raise-typecheck-error (err-msg e) (err-stx e)))
(err-stx e))])
(reset-errors!)
(unless (null? stxs)
(raise-typecheck-error (format "Summary: ~a errors encountered"
(length stxs))
(apply append stxs))))]))
;; Returns #t if there's a type error recorded at the same position as
;; the given syntax object. Does not return a useful result if the
;; source, position, or span are #f.
(define (error-at-stx-loc? stx)
(for/or ([an-err (in-list delayed-errors)])
(match-define (struct err (_ stxes)) an-err)
(define stxes (err-stx an-err))
(define stx* (and (not (null? stxes)) (car stxes)))
(and stx*
(equal? (syntax-source stx*) (syntax-source stx))
@ -215,7 +215,8 @@ don't depend on any other portion of the system
(define-values (field-strs vals)
(for/fold ([field-strs null] [vals null])
([field+value (in-slice 2 rst)])
(match-define (list field value) field+value)
(define field (car field+value))
(define value (cadr field+value))
(define field-strs*
(cons (format " ~a: ~~a" field) field-strs))
(values field-strs* (cons value vals))))