neo_solidity/ir/expressions/dispatch/
primary.rs1fn try_lower_expression_primary(
2 expr: &Expression,
3 ctx: &mut LoweringContext,
4 instructions: &mut Vec<Instruction>,
5) -> Option<bool> {
6 match expr {
7 Expression::Variable(identifier) => Some(lower_variable_expression(identifier, ctx, instructions)),
8 Expression::ArraySubscript(_, _, None) => {
9 instructions.push(Instruction::PushLiteral(LiteralValue::ByteArray(Vec::new())));
10 Some(true)
11 }
12 Expression::ArraySubscript(_, array, Some(index)) => Some(
13 lower_array_subscript_expression(expr, array.as_ref(), index.as_ref(), ctx, instructions),
14 ),
15 Expression::ArraySlice(_, array, start, end) => {
16 Some(lower_array_slice_expression(
17 array.as_ref(),
18 start.as_deref(),
19 end.as_deref(),
20 ctx,
21 instructions,
22 ))
23 }
24 Expression::ArrayLiteral(_, elements) => {
25 Some(lower_array_literal_expression(elements, ctx, instructions))
26 }
27 Expression::Or(_, left, right) => Some(lower_logical_or(left, right, ctx, instructions)),
28 Expression::And(_, left, right) => Some(lower_logical_and(left, right, ctx, instructions)),
29 _ => None,
30 }
31}