浏览代码

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 13 年前
提交者 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),

正在加载...
取消
保存