Builder

scalus.compiler.sir.lowering.LoweredValue.Builder
object Builder

Builder for LoweredValue, to avoid boilerplate code. Import this object to make available

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Builder.type

Members list

Value members

Concrete methods

def lvApply(f: LoweredValue, arg: LoweredValue, inPos: SIRPosition, resTp: Option[SIRType] = ..., resRepr: Option[LoweredValueRepresentation] = ...)(using lctx: LoweringContext): LoweredValue
def lvBoolConstant(value: Boolean, pos: SIRPosition)(using lctx: LoweringContext): ConstantLoweredValue
def lvCaseBoolean(scrutinee: LoweredValue, falseBranch: LoweredValue, trueBranch: LoweredValue, inPos: SIRPosition, optTargetType: Option[SIRType] = ...)(using lctx: LoweringContext): LoweredValue

Generate a case expression on a boolean value (PlutusV4 feature).

Generate a case expression on a boolean value (PlutusV4 feature).

In PlutusV4, Case can be used directly on boolean constants: Case(bool, [falseBranch, trueBranch]) where False = index 0 and True = index 1.

Attributes

def lvCaseData(scrutinee: LoweredValue, constrTagVar: IdentifiableLoweredValue, constrArgsVar: IdentifiableLoweredValue, constrBranch: LoweredValue, mapEntriesVar: IdentifiableLoweredValue, mapBranch: LoweredValue, listElementsVar: IdentifiableLoweredValue, listBranch: LoweredValue, iValueVar: IdentifiableLoweredValue, iBranch: LoweredValue, bValueVar: IdentifiableLoweredValue, bBranch: LoweredValue, inPos: SIRPosition, optTargetType: Option[SIRType] = ...)(using lctx: LoweringContext): LoweredValue

Create a Case on Data for PlutusV4+.

Create a Case on Data for PlutusV4+.

Value parameters

bBranch

the branch to execute for B case

bValueVar

variable to bind to the bytestring value (ByteString)

constrArgsVar

variable to bind to the constructor args (List[Data])

constrBranch

the branch to execute for Constr case

constrTagVar

variable to bind to the constructor tag (Integer)

iBranch

the branch to execute for I case

iValueVar

variable to bind to the integer value (Integer)

inPos

source position

listBranch

the branch to execute for List case

listElementsVar

variable to bind to the list elements (List[Data])

mapBranch

the branch to execute for Map case

mapEntriesVar

variable to bind to the map entries (List[(Data, Data)])

optTargetType

optional target type for the result

scrutinee

the Data value to match on

Attributes

def lvCaseInteger(scrutinee: LoweredValue, branches: List[LoweredValue], inPos: SIRPosition, optTargetType: Option[SIRType] = ...)(using lctx: LoweringContext): LoweredValue

Generate a case expression on an integer value (PlutusV4 feature).

Generate a case expression on an integer value (PlutusV4 feature).

In PlutusV4, Case can be used directly on integer constants when cases form a contiguous sequence starting from 0: Case(int, [branch0, branch1, ..., branchN]).

Value parameters

branches

list of branches indexed by integer value (0 -> branches(0), 1 -> branches(1), etc.)

inPos

source position

optTargetType

optional target type for the result

scrutinee

the integer value to match on

Attributes

def lvCaseList(scrutinee: LoweredValue, consHead: IdentifiableLoweredValue, consTail: IdentifiableLoweredValue, consBranch: LoweredValue, nilBranch: LoweredValue, inPos: SIRPosition, optTargetType: Option[SIRType] = ...)(using lctx: LoweringContext): LoweredValue

Generate a case expression on a list value (PlutusV4 feature).

Generate a case expression on a list value (PlutusV4 feature).

In PlutusV4, Case can be used directly on list constants: Case(list, [consBranch, nilBranch]) where Cons = index 0 (receives head and tail as arguments) and Nil = index 1 (no arguments).

Value parameters

consBranch

the branch to execute for non-empty list (Cons)

consHead

variable for the head element in cons branch

consTail

variable for the tail list in cons branch

inPos

source position

nilBranch

the branch to execute for empty list (Nil)

optTargetType

optional target type for the result

scrutinee

the list value to match on

Attributes

Create a Case on Pair for PlutusV4+.

Create a Case on Pair for PlutusV4+.

Value parameters

body

the body expression using fstVar and sndVar

fstVar

variable to bind to the first element

inPos

source position

scrutinee

the pair to match on

sndVar

variable to bind to the second element

Attributes

def lvCast(expr: LoweredValue, targetType: SIRType, inPos: SIRPosition)(using lctx: LoweringContext): LoweredValue
def lvDelay(value: LoweredValue, inPos: SIRPosition)(using lctx: LoweringContext): LoweredValue
def lvForce(value: LoweredValue, inPos: SIRPosition)(using lctx: LoweringContext): LoweredValue
def lvIfThenElse(cond: LoweredValue, thenBranch: LoweredValue, elseBranch: LoweredValue, inPos: SIRPosition, optTargetType: Option[SIRType] = ...)(using lctx: LoweringContext): LoweredValue
def lvIntConstant(value: Int, pos: SIRPosition)(using lctx: LoweringContext): ConstantLoweredValue
def lvLamAbs(name: String, tp: SIRType, inputRepresentation: LoweredValueRepresentation, f: IdentifiableLoweredValue => LoweringContext ?=> LoweredValue, inPos: SIRPosition)(using lctx: LoweringContext): LoweredValue

create let and add it to the current scope.

create let and add it to the current scope.

Attributes

def lvStringConstant(value: String, pos: SIRPosition)(using lctx: LoweringContext): ConstantLoweredValue
def lvTrace(message: String, value: LoweredValue)(using LoweringContext): LoweredValue