mirror of
https://github.com/valitydev/parse_trans.git
synced 2024-11-06 08:35:17 +00:00
Merge pull request #6 from nox/let-errors-through
Let error markers through parse_transform:do/5
This commit is contained in:
commit
216531d99f
@ -309,23 +309,19 @@ depth_first(Fun, Acc, Forms, Options) when is_function(Fun, 4) ->
|
||||
do(fun do_depth_first/4, Fun, Acc, Forms, Options).
|
||||
|
||||
do(Transform, Fun, Acc, Forms, Options) ->
|
||||
case [E || {error,_} = E <- Forms] of
|
||||
[_|_] -> {error, []};
|
||||
[] ->
|
||||
Context = initial_context(Forms, Options),
|
||||
File = Context#context.file,
|
||||
try Transform(Fun, Acc, Forms, Context) of
|
||||
{NewForms, _} = Result when is_list(NewForms) ->
|
||||
optionally_pretty_print(NewForms, Options, Context),
|
||||
Result
|
||||
catch
|
||||
error:Reason ->
|
||||
{error,
|
||||
[{File, [{?DUMMY_LINE, ?MODULE,
|
||||
{Reason, erlang:get_stacktrace()}}]}]};
|
||||
throw:{error, Ln, What} ->
|
||||
{error, [{error, {Ln, ?MODULE, What}}]}
|
||||
end
|
||||
Context = initial_context(Forms, Options),
|
||||
File = Context#context.file,
|
||||
try Transform(Fun, Acc, Forms, Context) of
|
||||
{NewForms, _} = Result when is_list(NewForms) ->
|
||||
optionally_pretty_print(NewForms, Options, Context),
|
||||
Result
|
||||
catch
|
||||
error:Reason ->
|
||||
{error,
|
||||
[{File, [{?DUMMY_LINE, ?MODULE,
|
||||
{Reason, erlang:get_stacktrace()}}]}]};
|
||||
throw:{error, Ln, What} ->
|
||||
{error, [{error, {Ln, ?MODULE, What}}]}
|
||||
end.
|
||||
|
||||
-spec top(function(), forms(), list()) ->
|
||||
|
Loading…
Reference in New Issue
Block a user