Skip to content

Commit 3ff3d7f

Browse files
iitalicsAlexKnauth
authored andcommitted
Move use of residual from def to :
1 parent 9eed71e commit 3ff3d7f

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

hackett-lib/hackett/private/base.rkt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,23 +331,22 @@
331331
; forms), it searches for a `binding-declaration` and fills in `internal-id` with the
332332
; actual definition. The `type` field is used as the expected type of the definition.
333333
; fixity : [Maybe Fixity]
334-
(struct binding-declaration [internal-id type delta-syntax residual fixity]
334+
(struct binding-declaration [internal-id type delta-syntax fixity]
335335
#:property prop:procedure
336336
(λ (this stx)
337-
(match-define (binding-declaration x- type _ _ _) this)
337+
(match-define (binding-declaration x- type _ _) this)
338338
((make-typed-var-transformer x- type) stx))
339339
#:property prop:infix-operator
340340
(λ (this) (binding-declaration-fixity this)))
341341

342342
(define-syntax-class id/binding-declaration
343-
#:attributes [internal-id type scoped-binding-introducer residual fixity]
343+
#:attributes [internal-id type scoped-binding-introducer fixity]
344344
[pattern (~var x (local-value binding-declaration?))
345-
#:do [(match-define (binding-declaration x-* type* delta* resid* fixity*)
345+
#:do [(match-define (binding-declaration x-* type* delta* fixity*)
346346
(attribute x.local-value))]
347347
#:attr internal-id (syntax-local-introduce x-*)
348348
#:with type (syntax-local-introduce type*)
349349
#:attr scoped-binding-introducer (make-syntax-delta-introducer delta* #'_)
350-
#:with residual (syntax-local-introduce resid*)
351350
#:attr fixity fixity*]))
352351

353352
(define-syntax-parser define/binding-declaration
@@ -417,13 +416,14 @@
417416
(type-reduce-context #'t.expansion))
418417
#:with delta (syntax-local-introduce
419418
((attribute t.scoped-binding-introducer) #'_))
420-
#`(define-syntax x
421-
(binding-declaration
422-
(quote-syntax x-)
423-
(quote-syntax t_reduced)
424-
(quote-syntax delta)
425-
(quote-syntax t.residual)
426-
'fixity))])])))
419+
#`(begin-
420+
(define-values- [] t.residual)
421+
(define-syntax- x
422+
(binding-declaration
423+
(quote-syntax x-)
424+
(quote-syntax t_reduced)
425+
(quote-syntax delta)
426+
'fixity)))])])))
427427

428428
(define-syntax-parser λ1
429429
[(_ x:id e:expr)
@@ -454,12 +454,11 @@
454454
#:with x- #'x.internal-id
455455
(syntax-property
456456
#`(define- x-
457-
(let-values ([() x.residual])
458-
(#%expression
459-
(: #,((attribute x.scoped-binding-introducer)
460-
#'e)
461-
x.type
462-
#:exact))))
457+
(#%expression
458+
(: #,((attribute x.scoped-binding-introducer)
459+
#'e)
460+
x.type
461+
#:exact)))
463462
'disappeared-use
464463
(syntax-local-introduce #'x))]
465464

0 commit comments

Comments
 (0)