Michelson: reindent interpreter

This commit is contained in:
Milo Davis 2017-12-01 10:39:14 +01:00 committed by Benjamin Canou
parent 82dcd5c179
commit ef29aa2d0a

View File

@ -70,6 +70,11 @@ let rec unparse_stack
| Item (v, rest), Item_t (ty, rest_ty, _) -> | Item (v, rest), Item_t (ty, rest_ty, _) ->
Micheline.strip_locations (unparse_data ty v) :: unparse_stack (rest, rest_ty) Micheline.strip_locations (unparse_data ty v) :: unparse_stack (rest, rest_ty)
let check_qta qta =
if Compare.Int.(qta <= 0)
then fail Quota_exceeded
else return ()
let rec interp let rec interp
: type p r. : type p r.
?log: (Script.location * int * Script.expr list) list ref -> ?log: (Script.location * int * Script.expr list) list ref ->
@ -82,9 +87,7 @@ let rec interp
Contract.origination_nonce -> int -> context -> (b, a) descr -> b stack -> Contract.origination_nonce -> int -> context -> (b, a) descr -> b stack ->
(a stack * int * context * Contract.origination_nonce) tzresult Lwt.t = (a stack * int * context * Contract.origination_nonce) tzresult Lwt.t =
fun origination qta ctxt ({ instr ; loc } as descr) stack -> fun origination qta ctxt ({ instr ; loc } as descr) stack ->
if Compare.Int.(qta <= 0) then check_qta qta >>=? fun () ->
fail Quota_exceeded
else
let logged_return ?(origination = origination) (ret, qta, ctxt) = let logged_return ?(origination = origination) (ret, qta, ctxt) =
match log with match log with
| None -> return (ret, qta, ctxt, origination) | None -> return (ret, qta, ctxt, origination)