From 8646081d73ead2183d1d7a4bd8b4804c73455c30 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Mon, 10 Feb 2014 23:28:23 -0500 Subject: [PATCH] Refactor type-table Move the provides to the top following the style guide and add a purpose statement for the module original commit: c72228dee8602df89373eb5eb4f3547825ebbb64 --- .../typed-racket/types/type-table.rkt | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt index 0f79e2d0..c1e72f8e 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt @@ -1,5 +1,9 @@ #lang racket/base +;; This module provides functions that manipulate tables mapping expressions +;; to type information or other properties. This allows the optimizer or +;; other downstream analyses to use information from the type-checker. + ;; TODO figure out why these imports are needed even though they don't seem to be. (require racket/match "../utils/utils.rkt" @@ -7,6 +11,19 @@ (types utils union) (utils tc-utils)) +(provide/cond-contract + [add-typeof-expr (syntax? tc-results/c . -> . any/c)] + [type-of (syntax? . -> . tc-results/c)] + [reset-type-table (-> any/c)] + [add-tautology (syntax? . -> . any)] + [add-contradiction (syntax? . -> . any)] + [add-neither (syntax? . -> . any)] + [tautology? (syntax? . -> . boolean?)] + [contradiction? (syntax? . -> . boolean?)] + [neither? (syntax? . -> . boolean?)] + [add-dead-lambda-branch (syntax? . -> . any)] + [dead-lambda-branch? (syntax? . -> . boolean?)]) + (define table (make-hasheq)) (define (reset-type-table) (set! table (make-hasheq))) @@ -66,17 +83,3 @@ (hash-set! lambda-dead-table formals #t))) (define (dead-lambda-branch? formals) (hash-ref lambda-dead-table formals #f)) - - -(provide/cond-contract - [add-typeof-expr (syntax? tc-results/c . -> . any/c)] - [type-of (syntax? . -> . tc-results/c)] - [reset-type-table (-> any/c)] - [add-tautology (syntax? . -> . any)] - [add-contradiction (syntax? . -> . any)] - [add-neither (syntax? . -> . any)] - [tautology? (syntax? . -> . boolean?)] - [contradiction? (syntax? . -> . boolean?)] - [neither? (syntax? . -> . boolean?)] - [add-dead-lambda-branch (syntax? . -> . any)] - [dead-lambda-branch? (syntax? . -> . boolean?)])