diff options
author | Hans Bolinder <[email protected]> | 2015-05-08 14:01:31 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2015-05-08 14:01:31 +0200 |
commit | 84a8b5d5634dda37a7233d5aa79f185ab8a30aa9 (patch) | |
tree | 95dab65dbb0a5c5aadf1b0507735d278ab4487d6 /lib | |
parent | 71b16c9b704374ea78de05943883befd49846a22 (diff) | |
parent | fd8d054c22a5ee81015d5e0add297ba7144a0840 (diff) | |
download | otp-84a8b5d5634dda37a7233d5aa79f185ab8a30aa9.tar.gz otp-84a8b5d5634dda37a7233d5aa79f185ab8a30aa9.tar.bz2 otp-84a8b5d5634dda37a7233d5aa79f185ab8a30aa9.zip |
Merge branch 'hb/typer/erl_anno_fix'
* hb/typer/erl_anno_fix:
typer: Properly extract annotations
Diffstat (limited to 'lib')
-rw-r--r-- | lib/typer/src/typer.erl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl index cbad05081e..f8070e04c1 100644 --- a/lib/typer/src/typer.erl +++ b/lib/typer/src/typer.erl @@ -2,7 +2,7 @@ %%----------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2014. All Rights Reserved. +%% Copyright Ericsson AB 2006-2015. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -931,7 +931,9 @@ analyze_one_function({Var, FunBody} = Function, Acc) -> A = cerl:fname_arity(Var), TmpDialyzerObj = {{Acc#tmpAcc.module, F, A}, Function}, NewDialyzerObj = Acc#tmpAcc.dialyzerObj ++ [TmpDialyzerObj], - [_, LineNo, {file, FileName}] = cerl:get_ann(FunBody), + Anno = cerl:get_ann(FunBody), + LineNo = get_line(Anno), + FileName = get_file(Anno), BaseName = filename:basename(FileName), FuncInfo = {LineNo, F, A}, OriginalName = Acc#tmpAcc.file, @@ -951,6 +953,14 @@ analyze_one_function({Var, FunBody} = Function, Acc) -> incFuncAcc = IncFuncAcc, dialyzerObj = NewDialyzerObj}. +get_line([Line|_]) when is_integer(Line) -> Line; +get_line([_|T]) -> get_line(T); +get_line([]) -> none. + +get_file([{file,File}|_]) -> File; +get_file([_|T]) -> get_file(T); +get_file([]) -> "no_file". % should not happen + -spec get_dialyzer_plt(analysis()) -> plt(). get_dialyzer_plt(#analysis{plt = PltFile0}) -> |