/// Generates operations for evaluating the given expression
/// and storing its result in the given target memory block
/// NOTE: Assumes that the target memory block is **zero**
/// so that it can be mutated
Generates operations for evaluating the given expression
and storing its result in the given target memory block
NOTE: Assumes that the target memory block is **zero
so that it can be mutated
Generates operations for evaluating the given expression and storing its result in the given target memory block NOTE : Assumes that the target memory block is ** zero so that it can be mutated
pub fn into_operations(
    scope: &mut ScopeStack,
    expr: Expression,
    target: Target,
) -> OperationsResult {
    match expr {
        Expression::UnitLiteral => Ok(Vec::new()),
        Expression::Identifier(name) => store_identifier(scope, name, target),
        Expression::Number(value) => store_number(scope, value, target),
        Expression::Call {method, args} => call_with_exprs(scope, *method, args, target),
        Expression::ByteLiteral(ref bytes) => store_byte_literal(scope, bytes, target),
        Expression::Branch {condition, body, otherwise} => {
            branch(scope, *condition, body, otherwise, target)
        },
        _ => unimplemented!(),
    }
}
pub fn into_operations ( scope : & mut ScopeStack , expr : Expression , target : Target , ) -> OperationsResult { match expr { Expression :: UnitLiteral => Ok ( Vec :: new ( ) ) , Expression :: Identifier ( name ) => store_identifier ( scope , name , target ) , Expression :: Number ( value ) => store_number ( scope , value , target ) , Expression :: Call { method , args } => call_with_exprs ( scope , * method , args , target ) , Expression :: ByteLiteral ( ref bytes ) => store_byte_literal ( scope , bytes , target ) , Expression :: Branch { condition , body , otherwise } => { branch ( scope , * condition , body , otherwise , target ) } , _ => unimplemented ! ( ) , } }
Generates operations for evaluating the given expression
and storing its result in the given target memory block
NOTE: Assumes that the target memory block is **zero
so that it can be mutated
Generates operations for evaluating the given expression and storing its result in the given target memory block NOTE : Assumes that the target memory block is ** zero so that it can be mutated
scope
&mut ScopeStack
expr
Expression
target
Target