File tree Expand file tree Collapse file tree 3 files changed +34
-7
lines changed Expand file tree Collapse file tree 3 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ mlir::Value OpGen::GetSingleResult(heavy::Value V) {
143143 mlir::Value Result = Visit (V);
144144
145145 // Take the first continuation arg.
146- if (isa<HeavyValueRefsTy>(Result.getType ()))
146+ if (Result && isa<HeavyValueRefsTy>(Result.getType ()))
147147 Result = create<LoadRefOp>(heavy::SourceLocation (), Result, /* Index*/ 0 );
148148
149149 if (CheckError ())
@@ -533,12 +533,6 @@ void OpGen::PopContinuationScope() {
533533
534534bool OpGen::isLocalDefineAllowed () {
535535 return IsLocalDefineAllowed;
536- #if 0
537- mlir::Block* Block = Builder.getInsertionBlock();
538- if (!Block) return false;
539- return (Block->empty() ||
540- isa<BindingOp>(Block->back()));
541- #endif
542536}
543537
544538// createSyntaxSpec
Original file line number Diff line number Diff line change 33
44; ; TODO Local let-syntax needs to be tested/supported.
55
6+ (define-syntax capture-late-bind
7+ (syntax-rules ()
8+ ((capture-late-bind x)
9+ ((lambda ()
10+ (define storage 0)
11+ (lambda ()
12+ (set! storage
13+ (if (symbol? ok)
14+ ok 'oknotyet ))
15+ (write storage)))))))
16+
17+ ; CHECK: oknotyet
18+ ((capture-late-bind 5 ))
19+ (newline)
20+
621(define ok 'ok!)
22+
23+ ; CHECK-NEXT: ok
24+ ((capture-late-bind 5 ))
25+
26+ (newline)
727(define-syntax my-lambda
828 (syntax-rules (=>)
929 ((my-lambda formals => body)
Original file line number Diff line number Diff line change 7878 msg)))
7979(write global)
8080(newline)
81+
82+ ; Test capture of lazy global binding.
83+ (define (fnzzz )
84+ (define temp lazy-binding-fn)
85+ (lambda (x )
86+ (temp x)))
87+
88+ (define (lazy-binding-fn x )
89+ (write x)
90+ (newline))
91+
92+ ; CHECK: just-lazy
93+ ((fnzzz) 'just-lazy )
You can’t perform that action at this time.
0 commit comments