Add line to fann()
This commit is contained in:
parent
5ef52c0dc3
commit
354e49c5d3
@ -58,7 +58,7 @@
|
|||||||
| {contract_code, string()} %% for CREATE, by name
|
| {contract_code, string()} %% for CREATE, by name
|
||||||
| {typerep, ftype()}.
|
| {typerep, ftype()}.
|
||||||
|
|
||||||
-type fann() :: [ {line, aeso_syntax:ann_line()} ].
|
-type fann() :: [ {line, aeso_syntax:ann_line()} | {col, aeso_syntax:ann_col()} ].
|
||||||
|
|
||||||
-type fexpr() :: {lit, fann(), flit()}
|
-type fexpr() :: {lit, fann(), flit()}
|
||||||
| {nil, fann()}
|
| {nil, fann()}
|
||||||
@ -389,7 +389,7 @@ to_fcode(Env, [{namespace, _, {con, _, Con}, Decls} | Code]) ->
|
|||||||
|
|
||||||
-spec to_fann(aeso_syntax:ann()) -> fann().
|
-spec to_fann(aeso_syntax:ann()) -> fann().
|
||||||
to_fann(Ann) ->
|
to_fann(Ann) ->
|
||||||
proplists:lookup_all(line, Ann).
|
proplists:lookup_all(line, Ann) ++ proplists:lookup_all(col, Ann).
|
||||||
|
|
||||||
-spec get_fann(fexpr()) -> fann().
|
-spec get_fann(fexpr()) -> fann().
|
||||||
get_fann(FExpr) -> element(2, FExpr).
|
get_fann(FExpr) -> element(2, FExpr).
|
||||||
|
@ -106,24 +106,24 @@ compile1(ChildContracts, FCode, SavedFreshNames, Options) ->
|
|||||||
{FateCode2, get_variables_registers(), DbglocMap}.
|
{FateCode2, get_variables_registers(), DbglocMap}.
|
||||||
|
|
||||||
-spec block_dbgloc_map(bcode()) -> DbglocMap when
|
-spec block_dbgloc_map(bcode()) -> DbglocMap when
|
||||||
DbglocMap :: #{integer() => integer()}.
|
DbglocMap :: #{integer() => {integer(), integer()}}.
|
||||||
block_dbgloc_map(BB) -> block_dbgloc_map(BB, 0, maps:new()).
|
block_dbgloc_map(BB) -> block_dbgloc_map(BB, 0, maps:new()).
|
||||||
|
|
||||||
-spec block_dbgloc_map(bcode(), integer(), DbglocMap) -> DbglocMap when
|
-spec block_dbgloc_map(bcode(), integer(), DbglocMap) -> DbglocMap when
|
||||||
DbglocMap :: #{integer() => integer()}.
|
DbglocMap :: #{integer() => {integer(), integer()}}.
|
||||||
block_dbgloc_map([], _, DbglocMap) ->
|
block_dbgloc_map([], _, DbglocMap) ->
|
||||||
DbglocMap;
|
DbglocMap;
|
||||||
block_dbgloc_map([{'DBGLOC', Line} | Rest], Index, DbglocMap) ->
|
block_dbgloc_map([{'DBGLOC', Line, Col} | Rest], Index, DbglocMap) ->
|
||||||
block_dbgloc_map(Rest, Index, maps:put(Index, Line, DbglocMap));
|
block_dbgloc_map(Rest, Index, maps:put(Index, {Line, Col}, DbglocMap));
|
||||||
block_dbgloc_map([_ | Rest], Index, DbglocMap) ->
|
block_dbgloc_map([_ | Rest], Index, DbglocMap) ->
|
||||||
block_dbgloc_map(Rest, Index + 1, DbglocMap).
|
block_dbgloc_map(Rest, Index + 1, DbglocMap).
|
||||||
|
|
||||||
-spec remove_dbgloc(aeb_fate_code:fcode()) -> {aeb_fate_code:fcode(), DbglocMap} when
|
-spec remove_dbgloc(aeb_fate_code:fcode()) -> {aeb_fate_code:fcode(), DbglocMap} when
|
||||||
DbglocMap :: #{integer() => integer()}.
|
DbglocMap :: #{integer() => {integer(), integer()}}.
|
||||||
remove_dbgloc(FateCode) ->
|
remove_dbgloc(FateCode) ->
|
||||||
RemoveDbglocFromBBs =
|
RemoveDbglocFromBBs =
|
||||||
fun(_, BB) ->
|
fun(_, BB) ->
|
||||||
IsDbg = fun({'DBGLOC', _}) -> false;
|
IsDbg = fun({'DBGLOC', _, _}) -> false;
|
||||||
(_) -> true
|
(_) -> true
|
||||||
end,
|
end,
|
||||||
lists:filter(IsDbg, BB)
|
lists:filter(IsDbg, BB)
|
||||||
@ -806,9 +806,12 @@ dbgloc(Env, Ann) ->
|
|||||||
case proplists:get_value(debug_info, Env#env.options, false) of
|
case proplists:get_value(debug_info, Env#env.options, false) of
|
||||||
false -> [];
|
false -> [];
|
||||||
true ->
|
true ->
|
||||||
case proplists:get_value(line, Ann) of
|
Line = proplists:get_value(line, Ann),
|
||||||
undefined -> [];
|
Col = proplists:get_value(col, Ann),
|
||||||
Line -> [{'DBGLOC', Line}]
|
case {Line, Col} of
|
||||||
|
{undefined, _} -> [];
|
||||||
|
{_, undefined} -> [];
|
||||||
|
{Line, Col} -> [{'DBGLOC', Line, Col}]
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -947,7 +950,7 @@ attributes(I) ->
|
|||||||
loop -> Impure(pc, []);
|
loop -> Impure(pc, []);
|
||||||
switch_body -> Pure(none, []);
|
switch_body -> Pure(none, []);
|
||||||
'RETURN' -> Impure(pc, []);
|
'RETURN' -> Impure(pc, []);
|
||||||
{'DBGLOC', _} -> Impure(pc, []);
|
{'DBGLOC', _, _} -> Impure(pc, []);
|
||||||
{'RETURNR', A} -> Impure(pc, A);
|
{'RETURNR', A} -> Impure(pc, A);
|
||||||
{'CALL', A} -> Impure(?a, [A]);
|
{'CALL', A} -> Impure(?a, [A]);
|
||||||
{'CALL_R', A, _, B, C, D} -> Impure(?a, [A, B, C, D]);
|
{'CALL_R', A, _, B, C, D} -> Impure(?a, [A, B, C, D]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user