Skip to content

Commit

Permalink
Fixes for mini version and *.size in ocaml generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mebsout committed Jan 23, 2018
1 parent dd5816d commit 94eab5e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 32 deletions.
10 changes: 5 additions & 5 deletions tools/liquidity/env/liquidityEnv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ module Map : sig
val remove : 'key -> ('key, 'value) map -> ('key, 'value) map

val mem : 'key -> ('key, 'value) map -> bool (* NOT TESTED *)
val size : ('key, 'value) map -> int
val size : ('key, 'value) map -> nat

end = struct

Expand Down Expand Up @@ -236,7 +236,7 @@ end = struct
let map = (Obj.magic map : 'value ObjMap.t) in
ObjMap.mem key map

let size map = ObjMap.cardinal (Obj.magic map)
let size map = Int (Z.of_int (ObjMap.cardinal (Obj.magic map)))

end
include Array (* Remove ? *)
Expand All @@ -257,7 +257,7 @@ module Set : sig
val fold : ( 'key * 'acc -> 'acc) -> 'key set -> 'acc -> 'acc
val iter : ( 'key -> unit) -> 'key set -> unit
val map : ('key -> 'res) -> 'key set -> 'res set
val size : 'key set -> int
val size : 'key set -> nat

end = struct

Expand Down Expand Up @@ -325,7 +325,7 @@ end = struct
let set = (Obj.magic set : ObjSet.t) in
ObjSet.iter (fun x -> f x) set

let size set = ObjSet.cardinal (Obj.magic set)
let size set = Int (Z.of_int (ObjSet.cardinal (Obj.magic set)))

end

Expand Down Expand Up @@ -468,7 +468,7 @@ module List : sig
val iter : ('a -> unit) -> 'a list -> unit
val map : ('a -> 'b) -> 'a list -> 'b list
val rev : 'a list -> 'a list
val size : 'a list -> integer
val size : 'a list -> nat

end = struct

Expand Down
20 changes: 0 additions & 20 deletions tools/liquidity/liquidMain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,11 @@ let compile_liquid_file filename =
Printf.eprintf "Constant initial storage generated in %S\n%!" output
| LiquidInit.Init_code (_, pre_init) ->
let mic_init = LiquidToTezos.convert_contract ~expand:true pre_init in
let js = LiquidToTezos.json_of_contract mic_init in
Printf.eprintf "%s\n%!" js;
let s = LiquidToTezos.line_of_contract mic_init in
let output = env.filename ^ ".initializer.tz" in
FileString.write_file output s;
Printf.eprintf "Storage initializer generated in %S\n%!" output
end;
(* Printf.eprintf "ici0\n%!"; *)

(* begin *)
(* let read_tezos_const filename = *)
(* let s = FileString.read_file filename in *)
(* match LiquidFromTezos.const_of_string filename s with *)
(* | Some (c, loc_table) -> c, loc_table *)
(* | _ -> *)
(* Printf.eprintf "Errors parsing in %S\n%!" filename; *)
(* exit 2 *)
(* in *)
(* let filename = filename ^ ".init.tz" in *)
(* Printf.eprintf "ici1\n%!"; *)
(* let c, env = read_tezos_const filename in *)
(* Printf.eprintf "ici\n%!"; *)
(* let c = LiquidFromTezos.convert_const_type env c syntax_ast.storage in *)
(* Printf.eprintf "Input: %s\n%!" (LiquidPrinter.Liquid.string_of_const c); *)
(* end; *)

let output = filename ^ ".tz" in
let c = LiquidToTezos.convert_contract ~expand:false pre_michelson in
Expand Down
2 changes: 1 addition & 1 deletion tools/liquidity/ocaml/liquidOCamlTranslate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let clean_ast =

| { pstr_desc =
Pstr_extension
(({ Asttypes.txt = "entry" },
(({ Asttypes.txt = "entry" | "init" },
PStr [entry]),[])
} ->
mapper.structure_item mapper entry
Expand Down
12 changes: 6 additions & 6 deletions tools/liquidity/without-tezos/liquidToTezos.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ let convert_contract ~expand (c : noloc_michelson contract) =
LiquidEmit.emit_contract ~expand c

let convert_const (c : const) =
failwith "mini version cannot do it"
failwith "mini version cannot convert const"

let json_of_contract (c : michelson_exp contract) =
failwith "mini version cannot do it"
failwith "mini version cannot generate json contract"

let contract_of_json _ =
failwith "mini version cannot do it"
failwith "mini version cannot parse json contract"

let json_of_const _ =
failwith "mini version cannot do it"
failwith "mini version cannot generate json constant"

let const_of_json _ =
failwith "mini version cannot do it"
failwith "mini version cannot parse json constant"

let const_of_ezjson _ =
failwith "mini version cannot do it"
failwith "mini version cannot parse ezjson constant"

let read_tezos_file (_filename : string) =
failwith "mini version cannot decompile"
Expand Down

0 comments on commit 94eab5e

Please sign in to comment.