Skip to content

Commit 80bf5d7

Browse files
committed
[Heavy] Fix call at top level
1 parent d1b323f commit 80bf5d7

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

heavy/lib/OpGen.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ void OpGen::createLoadModule(heavy::SourceLocation Loc,
138138
}
139139

140140
mlir::Value OpGen::GetSingleResult(heavy::Value V) {
141+
// Ensure we are no longer top level.
142+
if (!TopLevelOp)
143+
InsertTopLevelCommandOp(Context.getLoc());
144+
141145
TailPosScope TPS(*this);
142146
IsTailPos = false;
143147
mlir::Value Result = Visit(V);

heavy/test/Evaluate/begin.scm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@
99
(newline)
1010
(write 'bar)
1111
(newline))
12+
13+
; CHECK: 56
14+
(define-syntax my-begin
15+
(syntax-rules ()
16+
((my-begin x y)
17+
(begin
18+
(write x)
19+
(write y)
20+
(newline)))))
21+
(my-begin 5 6)

heavy/test/Evaluate/define-syntax.scm

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,3 @@
9090
(my-define not-my-local 12)
9191
(write not-my-local)
9292
(newline)))
93-
94-
; FIXME
95-
; COM:CHECK: 5 6
96-
#;(define-syntax blah
97-
(syntax-rules ()
98-
((blah x y)
99-
((begin
100-
(write x)
101-
(write " ")
102-
(write y)
103-
(newline))))))
104-
;(blah 5 6)
105-

0 commit comments

Comments
 (0)