neo_solidity/ir/expressions/dispatch/
entry.rs1fn lower_expression(
3 expr: &Expression,
4 ctx: &mut LoweringContext,
5 instructions: &mut Vec<Instruction>,
6) -> bool {
7 if let Some(result) = try_lower_expression_binary_ops(expr, ctx, instructions) {
8 return result;
9 }
10 if let Some(result) = try_lower_expression_assignments(expr, ctx, instructions) {
11 return result;
12 }
13 if let Some(result) = try_lower_expression_unary(expr, ctx, instructions) {
14 return result;
15 }
16 if let Some(result) = try_lower_expression_comparisons(expr, ctx, instructions) {
17 return result;
18 }
19 if let Some(result) = try_lower_expression_primary(expr, ctx, instructions) {
20 return result;
21 }
22 if let Some(result) = try_lower_expression_calls(expr, ctx, instructions) {
23 return result;
24 }
25 if let Some(result) = try_lower_expression_tuple(expr, ctx, instructions) {
26 return result;
27 }
28 if let Some(result) = try_lower_expression_conditional(expr, ctx, instructions) {
29 return result;
30 }
31
32 if let Some(literal) = literal_from_expression(expr) {
33 if has_ether_unit(expr) {
37 ctx.record_error_with_suggestion(
38 "ether units (wei/gwei/ether) are not applicable on Neo N3",
39 "use GAS token with 10^8 decimals (1 GAS = 100_000_000 fractions)",
40 );
41 }
42 instructions.push(Instruction::PushLiteral(literal));
43 true
44 } else {
45 ctx.record_error_with_suggestion(
46 format!("unsupported expression '{:?}'", expr),
47 "Neo N3 supports: int, string, bytes, bool, address, arrays, maps, structs",
48 );
49 false
50 }
51}