10.13. Constant expression checker and substitution
The CONSTANT_EXPRESSION module provides the [constant_expression] function
annotation. Functions marked with this annotation are evaluated at compile
time when all arguments are constants, replacing the call with the computed
result.
All functions and symbols are in “constant_expression” module, use require to get access to it.
require daslib/constant_expression
10.13.1. Function annotations
- constexpr
Checks selected function arguments and fails when any receives a non-constant expression.
- constant_expression
This function annotation implements constant expression folding for the given arguments.
10.13.2. Macro helpers
- isConstantExpression(expr: Expression? ): bool
This macro function returns true if the expression is a constant expression
- Arguments:
expr : Expression?