VariableInstructionValidator

VariableInstructionValidator

object VariableInstructionValidator

Validator of VariableInstruction nodes.

From

the docs:

VariableInstruction.LocalGet

  • The local C.locals\[x] must be defined in the context.
  • Let t be the value type C.locals\[x].
  • Then the instruction is valid with type [] => \[t].

VariableInstruction.LocalSet

  • The local C.locals\[x] must be defined in the context.
  • Let t be the value type C.locals\[x].
  • Then the instruction is valid with type \[t] => [].

VariableInstruction.LocalTee

  • The local C.locals\[x] must be defined in the context.
  • Let t be the value type C.locals\[x].
  • Then the instruction is valid with type \[t] => \[t].

VariableInstruction.GlobalGet

  • The global C.globals\[x] must be defined in the context.
  • Let mut t be the global type C.globals\[x].
  • Then the instruction is valid with type [] => \[t].

VariableInstruction.GlobalSet

  • The global C.globals\[x] must be defined in the context.
  • Let mut t be the global type C.globals\[x].
  • The mutability mut must be var.
  • Then the instruction is valid with type \[t] => [].

Methods

visit

fun visit(node: VariableInstruction, context: FunctionBody): FunctionBody

Validates the given node, and if necessary: its children (recursively, using other ValidationVisitor instances).

Parameters

Name Description
node: VariableInstruction
context: FunctionBody

ReturnValue

Name Description
FunctionBody