| 74 | // subtracting, etc. |
| 75 | impl ExpressionVisitor for ForLoopToRepeatVisitor { |
| 76 | fn visit_expr(&mut self, _expr: Expr) -> Option<Expr> { |
| 77 | todo!(); |
| 78 | // match &expr { |
| 79 | // Expr::ForLoop(ExprForLoop { |
| 80 | // init_block, |
| 81 | // conditional, |
| 82 | // after_block, |
| 83 | // interior_block, |
| 84 | // }) => { |
| 85 | // let start: Option<u128>; |
| 86 | // let iterator_identifier: Option<String>; |
| 87 | // if let Some(first_expr) = (*init_block.exprs).first() { |
| 88 | // if let Expr::DeclareVariable(ExprDeclareVariable { identifier, rhs }) = |
| 89 | // first_expr |
| 90 | // { |
| 91 | // if let Some(Expr::Literal(value)) = rhs.clone().map(|e| *e) { |
| 92 | // start = Some(todo!("Need to get literal value here")); |
| 93 | // iterator_identifier = Some(identifier.to_string()); |
| 94 | // } else { |
| 95 | // return Some(expr); |
| 96 | // } |
| 97 | // } else { |
| 98 | // return Some(expr); |
| 99 | // } |
| 100 | // } else { |
| 101 | // return Some(expr); |
| 102 | // } |
| 103 | // |
| 104 | // if let Some(Expr::Assignment(assignment)) = (*after_block.exprs).first() { |
| 105 | // if *assignment |
| 106 | // == (ExprAssignment { |
| 107 | // typed_identifier: iterator_identifier.clone().unwrap(), |
| 108 | // rhs: Box::new(Expr::FunctionCall(ExprFunctionCall { |
| 109 | // function_name: "add".to_string(), |
| 110 | // exprs: Box::new(vec![ |
| 111 | // Expr::Variable(ExprVariableReference { |
| 112 | // identifier: iterator_identifier.clone().unwrap(), |
| 113 | // }), |
| 114 | // Expr::Literal(todo!("Need to get literal value here")), |
| 115 | // ]), |
| 116 | // })), |
| 117 | // }) |
| 118 | // {} |
| 119 | // } else { |
| 120 | // return Some(expr); |
| 121 | // } |
| 122 | // if let Expr::FunctionCall(ExprFunctionCall { |
| 123 | // function_name, |
| 124 | // exprs, |
| 125 | // }) = &**conditional |
| 126 | // { |
| 127 | // if function_name == "lt" |
| 128 | // && exprs[0] |
| 129 | // == Expr::Variable(ExprVariableReference { |
| 130 | // identifier: iterator_identifier.unwrap(), |
| 131 | // }) |
| 132 | // { |
| 133 | // if let Expr::Literal(value) = exprs[1] { |