Closed
Description
The following Fe expressions should be mapped to Yul, like so:
Fe | Yul |
---|---|
a + b |
add(a', b') |
a - b |
sub(a', b') |
a * b |
mul(a', b') |
a / b |
div(a', b') |
Where a and b are vyp::Expr
s and a' and b' are yul::Expression
s.
todo:
- call a new function
expr_bin_operation
here that returns anExtExpression
. - add a match statement to
expr_bin_operation
that matches theAdd
,Sub
,Mult
, andDiv
operations and calls more new functionsexpr_add
,expr_sub
,expr_mult
, andexpr_div
. (mark all other branches as unimplemented) - match both the left and right
ExtExpression
types (i.e.(Base::U256, Base::U256)
) in each of theexpr_
functions and return a new ExtExpression of typeU256
with an expression containing the correct arithmetic function. - add a test contract with a function that takes two params, adds them together, and returns the result.
Note: the Base::U256
enum value should contain a U256
struct with arithmetic functions attached to it. However, this is not necessary at the moment.
Fits into #21.