|
|
@ -87,21 +87,10 @@ ASTNodePtr Eval::evalAst(ASTNodePtr ast, EnvironmentPtr env) |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (is<List>(ast_raw_ptr)) { |
|
|
|
else if (is<Collection>(ast_raw_ptr)) { |
|
|
|
auto result = makePtr<List>(); |
|
|
|
std::shared_ptr<Collection> result = nullptr; |
|
|
|
auto nodes = std::static_pointer_cast<List>(ast)->nodes(); |
|
|
|
(is<List>(ast_raw_ptr)) ? result = makePtr<List>() : result = makePtr<Vector>(); |
|
|
|
for (auto node : nodes) { |
|
|
|
auto nodes = std::static_pointer_cast<Collection>(ast)->nodes(); |
|
|
|
ASTNodePtr eval_node = evalImpl(node, env); |
|
|
|
|
|
|
|
if (eval_node == nullptr) { |
|
|
|
|
|
|
|
return nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
result->add(eval_node); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (is<Vector>(ast_raw_ptr)) { |
|
|
|
|
|
|
|
auto result = makePtr<Vector>(); |
|
|
|
|
|
|
|
auto nodes = std::static_pointer_cast<Vector>(ast)->nodes(); |
|
|
|
|
|
|
|
for (auto node : nodes) { |
|
|
|
for (auto node : nodes) { |
|
|
|
ASTNodePtr eval_node = evalImpl(node, env); |
|
|
|
ASTNodePtr eval_node = evalImpl(node, env); |
|
|
|
if (eval_node == nullptr) { |
|
|
|
if (eval_node == nullptr) { |
|
|
|