Fix type specs

This commit is contained in:
Ulf Norell 2019-11-19 11:24:54 +01:00
parent d3f5d7f5c5
commit 7d8a773d6a

View File

@ -19,7 +19,9 @@
-type scode() :: [sinstr()]. -type scode() :: [sinstr()].
-type sinstr() :: {switch, arg(), stype(), [maybe_scode()], maybe_scode()} %% last arg is catch-all -type sinstr() :: {switch, arg(), stype(), [maybe_scode()], maybe_scode()} %% last arg is catch-all
| tuple(). %% FATE instruction | switch_body
| loop
| tuple() | atom(). %% FATE instruction
-type arg() :: tuple(). %% Not exported: aeb_fate_ops:fate_arg(). -type arg() :: tuple(). %% Not exported: aeb_fate_ops:fate_arg().
@ -60,6 +62,10 @@ debug(Tag, Options, Fun) ->
false -> ok false -> ok
end. end.
-dialyzer({nowarn_function, [code_error/1]}).
code_error(Err) ->
aeso_errors:throw(aeso_code_errors:format(Err)).
%% -- Main ------------------------------------------------------------------- %% -- Main -------------------------------------------------------------------
%% @doc Main entry point. %% @doc Main entry point.
@ -152,8 +158,6 @@ bind_local(Name, Env) ->
notail(Env) -> Env#env{ tailpos = false }. notail(Env) -> Env#env{ tailpos = false }.
code_error(Err) -> error(Err).
lookup_var(#env{vars = Vars}, X) -> lookup_var(#env{vars = Vars}, X) ->
case lists:keyfind(X, 1, Vars) of case lists:keyfind(X, 1, Vars) of
{_, Var} -> Var; {_, Var} -> Var;
@ -657,7 +661,7 @@ annotate_code(Fuel, LiveTop, Code) ->
case LiveIn == LiveTop of case LiveIn == LiveTop of
true -> Code1; true -> Code1;
false when Fuel =< 0 -> false when Fuel =< 0 ->
aeso_errors:throw(aeso_code_errors:format(liveness_analysis_out_of_fuel)); code_error(liveness_analysis_out_of_fuel);
false -> annotate_code(Fuel - 1, LiveIn, Code) false -> annotate_code(Fuel - 1, LiveIn, Code)
end. end.
@ -919,7 +923,7 @@ simpl_top(I, Code, Options) ->
simpl_top(?SIMPL_FUEL, I, Code, Options). simpl_top(?SIMPL_FUEL, I, Code, Options).
simpl_top(0, I, Code, _Options) -> simpl_top(0, I, Code, _Options) ->
error({out_of_fuel, I, Code}); code_error({optimizer_out_of_fuel, I, Code});
simpl_top(Fuel, I, Code, Options) -> simpl_top(Fuel, I, Code, Options) ->
apply_rules(Fuel, rules(), I, Code, Options). apply_rules(Fuel, rules(), I, Code, Options).