dont complain about argument number of unknown functions
This commit is contained in:
parent
2d4f4c5bd5
commit
f4ed3e2754
|
@ -70,11 +70,7 @@ std::any TypeCheckVisitor::visitFactor(xlangParser::FactorContext *ctx) {
|
||||||
auto token = identifier->getSymbol();
|
auto token = identifier->getSymbol();
|
||||||
auto name = token->getText();
|
auto name = token->getText();
|
||||||
if (ctx->LeftParen()) {
|
if (ctx->LeftParen()) {
|
||||||
if (function_arity.find(name) == function_arity.end()) {
|
if (function_arity.find(name) != function_arity.end()) {
|
||||||
errorlistener.typeError(token->getLine(),
|
|
||||||
token->getCharPositionInLine(),
|
|
||||||
"unknown function '" + name + "'");
|
|
||||||
}
|
|
||||||
if (auto expr_list = ctx->exprList()) {
|
if (auto expr_list = ctx->exprList()) {
|
||||||
auto arity = function_arity[name];
|
auto arity = function_arity[name];
|
||||||
auto arg_num = expr_list->expr().size();
|
auto arg_num = expr_list->expr().size();
|
||||||
|
@ -92,6 +88,11 @@ std::any TypeCheckVisitor::visitFactor(xlangParser::FactorContext *ctx) {
|
||||||
" arguments, but got none");
|
" arguments, but got none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
errorlistener.typeError(token->getLine(),
|
||||||
|
token->getCharPositionInLine(),
|
||||||
|
"unknown function '" + name + "'");
|
||||||
|
}
|
||||||
visitChildren(ctx);
|
visitChildren(ctx);
|
||||||
} else {
|
} else {
|
||||||
if (!inScope(name)) {
|
if (!inScope(name)) {
|
||||||
|
|
Loading…
Reference in a new issue