Support declaring functions as integer

This adds a new syntax for declaring functions integer:

    #external integer(<function name>(<arity)).

If a function is declared integer, it may enable some variables to be
detected as integer as well.
This commit is contained in:
2018-04-19 16:11:05 +02:00
parent 89aec98942
commit 159717f51c
3 changed files with 45 additions and 6 deletions

View File

@@ -49,12 +49,9 @@ struct TermDomainVisitor
return ast::Domain::General;
}
static ast::Domain visit(ast::Function &)
static ast::Domain visit(ast::Function &function)
{
// Functions may return values of any type
// TODO: implement explicit integer specifications
return ast::Domain::General;
return function.declaration->domain;
}
static ast::Domain visit(ast::Integer &)