Centralize the definition of the plambda syntax property.

This commit is contained in:
Eric Dobson 2013-05-25 15:51:23 -07:00
parent 84d3051fee
commit df07151cb9
3 changed files with 20 additions and 11 deletions

View File

@ -57,6 +57,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
"annotate-classes.rkt"
"internal.rkt"
"../utils/tc-utils.rkt"
"../private/syntax-properties.rkt"
"../types/utils.rkt"
"for-clauses.rkt")
"../types/numeric-predicates.rkt"
@ -318,8 +319,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
"duplicate type variable declaration"
(quasisyntax/loc stx
(#%expression
#,(syntax-property (syntax/loc stx (lambda: formals . body))
'typechecker:plambda
#,(plambda-property (syntax/loc stx (lambda: formals . body))
#'(tvars ...))))]))
(define-syntax (pcase-lambda: stx)
@ -329,8 +329,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
"duplicate type variable declaration"
(quasisyntax/loc stx
(#%expression
#,(syntax-property (syntax/loc stx (case-lambda: cl ...))
'typechecker:plambda
#,(plambda-property (syntax/loc stx (case-lambda: cl ...))
#'(tvars ...))))]))
(define-syntax (popt-lambda: stx)
@ -340,8 +339,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
"duplicate type variable declaration"
(quasisyntax/loc stx
(#%expression
#,(syntax-property (syntax/loc stx (opt-lambda: formals . body))
'typechecker:plambda
#,(plambda-property (syntax/loc stx (opt-lambda: formals . body))
#'(tvars ...))))]))
(define-syntax (pdefine: stx)

View File

@ -0,0 +1,11 @@
#lang racket/base
(provide plambda-property)
;; TODO: make this an uninterned symbol once the phasing issue of the unit
;; tests is fixed
(define plambda-symbol 'typechecker:plambda)
(define plambda-property
(case-lambda
((stx) (syntax-property stx plambda-symbol))
((stx value) (syntax-property stx plambda-symbol value))))

View File

@ -7,7 +7,7 @@
(except-in (rep type-rep) make-arr)
(rename-in (except-in (types abbrev utils union) -> ->* one-of/c)
[make-arr* make-arr])
(private type-annotation)
(private type-annotation syntax-properties)
(typecheck signatures tc-metafunctions tc-subst check-below)
(env type-env-structs lexical-env tvar-env index-env scoped-tvar-env)
(utils tc-utils)
@ -325,7 +325,7 @@
expected))))
(define (plambda-prop stx)
(define d (syntax-property stx 'typechecker:plambda))
(define d (plambda-property stx))
(and d (car (flatten d))))
(define (has-poly-annotation? form)