瀏覽代碼

Fix rebar_base_compiler:format_errors/3 for errors in include files

Handle the case where the error didn't occur in the file being
compiled.  That is, if there is an error on line 9 of bar.hrl,
instead of:

/path/to/foo.erl:9: type foo() already defined

print:

/path/to/bar.hrl:9: type foo() already defined
pull/3/head
Magnus Henoch 12 年之前
committed by Tuncer Ayaz
父節點
當前提交
e8169e91e4
共有 1 個檔案被更改,包括 11 行新增9 行删除
  1. +11
    -9
      src/rebar_base_compiler.erl

+ 11
- 9
src/rebar_base_compiler.erl 查看文件

@ -235,15 +235,17 @@ maybe_report(_) ->
report(Messages) ->
lists:foreach(fun(Msg) -> io:format("~s", [Msg]) end, Messages).
format_errors(Config, Source, Extra, Errors) ->
AbsSource = case rebar_utils:processing_base_dir(Config) of
true ->
Source;
false ->
filename:absname(Source)
end,
[[format_error(AbsSource, Extra, Desc) || Desc <- Descs]
|| {_, Descs} <- Errors].
format_errors(Config, _MainSource, Extra, Errors) ->
[begin
AbsSource = case rebar_utils:processing_base_dir(Config) of
true ->
Source;
false ->
filename:absname(Source)
end,
[format_error(AbsSource, Extra, Desc) || Desc <- Descs]
end
|| {Source, Descs} <- Errors].
format_error(AbsSource, Extra, {{Line, Column}, Mod, Desc}) ->
ErrorDesc = Mod:format_error(Desc),

Loading…
取消
儲存