Less dippy application

This commit is contained in:
Tom Jack 2020-01-11 19:37:38 -06:00 committed by Pierre-Emmanuel Wulfman
parent 8e34c4a678
commit 0895467f74
2 changed files with 11 additions and 7 deletions

View File

@ -10,10 +10,10 @@ let%expect_test _ =
[%expect {| 1874 bytes |}] ; [%expect {| 1874 bytes |}] ;
run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ; run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ;
[%expect {| 1163 bytes |}] ; [%expect {| 1169 bytes |}] ;
run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ; run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ;
[%expect {| 2867 bytes |}] ; [%expect {| 2862 bytes |}] ;
run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ; run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ;
[%expect {| 617 bytes |}] ; [%expect {| 617 bytes |}] ;
@ -431,9 +431,10 @@ let%expect_test _ =
DIP { DUP } ; DIP { DUP } ;
SWAP ; SWAP ;
DIP { DROP 4 } } ; DIP { DROP 4 } } ;
DIP { DUP } ;
SWAP ;
UNIT ; UNIT ;
DIP 2 { DUP } ;
DIG 2 ;
SWAP ;
EXEC ; EXEC ;
DIP { DUP } ; DIP { DUP } ;
PAIR ; PAIR ;
@ -621,7 +622,9 @@ let%expect_test _ =
CDR ; CDR ;
CAR ; CAR ;
CDR ; CDR ;
DIP { DIP 12 { DUP } ; DIG 12 } ; DIP 13 { DUP } ;
DIG 13 ;
SWAP ;
EXEC ; EXEC ;
DIP { DUP } ; DIP { DUP } ;
SWAP ; SWAP ;

View File

@ -251,11 +251,12 @@ and translate_expression (expr:expression) (env:environment) : michelson result
) )
| E_application (f , arg) -> ( | E_application (f , arg) -> (
trace (simple_error "Compiling quote application") @@ trace (simple_error "Compiling quote application") @@
let%bind f = translate_expression f env in let%bind f = translate_expression f (Environment.add (Var.fresh (), arg.type_value) env) in
let%bind arg = translate_expression arg env in let%bind arg = translate_expression arg env in
return @@ seq [ return @@ seq [
arg ; arg ;
dip f ; f ;
i_swap ;
prim I_EXEC ; prim I_EXEC ;
] ]
) )