From b8f328cdbfd870e88c87eb67ee30b9adcee13056 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Tue, 17 Dec 2013 13:35:22 -0500 Subject: [PATCH] Refactor tc-utils Use an explicit `provide` list and delete unused functions. original commit: f4d5b00ea582462a5f545b52056ef8227feca679 --- .../typed-racket/utils/tc-utils.rkt | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt index 0a37babb..a958c37d 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt @@ -5,10 +5,36 @@ This file is for utilities that are only useful for Typed Racket, but don't depend on any other portion of the system |# -(provide (all-defined-out) (all-from-out "disappeared-use.rkt")) (require syntax/source-syntax "disappeared-use.rkt" racket/promise syntax/parse (for-syntax racket/base syntax/parse) racket/match) +(provide ;; parameters + current-orig-stx + orig-module-stx + expanded-module-stx + print-syntax? + check-unreachable-code? + warn-unreachable? + delay-errors? + current-type-names + + stringify + locate-stx + warn-unreachable + + report-all-errors + tc-error/delayed + tc-error + tc-error/stx + int-err + + typed-context? + make-env + id-from? + id-from + + (all-from-out "disappeared-use.rkt")) + ;; a parameter representing the original location of the syntax being ;; currently checked (define current-orig-stx (make-parameter #'here)) @@ -23,21 +49,9 @@ don't depend on any other portion of the system (apply string-append (intersperse between (map (lambda (s) (format "~a" s)) l)))) -;; helper function, not currently used -(define (find-origin stx) - (cond [(syntax-property stx 'origin) - => (lambda (orig) - (let ([r (reverse orig)]) - (let loop ([r (reverse orig)]) - (if (null? r) #f - (if (syntax-source (car r)) (car r) - (loop (cdr r)))))))] - [else #f])) - ;; do we print the fully-expanded syntax in error messages? (define print-syntax? (make-parameter #f)) - (define check-unreachable-code? (make-parameter #f)) (define warn-unreachable? (make-parameter #t)) @@ -142,10 +156,6 @@ don't depend on any other portion of the system (parameterize ([current-orig-stx stx]) (apply tc-error msg rest))) -;; check two identifiers to see if they have the same name -(define (symbolic-identifier=? a b) - (eq? (syntax-e a) (syntax-e b))) - ;; parameter for currently-defined type aliases ;; this is used only for printing type names (define current-type-names (make-parameter (lazy '()))) @@ -164,16 +174,6 @@ don't depend on any other portion of the system (syntax->datum (locate-stx (current-orig-stx))))) (current-continuation-marks)))) -(define-syntax (nyi stx) - (syntax-case stx () - [(_ str) - (quasisyntax/loc stx - (int-err "~a: not yet implemented: ~a" - str - #,(syntax/loc stx (this-expression-file-name))))] - [(_) (syntax/loc stx (nyi ""))])) - - ;; are we currently expanding in a typed module (or top-level form)? (define typed-context? (box #f))