AvailSetOuterVariable

class AvailSetOuterVariable(var relevantTokens: A_Tuple, outerIndex: Int) : AvailInstructionWithIndex

Set the value of a variable found in the function's list of captured outer variables.

Author

Mark van Gulik

Parameters

relevantTokens

The A_Tuple of A_Tokens that are associated with this instruction.

outerIndex

The index of the variable in a function's outer variables.

Constructors

Link copied to clipboard
constructor(relevantTokens: A_Tuple, outerIndex: Int)

Construct a new AvailSetOuterVariable.

Properties

Link copied to clipboard
val index: Int

A generic index to be interpreted by subclasses. Must be non-negative.

Link copied to clipboard
open override val isOuterUse: Boolean

true iff this instruction is a use of an outer variable.

Link copied to clipboard

Answer which line number to say that this instruction occurs on. Use the relevantTokens as an approximation, but subclasses might be able to be more precise. Answer -1 if this instruction doesn't seem to have a location in the source associated with it.

Link copied to clipboard

The tuple of tokens that contributed to producing this instruction.

Functions

Link copied to clipboard
open override fun fixUsageFlags(localData: MutableList<AvailVariableAccessNote?>, outerData: MutableList<AvailVariableAccessNote?>, codeGenerator: AvailCodeGenerator)

The receiver sets the value of an outer variable, so it can't be an outer reference to an argument (they aren't wrapped in a variable).

Link copied to clipboard
open fun writeLineNumberDeltasOn(encodedLineNumberDeltas: MutableList<Int>, currentLineNumber: Int): Int

Write an entry to the encoded line number deltas for each L1 instruction generated. Most AvailInstructions write a single L1 instruction, so that implementation is here.

Link copied to clipboard
open override fun writeNybblesOn(aStream: NybbleOutputStream)

Write nybbles representing this instruction to the NybbleOutputStream.