diff --git a/src/aversion.erl b/src/aversion.erl index baa620b..dd973a7 100644 --- a/src/aversion.erl +++ b/src/aversion.erl @@ -26,13 +26,11 @@ -type ast_record() :: term(). -type ast_record_attribute() :: term(). --record(clause, { line_num :: integer(), - args :: list(), +-record(clause, { args :: list(), guards :: list(), body :: list() }). --record(function, { line_num :: integer(), - fn_name :: atom(), +-record(function, { fn_name :: atom(), arity :: integer(), clauses :: [#clause{}] }). @@ -222,8 +220,8 @@ ast_var_name({var,_,Var_name}) -> Var_name. %% Creates a var, which is a variable name in erlang AST -new_ast_var(Ln_num, Var_name) when is_integer(Ln_num), is_atom(Var_name) -> - {var, Ln_num, Var_name}. +new_ast_var(Anno, Var_name) when is_atom(Var_name) -> + {var, erl_anno:location(Anno), Var_name}. %%% ============================================================================ @@ -320,8 +318,8 @@ walk_record_unpack_ast(Rec, Record_var_name, Acc_1) when is_atom(Record_var_name %% ..the record and field name we have keyed against it. Fields = ast_record_fields(Rec), Record_name = ast_record_name(Rec), - Ln_num = element(2,Rec), - Record_var = new_ast_var(Ln_num, Record_var_name), + Anno = element(2,Rec), + Record_var = new_ast_var(Anno, Record_var_name), Acc_2 = lists:foldl( fun(Field, Acc_x) ->