ExpressionValidator
class ExpressionValidator
Constructors
<init>
constructor(expectedResult: ValueType?, isConstant: Boolean)
Validator of Expression nodes.
From the docs:
Expressions expr are classified by result types of the form [t?].
instr* end
- The instruction sequence
instr*must be valid with type[] => [t?], for some optional value typet?. - Then the expression is valid with result type
[t?].
Constant Expressions
- In a constant expression
instr* endall instructions ininstr*must be constant. A constant instruction
instrmust be:- either of the form
t.const c, - or of the form
global.get x, in which caseC.globals\[x]must be a global type of the formconst t.
- either of the form
Parameters
| Name | Description |
|---|---|
expectedResult: ValueType?
|
|
isConstant: Boolean
|
Methods
visit
fun visit(node: Expression, context: FunctionBody): FunctionBody
Validates the given node, and if necessary: its children (recursively, using other ValidationVisitor instances).
Parameters
| Name | Description |
|---|---|
node: Expression
|
|
context: FunctionBody
|
ReturnValue
| Name | Description |
|---|---|
FunctionBody
|
Validator of Expression nodes.
From the docs:
Expressions
exprare classified by result types of the form[t?].instr*must be valid with type[] => [t?], for some optional value typet?.[t?].Constant Expressions
instr* endall instructions ininstr*must be constant.A constant instruction
instrmust be:t.const c,global.get x, in which caseC.globals\[x]must be a global type of the formconst t.