Skip to content

Commit 089f3a2

Browse files
committed
fix compiling empty map
1 parent 54853d6 commit 089f3a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bytecode.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ impl BytecodeCompiler {
203203
self.compile_value(value);
204204
}
205205

206-
// three modes: 1. list op; 2. list call; 3. recursive cons
207-
if list_len < (1 << 8) {
206+
// four modes: 0. (empty) just nil 1. list op; 2. list call; 3. recursive cons
207+
if list_len == 0 {
208+
self.compile_constant_op(LispObject::Nil);
209+
} else if list_len < (1 << 8) {
208210
self.ops.push(Op::List(list_len as u8));
209211
} else if list_len < (1 << 16) {
210212
self.ops.push(Op::Call(list_len as u16));

0 commit comments

Comments
 (0)