Eval: Add error message for invalid function calls

This commit is contained in:
Riyyi
2023-03-24 23:30:22 +01:00
parent 17fddc1cf4
commit 6c12b199e8
+2 -1
View File
@@ -42,7 +42,7 @@ ASTNode* Eval::evalAst(ASTNode* ast, Environment* env)
if (is<Symbol>(ast)) {
auto result = env->lookup(static_cast<Symbol*>(ast)->symbol());
if (!result) {
Error::the().addError(format("'{}' not found", ast));
Error::the().addError(format("symbols function definition is void: {}", ast));
}
return result;
}
@@ -79,6 +79,7 @@ ASTNode* Eval::apply(List* evaluated_list)
auto nodes = evaluated_list->nodes();
if (!is<Function>(nodes[0])) {
Error::the().addError(format("invalid function: {}", nodes[0]));
return nullptr;
}