arithmetic operators and functions working on constant arguments. We call this ConstEvalCoreFunctions, because they are default functions (or predefined, or core) and they can be resolved to a value at compile time (hence consteval).
arithmetic operators and functions working on variable arguments. Or CoreFunctions. The set of consteval core functions and core functions is the same. But core functions can receive non-const arguments.
user defined functions. Functions.
The v3x Resolver keeps separate tables for each of this type of functions. When it tries to resolve a function call:
It will successively check if the callee is a ConstEvalCoreFunction, a CoreFunction, or a Function, in that order.
Consteval core functions will be executed during resolution, and resolved to a value (e.g. a ConstInt).
Core functions and user defined functions will resolve to a value::FunctionCall, which holds a value::FunctionRefBase, and a list of arguments, Any<value::ValueBase>.
Fore core functions, the value::FunctionRefBase will be a value::CoreFunctionRef, whereas for user defined functions, it will be a value::FunctionRef.
A value::CoreFunctionRef will point to a function::FunctionRef, a structure similar to an instruction::InstructionRef, holding a name, a return type, and a list of parameter types.
A value::FunctionRef will point to a semantic::Function, a semantic AST node holding as well a name, a return type, a list of parameters, but also a block of statements and a list of local variables.
A default analyzer can now register:
ConstEvalCoreFunction
s, because they are default functions (or predefined, or core) and they can be resolved to a value at compile time (hence consteval).CoreFunction
s. The set of consteval core functions and core functions is the same. But core functions can receive non-const arguments.Function
s.The v3x Resolver keeps separate tables for each of this type of functions. When it tries to resolve a function call:
ConstEvalCoreFunction
, aCoreFunction
, or aFunction
, in that order.ConstInt
).value::FunctionCall
, which holds avalue::FunctionRefBase
, and a list of arguments,Any<value::ValueBase>
.value::FunctionRefBase
will be avalue::CoreFunctionRef
, whereas for user defined functions, it will be avalue::FunctionRef
.value::CoreFunctionRef
will point to afunction::FunctionRef
, a structure similar to aninstruction::InstructionRef
, holding a name, a return type, and a list of parameter types.value::FunctionRef
will point to asemantic::Function
, a semantic AST node holding as well a name, a return type, a list of parameters, but also a block of statements and a list of local variables.