[erlang-patches] [PATCH] Add options -pa Dir and -pz Dir to TypEr

Henrik Nord henrik@REDACTED
Mon Mar 21 11:57:53 CET 2011


On 03/20/2011 05:14 PM, Tomas Abrahamsson wrote:
> Setting code path options is useful e.g. when analyzing programs that
> use parse transforms.
> ---
>   lib/typer/src/typer.erl |   14 +++++++++++++-
>   1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl
> index fc8caa4..424472f 100644
> --- a/lib/typer/src/typer.erl
> +++ b/lib/typer/src/typer.erl
> @@ -628,6 +628,8 @@ cl(["-T"|Opts]) ->
>   cl(["-r"|Opts]) ->
>     {Files, RestOpts} = dialyzer_cl_parse:collect_args(Opts),
>     {{files_r, Files}, RestOpts};
> +cl(["-pa",Dir|Opts]) ->  {{pa,Dir}, Opts};
> +cl(["-pz",Dir|Opts]) ->  {{pz,Dir}, Opts};
>   cl(["-"++H|_]) ->  fatal_error("unknown option -"++H);
>   cl(Opts) ->
>     {Files, RestOpts} = dialyzer_cl_parse:collect_args(Opts),
> @@ -672,7 +674,13 @@ analyze_result({plt, Plt}, Args, Analysis) ->
>   analyze_result(show_succ, Args, Analysis) ->
>     {Args, Analysis#analysis{show_succ = true}};
>   analyze_result(no_spec, Args, Analysis) ->
> -  {Args, Analysis#analysis{no_spec = true}}.
> +  {Args, Analysis#analysis{no_spec = true}};
> +analyze_result({pa, Dir}, Args, Analysis) ->
> +  code:add_patha(Dir),
> +  {Args, Analysis};
> +analyze_result({pz, Dir}, Args, Analysis) ->
> +  code:add_pathz(Dir),
> +  {Args, Analysis}.
>
>   %%--------------------------------------------------------------------
>   %% File processing.
> @@ -1039,6 +1047,10 @@ help_message() ->
>      -I include_dir
>          pass the include_dir to TypEr
>          (The syntax of includes is the same as that used by \"erlc\".)
> +   -pa dir
> +   -pz dir
> +       Set code path options to TypEr
> +       (This is useful for files that use parse tranforms.)
>      --version (or -v)
>          prints the Typer version and exits
>      --help (or -h)
>    
Hi

Patch included in 'pu'

Thanks

/Henrik Nord, Erlang/OTP


More information about the erlang-patches mailing list