More ReasonLIGO pretty printer improvements.

This commit is contained in:
Sander Spies 2020-06-05 16:01:18 +02:00
parent db0fdf4abd
commit 63086db0f1
4 changed files with 36 additions and 32 deletions

View File

@ -46,8 +46,11 @@ and pp_let_binding let_ (binding : let_binding) =
| Some (_,e) ->
patterns ^^ group (break 0 ^^ string ": " ^^ pp_type_expr e ^^ string " = ")
in
let rhs = pp_expr let_rhs
in prefix 2 0 lhs rhs
let rhs = pp_expr let_rhs in
match let_rhs with
| ESeq _
| ERecord _ -> lhs ^^ rhs
| _ -> prefix 2 0 lhs rhs
and pp_pattern = function
PConstr p -> pp_pconstr p

View File

@ -2,11 +2,10 @@ type storage = (int, int);
let main =
(n: (int, storage)): (list(operation), storage) => {
let x: (int, int) =
{
let x: int = 7;
(x + n[0], n[1][0] + n[1][1])
};
let x: (int, int) = {
let x: int = 7;
(x + n[0], n[1][0] + n[1][1])
};
([] : list(operation), x)
};

View File

@ -12,7 +12,10 @@ type sum_aggregator = {counter: int, sum: int };
let counter =
(n: int): int => {
let initial: sum_aggregator = {counter: 0, sum: 0 };
let initial: sum_aggregator = {
counter: 0,
sum: 0
};
let rec aggregate =
(prev: sum_aggregator): int =>
if(prev.counter <= n) {
@ -40,7 +43,10 @@ let rec aux_nest =
let counter_nest =
(n: int): int => {
let initial: sum_aggregator = {counter: 0, sum: 0 };
let initial: sum_aggregator = {
counter: 0,
sum: 0
};
let out: sum_aggregator = aux_nest(initial);
out.sum
};

View File

@ -18,11 +18,10 @@ let i = (a: int, b: int) => a + b;
let j = (a: int, b: int) => a - b;
let m =
{
let z = 3;
z
};
let m = {
let z = 3;
z
};
let n = (a: int): int => a + 1;
@ -32,28 +31,25 @@ let n = (a: int, b: int): int => a + 1;
let o = (a: int, b: int): int => a + 1;
let p =
let p = {
{
{
3
}
};
3
}
};
let q =
{
f: 3,
g: 6,
h: {i: "bla", j: 1 + 2, k: {l: 1, z: 2 } }
};
let q = {
f: 3,
g: 6,
h: {i: "bla", j: 1 + 2, k: {l: 1, z: 2 } }
};
let s =
let s = {
let a = 2;
{
let a = 2;
{
z: a,
a: a
}
};
z: a,
a: a
}
};
let t = (((((((2)))))));