diff options
author | Björn Gustavsson <[email protected]> | 2012-01-03 09:15:15 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-03-14 11:04:45 +0100 |
commit | 084b34086f8f2cf6bc7aa0075f82a487d161cc72 (patch) | |
tree | b02ba538816e9b45b705ba5416616e27c346fb0d /lib/compiler | |
parent | cda0f23b62cac146d6afd1467ef96c5d4ad84011 (diff) | |
download | otp-084b34086f8f2cf6bc7aa0075f82a487d161cc72.tar.gz otp-084b34086f8f2cf6bc7aa0075f82a487d161cc72.tar.bz2 otp-084b34086f8f2cf6bc7aa0075f82a487d161cc72.zip |
v3_kernel: Dig out the line number only when generating a warning
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/v3_kernel.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl index 71d48e7b0d..9d1839708f 100644 --- a/lib/compiler/src/v3_kernel.erl +++ b/lib/compiler/src/v3_kernel.erl @@ -909,9 +909,8 @@ match_guard_1([#iclause{anno=A,osub=Osub,guard=G,body=B}|Cs0], Def0, St0) -> true -> %% The true clause body becomes the default. {Kb,Pb,St1} = body(B, Osub, St0), - Line = get_line(A), - St2 = maybe_add_warning(Cs0, Line, St1), - St = maybe_add_warning(Def0, Line, St2), + St2 = maybe_add_warning(Cs0, A, St1), + St = maybe_add_warning(Def0, A, St2), {[],pre_seq(Pb, Kb),St}; false -> {Kg,St1} = guard(G, Osub, St0), @@ -922,15 +921,16 @@ match_guard_1([#iclause{anno=A,osub=Osub,guard=G,body=B}|Cs0], Def0, St0) -> end; match_guard_1([], Def, St) -> {[],Def,St}. -maybe_add_warning([C|_], Line, St) -> - maybe_add_warning(C, Line, St); -maybe_add_warning([], _Line, St) -> St; -maybe_add_warning(fail, _Line, St) -> St; -maybe_add_warning(Ke, MatchLine, St) -> +maybe_add_warning([C|_], MatchAnno, St) -> + maybe_add_warning(C, MatchAnno, St); +maybe_add_warning([], _MatchAnno, St) -> St; +maybe_add_warning(fail, _MatchAnno, St) -> St; +maybe_add_warning(Ke, MatchAnno, St) -> case get_kanno(Ke) of [compiler_generated|_] -> St; Anno -> Line = get_line(Anno), + MatchLine = get_line(MatchAnno), Warn = case MatchLine of none -> nomatch_shadow; _ -> {nomatch_shadow,MatchLine} |