1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 17:47:53 +03:00

nim: Fix crash on literal empty list

Issue #190
This commit is contained in:
Dov Murik 2016-03-30 09:11:52 -04:00
parent 9c7a452efa
commit 920963d69f
5 changed files with 5 additions and 0 deletions

View File

@ -22,6 +22,7 @@ proc eval_ast(ast: MalType, env: var Env): MalType =
proc eval(ast: MalType, env: var Env): MalType =
case ast.kind
of List:
if ast.list.len == 0: return ast
let
a0 = ast.list[0]
a1 = ast.list[1]

View File

@ -22,6 +22,7 @@ proc eval_ast(ast: MalType, env: var Env): MalType =
proc eval(ast: MalType, env: var Env): MalType =
case ast.kind
of List:
if ast.list.len == 0: return ast
let a0 = ast.list[0]
case a0.kind
of Symbol:

View File

@ -34,6 +34,7 @@ proc eval(ast: MalType, env: var Env): MalType =
while true:
if ast.kind != List: return ast.eval_ast(env)
if ast.list.len == 0: return ast
let a0 = ast.list[0]
case a0.kind

View File

@ -34,6 +34,7 @@ proc eval(ast: MalType, env: var Env): MalType =
while true:
if ast.kind != List: return ast.eval_ast(env)
if ast.list.len == 0: return ast
let a0 = ast.list[0]
case a0.kind

View File

@ -48,6 +48,7 @@ proc eval(ast: MalType, env: var Env): MalType =
while true:
if ast.kind != List: return ast.eval_ast(env)
if ast.list.len == 0: return ast
let a0 = ast.list[0]
case a0.kind