aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-09-21 17:05:59 +0200
committerDan Gudmundsson <[email protected]>2011-09-21 17:05:59 +0200
commit2a42a90da8497cbec2b2d6e6b39504bc0bffc869 (patch)
treed231f31208f50c45cda949c4321b48421d70345a
parent3ea678d6036f10a6be7a5ae8c8431e067104b32f (diff)
downloadotp-2a42a90da8497cbec2b2d6e6b39504bc0bffc869.tar.gz
otp-2a42a90da8497cbec2b2d6e6b39504bc0bffc869.tar.bz2
otp-2a42a90da8497cbec2b2d6e6b39504bc0bffc869.zip
[wx] Remove optional shadowing clauses
In some cases the non optional clause could make some clauses unreachable. i.e. in the following example the second clause will never be reached. prepend(This,Window) when is_record(This, wx_ref),is_record(Window, wx_ref) -> prepend(This,Window, []); prepend(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ItemT,ref=ItemRef}) -> ?CLASS(ThisT,wxSizer), ?CLASS(ItemT,wxSizerItem), wxe_util:call(?wxSizer_Prepend_1, <<ThisRef:32/?UI,ItemRef:32/?UI>>).
-rw-r--r--lib/wx/api_gen/wx_gen.erl23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl
index b36653c570..209de48496 100644
--- a/lib/wx/api_gen/wx_gen.erl
+++ b/lib/wx/api_gen/wx_gen.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2011. 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
@@ -30,6 +30,12 @@
-compile(export_all).
+-define(DBGCF(Class, Func, Format, Args),
+ case {get(current_class), get(current_func)} of
+ {Class, Func} -> io:format("~p:~p: " ++ Format, [?MODULE,?LINE] ++ Args);
+ _ -> ok
+ end).
+
code() -> safe(fun gen_code/0,true).
xml() -> safe(fun gen_xml/0,true).
@@ -957,17 +963,17 @@ erl_skip_opt(All=[Ms=[{_,{Len,_,_},_}|_]|R],Acc1=[{_,{N,_,_},_}|_], Acc2) ->
end;
erl_skip_opt([],Acc1,Acc2) -> [strip_ti(Acc1)|Acc2].
-erl_skip_opt2([F={_,{N,In,_},M=#method{where=Where}}|Ms],Acc1,Acc2,Check) ->
+erl_skip_opt2([F={_,{N,In,_},M=#method{where=Where}}|Ms],Acc1,Acc2,Check) ->
case N > 0 andalso lists:last(In) =:= opt_list of
- true when Where =/= merged_c, Where =/= taylormade ->
- case Check of
- [] ->
+ true when Where =/= merged_c, Where =/= taylormade ->
+ case Check of
+ [] ->
erl_skip_opt2(Ms,[F|Acc1],[M#method{where=erl_no_opt}|Acc2],[]);
- _ ->
+ _ ->
Skipped = reverse(tl(reverse(In))),
T = fun({_,{_,Args,_},_}) -> true =:= types_differ(Skipped,Args) end,
case lists:all(T, Check) of
- true ->
+ true ->
erl_skip_opt2(Ms,[F|Acc1],
[M#method{where=erl_no_opt}|Acc2],
Check);
@@ -976,7 +982,7 @@ erl_skip_opt2([F={_,{N,In,_},M=#method{where=Where}}|Ms],Acc1,Acc2,Check) ->
end
end;
_ ->
- erl_skip_opt2(Ms,[F|Acc1],Acc2,[])
+ erl_skip_opt2(Ms,[F|Acc1],Acc2,Check)
end;
erl_skip_opt2([],Acc1,Acc2,_) -> {Acc1,Acc2}.
@@ -1025,7 +1031,6 @@ types_differ([{class,C1}|R1], [{class,C2}|R2]) ->
true ->
true;
false ->
-%% _ ->
{class,C1,C2};
{class,C1,C2} ->
{class,C1,C2};