aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-05-08 12:28:25 +0200
committerHans Bolinder <[email protected]>2015-05-08 14:00:37 +0200
commitfd8d054c22a5ee81015d5e0add297ba7144a0840 (patch)
tree95dab65dbb0a5c5aadf1b0507735d278ab4487d6 /lib
parent71b16c9b704374ea78de05943883befd49846a22 (diff)
downloadotp-fd8d054c22a5ee81015d5e0add297ba7144a0840.tar.gz
otp-fd8d054c22a5ee81015d5e0add297ba7144a0840.tar.bz2
otp-fd8d054c22a5ee81015d5e0add297ba7144a0840.zip
typer: Properly extract annotations
The addition of the erl_anno module, OTP-12195, also modified v3_core so that functions with line number zero are regarded as compiler generated.
Diffstat (limited to 'lib')
-rw-r--r--lib/typer/src/typer.erl14
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}) ->