pub enum Expression {
Show 62 variants
IntLiteral {
value: i64,
},
Int64Literal {
value: i64,
},
FloatLiteral {
value: f64,
},
StringLiteral {
value: String,
},
BoolLiteral {
value: bool,
},
Null,
Param {
index: u32,
},
FieldAccess {
object: Box<Expression>,
class_name: String,
field_name: String,
field_type: WasmFieldType,
},
Eq {
left: Box<Expression>,
right: Box<Expression>,
},
Ne {
left: Box<Expression>,
right: Box<Expression>,
},
Lt {
left: Box<Expression>,
right: Box<Expression>,
},
Le {
left: Box<Expression>,
right: Box<Expression>,
},
Gt {
left: Box<Expression>,
right: Box<Expression>,
},
Ge {
left: Box<Expression>,
right: Box<Expression>,
},
Eq64 {
left: Box<Expression>,
right: Box<Expression>,
},
Ne64 {
left: Box<Expression>,
right: Box<Expression>,
},
Lt64 {
left: Box<Expression>,
right: Box<Expression>,
},
Le64 {
left: Box<Expression>,
right: Box<Expression>,
},
Gt64 {
left: Box<Expression>,
right: Box<Expression>,
},
Ge64 {
left: Box<Expression>,
right: Box<Expression>,
},
And {
left: Box<Expression>,
right: Box<Expression>,
},
Or {
left: Box<Expression>,
right: Box<Expression>,
},
Not {
operand: Box<Expression>,
},
IsNull {
operand: Box<Expression>,
},
IsNotNull {
operand: Box<Expression>,
},
IsNull64 {
operand: Box<Expression>,
},
IsNotNull64 {
operand: Box<Expression>,
},
Add {
left: Box<Expression>,
right: Box<Expression>,
},
Sub {
left: Box<Expression>,
right: Box<Expression>,
},
Mul {
left: Box<Expression>,
right: Box<Expression>,
},
Div {
left: Box<Expression>,
right: Box<Expression>,
},
Add64 {
left: Box<Expression>,
right: Box<Expression>,
},
Sub64 {
left: Box<Expression>,
right: Box<Expression>,
},
Mul64 {
left: Box<Expression>,
right: Box<Expression>,
},
Div64 {
left: Box<Expression>,
right: Box<Expression>,
},
FloatAdd {
left: Box<Expression>,
right: Box<Expression>,
},
FloatSub {
left: Box<Expression>,
right: Box<Expression>,
},
FloatMul {
left: Box<Expression>,
right: Box<Expression>,
},
FloatDiv {
left: Box<Expression>,
right: Box<Expression>,
},
Sqrt {
operand: Box<Expression>,
},
FloatAbs {
operand: Box<Expression>,
},
Round {
operand: Box<Expression>,
},
Floor {
operand: Box<Expression>,
},
Ceil {
operand: Box<Expression>,
},
Sin {
operand: Box<Expression>,
},
Cos {
operand: Box<Expression>,
},
Asin {
operand: Box<Expression>,
},
Acos {
operand: Box<Expression>,
},
Atan {
operand: Box<Expression>,
},
Atan2 {
y: Box<Expression>,
x: Box<Expression>,
},
Radians {
operand: Box<Expression>,
},
IntToFloat {
operand: Box<Expression>,
},
FloatToInt {
operand: Box<Expression>,
},
ListContains {
list: Box<Expression>,
element: Box<Expression>,
},
Length {
collection: Box<Expression>,
},
Sum {
collection: Box<Expression>,
item_var_name: String,
item_param_index: u32,
item_class_name: String,
accumulator_expr: Box<Expression>,
},
LastElement {
collection: Box<Expression>,
item_class_name: String,
},
HostCall {
function_name: String,
args: Vec<Expression>,
},
IfThenElse {
condition: Box<Expression>,
then_branch: Box<Expression>,
else_branch: Box<Expression>,
},
IfThenElse64 {
condition: Box<Expression>,
then_branch: Box<Expression>,
else_branch: Box<Expression>,
},
I64ToI32 {
operand: Box<Expression>,
},
I32ToI64 {
operand: Box<Expression>,
},
}Expand description
Rich expression tree for constraint predicates
This enum represents a complete expression language for building constraint predicates. Expressions are serializable (via serde) for use across FFI boundaries.
Variants§
IntLiteral
Integer literal (i64) - compiles to i32 in WASM
Int64Literal
64-bit integer literal - compiles directly to i64 in WASM
FloatLiteral
Float literal (f64)
StringLiteral
String literal
BoolLiteral
Boolean literal
Null
Null value
Param
Access a function parameter by index
FieldAccess
Access a field on an object
Fields
object: Box<Expression>field_type: WasmFieldTypeWASM type of the field for type inference. Defaults to Object for unknown types.
Eq
Equal comparison (==)
Ne
Not equal comparison (!=)
Lt
Less than comparison (<)
Le
Less than or equal comparison (<=)
Gt
Greater than comparison (>)
Ge
Greater than or equal comparison (>=)
Eq64
Equal comparison for i64
Ne64
Not equal comparison for i64
Lt64
Less than comparison for i64
Le64
Less than or equal comparison for i64
Gt64
Greater than comparison for i64
Ge64
Greater than or equal comparison for i64
And
Logical AND (&&)
Or
Logical OR (||)
Not
Logical NOT (!)
Fields
operand: Box<Expression>IsNull
Null check (is null) - for i32 operands
Fields
operand: Box<Expression>IsNotNull
Not-null check (is not null) - for i32 operands
Fields
operand: Box<Expression>IsNull64
Null check (is null) - for i64 operands
Fields
operand: Box<Expression>IsNotNull64
Not-null check (is not null) - for i64 operands
Fields
operand: Box<Expression>Add
Addition (+)
Sub
Subtraction (-)
Mul
Multiplication (*)
Div
Division (/)
Add64
Addition for i64
Sub64
Subtraction for i64
Mul64
Multiplication for i64
Div64
Division for i64
FloatAdd
Float addition (f64)
FloatSub
Float subtraction (f64)
FloatMul
Float multiplication (f64)
FloatDiv
Float division (f64)
Sqrt
Square root (WASM f64.sqrt intrinsic)
Fields
operand: Box<Expression>FloatAbs
Absolute value for floats (WASM f64.abs intrinsic)
Fields
operand: Box<Expression>Round
Round to nearest integer (WASM f64.nearest intrinsic)
Fields
operand: Box<Expression>Floor
Floor (WASM f64.floor intrinsic)
Fields
operand: Box<Expression>Ceil
Ceiling (WASM f64.ceil intrinsic)
Fields
operand: Box<Expression>Sin
Sine (host call)
Fields
operand: Box<Expression>Cos
Cosine (host call)
Fields
operand: Box<Expression>Asin
Arc sine (host call)
Fields
operand: Box<Expression>Acos
Arc cosine (host call)
Fields
operand: Box<Expression>Atan
Arc tangent (host call)
Fields
operand: Box<Expression>Atan2
Arc tangent of y/x (host call)
Radians
Convert degrees to radians
Fields
operand: Box<Expression>IntToFloat
Convert int to float
Fields
operand: Box<Expression>FloatToInt
Convert float to int (truncating)
Fields
operand: Box<Expression>ListContains
Check if a list contains an element
Length
Get the length of a collection
Fields
collection: Box<Expression>Sum
Sum of field values over a collection
LastElement
Access the last element of a collection
HostCall
Call a host-provided function
IfThenElse
If-then-else conditional expression (produces i32)
IfThenElse64
If-then-else conditional expression (produces i64)
I64ToI32
Wrap i64 to i32 (truncate)
Fields
operand: Box<Expression>I32ToI64
Extend i32 to i64 (signed)
Fields
operand: Box<Expression>Implementations§
Source§impl Expression
impl Expression
Sourcepub fn substitute_param(
self,
from_index: u32,
substitute: &Expression,
) -> Expression
pub fn substitute_param( self, from_index: u32, substitute: &Expression, ) -> Expression
Substitute all occurrences of a parameter with a replacement expression.
This is used for method inlining: when inlining obj.method(), we replace
Param(0) (self) with obj, and other parameters with their call arguments.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more