Skip to content

Commit efbfc4a

Browse files
iitalicsAlexKnauth
authored andcommitted
Move use of residual from def to :
1 parent bd8257a commit efbfc4a

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
@@ -313,23 +313,22 @@
313313
; forms), it searches for a `binding-declaration` and fills in `internal-id` with the
314314
; actual definition. The `type` field is used as the expected type of the definition.
315315
; fixity : [Maybe Fixity]
316-
(struct binding-declaration [internal-id type delta-syntax residual fixity]
316+
(struct binding-declaration [internal-id type delta-syntax fixity]
317317
#:property prop:procedure
318318
(λ (this stx)
319-
(match-define (binding-declaration x- type _ _ _) this)
319+
(match-define (binding-declaration x- type _ _) this)
320320
((make-typed-var-transformer x- type) stx))
321321
#:property prop:infix-operator
322322
(λ (this) (binding-declaration-fixity this)))
323323

324324
(define-syntax-class id/binding-declaration
325-
#:attributes [internal-id type scoped-binding-introducer residual fixity]
325+
#:attributes [internal-id type scoped-binding-introducer fixity]
326326
[pattern (~var x (local-value binding-declaration?))
327-
#:do [(match-define (binding-declaration x-* type* delta* resid* fixity*)
327+
#:do [(match-define (binding-declaration x-* type* delta* fixity*)
328328
(attribute x.local-value))]
329329
#:attr internal-id (syntax-local-introduce x-*)
330330
#:with type (syntax-local-introduce type*)
331331
#:attr scoped-binding-introducer (make-syntax-delta-introducer delta* #'_)
332-
#:with residual (syntax-local-introduce resid*)
333332
#:attr fixity fixity*]))
334333

335334
(define-syntax-parser define/binding-declaration
@@ -399,13 +398,14 @@
399398
(type-reduce-context #'t.expansion))
400399
#:with delta (syntax-local-introduce
401400
((attribute t.scoped-binding-introducer) #'_))
402-
#`(define-syntax x
403-
(binding-declaration
404-
(quote-syntax x-)
405-
(quote-syntax t_reduced)
406-
(quote-syntax delta)
407-
(quote-syntax t.residual)
408-
'fixity))])])))
401+
#`(begin-
402+
(define-values- [] t.residual)
403+
(define-syntax- x
404+
(binding-declaration
405+
(quote-syntax x-)
406+
(quote-syntax t_reduced)
407+
(quote-syntax delta)
408+
'fixity)))])])))
409409

410410
(define-syntax-parser λ1
411411
[(_ x:id e:expr)
@@ -436,12 +436,11 @@
436436
#:with x- #'x.internal-id
437437
(syntax-property
438438
#`(define- x-
439-
(let-values ([() x.residual])
440-
(#%expression
441-
(: #,((attribute x.scoped-binding-introducer)
442-
#'e)
443-
x.type
444-
#:exact))))
439+
(#%expression
440+
(: #,((attribute x.scoped-binding-introducer)
441+
#'e)
442+
x.type
443+
#:exact)))
445444
'disappeared-use
446445
(syntax-local-introduce #'x))]
447446

0 commit comments

Comments
 (0)