Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function max(x y:i32):i32{
- if ( x > y ){
- return x;
- }else{
- return y;
- }
- }
- function max(x y:i32):i32 = (compiler, body) => {
- let if_block = compiler.insert_if_stmt(body);
- let block1 = if_block.add_branch(
- compiler.create_int_cmp_i32(
- compiler.find_param("x"),
- compiler.find_param("y")
- )
- );
- compiler.insert_return(block1, compiler.find_param("x"));
- let block2 = if_block.add_else_branch();
- compiler.insert_return(block2, compiler.find_param("y"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement