Eval: Only need to cast AST once
This commit is contained in:
+5
-8
@@ -62,20 +62,17 @@ ValuePtr Eval::evalImpl()
|
|||||||
return evalAst(ast, env);
|
return evalAst(ast, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto list = std::static_pointer_cast<List>(ast);
|
|
||||||
|
|
||||||
if (list->empty()) {
|
|
||||||
return ast;
|
|
||||||
}
|
|
||||||
|
|
||||||
ast = macroExpand(ast, env);
|
ast = macroExpand(ast, env);
|
||||||
|
|
||||||
if (!is<List>(ast.get())) {
|
if (!is<List>(ast.get())) {
|
||||||
return evalAst(ast, env);
|
return evalAst(ast, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Macro-expand modifies `ast', so get the new list
|
auto list = std::static_pointer_cast<List>(ast);
|
||||||
list = std::static_pointer_cast<List>(ast);
|
|
||||||
|
if (list->empty()) {
|
||||||
|
return ast;
|
||||||
|
}
|
||||||
|
|
||||||
// Special forms
|
// Special forms
|
||||||
auto nodes = list->nodes();
|
auto nodes = list->nodes();
|
||||||
|
|||||||
Reference in New Issue
Block a user