Get rid of unit in AST
This commit is contained in:
parent
272c247b4d
commit
88139fe99c
@ -938,8 +938,6 @@ infer_expr(Env, Id = {Tag, As, _}) when Tag == id; Tag == qid ->
|
||||
infer_expr(Env, Id = {Tag, As, _}) when Tag == con; Tag == qcon ->
|
||||
{QName, Type} = lookup_name(Env, As, Id, [freshen]),
|
||||
{typed, As, QName, Type};
|
||||
infer_expr(Env, {unit, As}) ->
|
||||
infer_expr(Env, {tuple, As, []});
|
||||
infer_expr(Env, {tuple, As, Cpts}) ->
|
||||
NewCpts = [infer_expr(Env, C) || C <- Cpts],
|
||||
CptTypes = [T || {typed, _, _, T} <- NewCpts],
|
||||
|
@ -441,7 +441,7 @@ build_if(Ann, Cond, Then, [{elif, Ann1, Cond1, Then1} | Elses]) ->
|
||||
build_if(Ann, Cond, Then, [{else, _Ann, Else}]) ->
|
||||
{'if', Ann, Cond, Then, Else};
|
||||
build_if(Ann, Cond, Then, []) ->
|
||||
{'if', Ann, Cond, Then, {unit, [{origin, system}]}}.
|
||||
{'if', Ann, Cond, Then, {tuple, [{origin, system}], []}}.
|
||||
|
||||
else_branches([Elif = {elif, _, _, _} | Stmts], Acc) ->
|
||||
else_branches(Stmts, [Elif | Acc]);
|
||||
@ -457,7 +457,6 @@ fun_t(Domains, Type) ->
|
||||
lists:foldr(fun({Dom, Ann}, T) -> {fun_t, Ann, [], Dom, T} end,
|
||||
Type, Domains).
|
||||
|
||||
tuple_e(Ann, []) -> {unit, Ann};
|
||||
tuple_e(_Ann, [Expr]) -> Expr; %% Not a tuple
|
||||
tuple_e(Ann, Exprs) -> {tuple, Ann, Exprs}.
|
||||
|
||||
@ -478,7 +477,6 @@ parse_pattern({record, Ann, Fs}) ->
|
||||
{record, Ann, lists:map(fun parse_field_pattern/1, Fs)};
|
||||
parse_pattern(E = {con, _, _}) -> E;
|
||||
parse_pattern(E = {id, _, _}) -> E;
|
||||
parse_pattern(E = {unit, _}) -> E;
|
||||
parse_pattern(E = {int, _, _}) -> E;
|
||||
parse_pattern(E = {bool, _, _}) -> E;
|
||||
parse_pattern(E = {bytes, _, _}) -> E;
|
||||
|
@ -332,7 +332,6 @@ expr_p(_, {Type, _, Bin})
|
||||
Type == oracle_pubkey;
|
||||
Type == oracle_query_id ->
|
||||
text(binary_to_list(aeser_api_encoder:encode(Type, Bin)));
|
||||
expr_p(_, {unit, _}) -> text("()");
|
||||
expr_p(_, {string, _, S}) -> term(binary_to_list(S));
|
||||
expr_p(_, {char, _, C}) ->
|
||||
case C of
|
||||
|
@ -75,7 +75,6 @@
|
||||
| {contract_pubkey, binary()}
|
||||
| {oracle_pubkey, binary()}
|
||||
| {oracle_query_id, binary()}
|
||||
| {unit, ann()}
|
||||
| {string, ann(), binary()}
|
||||
| {char, ann(), integer()}.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user