neo_solidity/ir/statements/assignments/
inc_dec.rs1fn lower_post_inc_dec(
2 expr: &Expression,
3 ctx: &mut LoweringContext,
4 instructions: &mut Vec<Instruction>,
5 increment: bool,
6) -> bool {
7 if !lower_expression(expr, ctx, instructions) {
14 return false;
15 }
16
17 let one = Expression::NumberLiteral(Default::default(), "1".to_string(), "".to_string(), None);
20 let op = if increment {
21 BinaryOperator::Add
22 } else {
23 BinaryOperator::Sub
24 };
25
26 if !lower_compound_assignment(expr, &one, ctx, instructions, op) {
27 return false;
28 }
29
30 instructions.push(Instruction::Drop(ValueType::Any));
33
34 true
37}
38
39fn lower_pre_inc_dec(
40 expr: &Expression,
41 ctx: &mut LoweringContext,
42 instructions: &mut Vec<Instruction>,
43 increment: bool,
44) -> bool {
45 let one = Expression::NumberLiteral(Default::default(), "1".to_string(), "".to_string(), None);
46 let op = if increment {
47 BinaryOperator::Add
48 } else {
49 BinaryOperator::Sub
50 };
51
52 if !lower_compound_assignment(expr, &one, ctx, instructions, op) {
53 return false;
54 }
55
56 true
58}