From a612e99fb5aaa934fe5a8591db0f083d7fa0b20a Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Fri, 5 Feb 2010 16:43:30 +0100 Subject: compiler: keep line numbers for attributes In the future, we might want to generate warnings for attributes, referring to them with line numbers. sys_pre_expand used to replace line number for attributes with 0. Change sys_pre_expand to retain the real line number. v3_core used to throw away the line numbers. Change v3_core so that it retains the line numbers in annotations. While at it, do some tidying as suggested by tidier. --- lib/compiler/src/v3_core.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/compiler/src/v3_core.erl') diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl index a39a3c538f..746fce7578 100644 --- a/lib/compiler/src/v3_core.erl +++ b/lib/compiler/src/v3_core.erl @@ -164,8 +164,8 @@ form({attribute,_,file,{File,_Line}}, {Fs,As,Es,Ws,_}, _Opts) -> form({attribute,_,_,_}=F, {Fs,As,Es,Ws,File}, _Opts) -> {Fs,[attribute(F)|As],Es,Ws,File}. -attribute({attribute,_,Name,Val}) -> - {#c_literal{val=Name},#c_literal{val=Val}}. +attribute({attribute,Line,Name,Val}) -> + {#c_literal{val=Name, anno=[Line]}, #c_literal{val=Val, anno=[Line]}}. function({function,_,Name,Arity,Cs0}, Es0, Ws0, File, Opts) -> %%ok = io:fwrite("~p - ", [{Name,Arity}]), -- cgit v1.2.3