Add `stepper-skipto/discard' property.
Like stepper-skipto, but discards the context. This is for the contracts implementation in the DMdA teaching languages. svn: r12078
This commit is contained in:
parent
e2d4bc0d2b
commit
f26fcdd82c
|
@ -202,6 +202,16 @@ Where it's used: the stepper-skipto label is used by the 2nd-pass
|
|||
macro-labeler and the annotator. Both are in annotate.ss. In addition
|
||||
to skipping inward, a stepper hint
|
||||
|
||||
stepper-skipto/discard :
|
||||
|
||||
This is like stepper-skipto, except that it makes the stepper
|
||||
replace the expression the property is attached to by the
|
||||
subexpression indicated by its value.
|
||||
|
||||
(This is used in the contracts implementation for "Die Macht der
|
||||
Abstraktion", where procedures are wrapped in a contract-checking
|
||||
context that has no impact on the reduction semantics.)
|
||||
|
||||
stepper-else :
|
||||
[ #t ] : Initially applied to the 'true' that the cond macro
|
||||
replaces a beginner's 'else' with, it is later transferred
|
||||
|
|
|
@ -387,21 +387,25 @@
|
|||
. -> . (vector/p syntax? binding-set?))
|
||||
(lambda (exp tail-bound pre-break? procedure-name-info)
|
||||
|
||||
(cond [(stepper-syntax-property exp 'stepper-skipto)
|
||||
(let* ([free-vars-captured #f] ; this will be set!'ed
|
||||
;[dont-care (printf "expr: ~a\nskipto: ~a\n" expr (stepper-syntax-property expr 'stepper-skipto))]
|
||||
; WARNING! I depend on the order of evaluation in application arguments here:
|
||||
[annotated (skipto/auto
|
||||
exp
|
||||
'rebuild
|
||||
(lambda (subterm)
|
||||
(let*-2vals ([(stx free-vars) (annotate/inner subterm tail-bound pre-break? procedure-name-info)])
|
||||
(set! free-vars-captured free-vars)
|
||||
stx)))])
|
||||
(2vals (wcm-wrap
|
||||
skipto-mark
|
||||
annotated)
|
||||
free-vars-captured))]
|
||||
(cond [(cond
|
||||
((stepper-syntax-property exp 'stepper-skipto) 'rebuild)
|
||||
((stepper-syntax-property exp 'stepper-skipto/discard) 'discard)
|
||||
(else #f))
|
||||
=> (lambda (traversal)
|
||||
(let* ([free-vars-captured #f] ; this will be set!'ed
|
||||
;;[dont-care (printf "expr: ~a\nskipto: ~a\n" expr (stepper-syntax-property expr 'stepper-skipto))]
|
||||
;; WARNING! I depend on the order of evaluation in application arguments here:
|
||||
[annotated (skipto/auto
|
||||
exp
|
||||
traversal
|
||||
(lambda (subterm)
|
||||
(let*-2vals ([(stx free-vars) (annotate/inner subterm tail-bound pre-break? procedure-name-info)])
|
||||
(set! free-vars-captured free-vars)
|
||||
stx)))])
|
||||
(2vals (wcm-wrap
|
||||
skipto-mark
|
||||
annotated)
|
||||
free-vars-captured)))]
|
||||
|
||||
[(stepper-syntax-property exp 'stepper-skip-completely)
|
||||
(2vals (wcm-wrap 13 exp) null)]
|
||||
|
|
|
@ -481,7 +481,8 @@
|
|||
;; traversal argument is 'discard, the result of the transformation is the
|
||||
;; result of this function
|
||||
(define (skipto/auto stx traversal transformer)
|
||||
(cond [(stepper-syntax-property stx 'stepper-skipto)
|
||||
(cond [(or (stepper-syntax-property stx 'stepper-skipto)
|
||||
(stepper-syntax-property stx 'stepper-skipto/discard))
|
||||
=>
|
||||
(cut update <> stx (cut skipto/auto <> traversal transformer) traversal)]
|
||||
[else (transformer stx)]))
|
||||
|
|
Loading…
Reference in New Issue
Block a user