aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen/wx_gen.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-02-17 11:13:42 +0000
committerErlang/OTP <[email protected]>2010-02-17 11:13:42 +0000
commit40b76c2e854c9771f8699fd143299ad2d6de4603 (patch)
tree0785b7428656150c1ee6d19345dee941355ab4f6 /lib/wx/api_gen/wx_gen.erl
parent4a33e37e8c1b4f60a6890dccae438cd8fbbb05ef (diff)
parenta8bf1fe3b9f5f69354403231a3c47489d9015977 (diff)
downloadotp-40b76c2e854c9771f8699fd143299ad2d6de4603.tar.gz
otp-40b76c2e854c9771f8699fd143299ad2d6de4603.tar.bz2
otp-40b76c2e854c9771f8699fd143299ad2d6de4603.zip
Merge branch 'ks/cleanups' into ccase/r13b04_dev
* ks/cleanups: percept: Clean up as suggested by tidier percept: Modernize types and specs parsetools: Don't use 'try...of' when 'try' will do parsetools: Use %% for comments at the beginning of a line parsetools: Replace lists:keysearch/3 with lists:keyfind/3 parsetools: Modernize types and specs parsetools: Replace TABs with spaces runtime_tools: Modernize specs sasl: Eliminate tuple used as fun sasl: Add missing modules to app file asn1: Clean up as suggested by tidier os_mon: Modernize types and specs wx: Clean up as suggested by tidier OTP-8455 ks/cleanups
Diffstat (limited to 'lib/wx/api_gen/wx_gen.erl')
-rw-r--r--lib/wx/api_gen/wx_gen.erl33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl
index 780bb2e741..2ed4476440 100644
--- a/lib/wx/api_gen/wx_gen.erl
+++ b/lib/wx/api_gen/wx_gen.erl
@@ -73,8 +73,7 @@ gen_xml() ->
-record(hs,{alias,skip,fs,fopt,ev,acc,info}).
init_defs(List0) ->
- List1 = to_lists(List0),
- lists:map(fun mangle_info/1, List1).
+ [mangle_info(L) || L <- to_lists(List0)].
mangle_info(E={enum,Type0,SkipStr}) ->
Type = case is_atom(Type0) of true -> atom_to_list(Type0); false -> Type0 end,
@@ -138,9 +137,9 @@ parse_defs([{class,Name,Parent,Info}|Rest], Acc0) ->
Defs0 = load_members(FileName, Name, gb_trees:empty(), Tab, Type, Info),
put(current_class, Name),
- Class0 = #class{name=name(Name,Info),parent=Parent,
+ Class0 = #class{name=name(Name,Info), parent=Parent,
doc=get_value(doc,Info#hs.info,undefined),
- file=FileName,options=Info#hs.info, id=next_id(class_id)},
+ file=FileName, options=Info#hs.info, id=next_id(class_id)},
ParseClass = fun(Member,{Class,Dfs}) ->
parse_class(Member,Tab,Dfs,Class,Info)
end,
@@ -161,12 +160,11 @@ parse_defs([], Acc) -> reverse(Acc).
meta_info(C=#class{name=CName,methods=Ms0}) ->
Ms = lists:append(Ms0),
- HaveConstructor =
- lists:keysearch(constructor, #method.method_type, Ms) =/= false,
+ HaveConstructor = lists:keymember(constructor, #method.method_type, Ms),
case lists:keysearch(destructor, #method.method_type, Ms) of
false when HaveConstructor ->
- Dest = #method{name="destroy",id=next_id(func_id),
- method_type=destructor, params=[this(CName)]},
+ Dest = #method{name = "destroy", id = next_id(func_id),
+ method_type = destructor, params = [this(CName)]},
C#class{methods = [[Dest]|Ms0]};
false ->
C#class{abstract = true};
@@ -451,9 +449,9 @@ find_erl_alias_name(MName,Ps,Fopts) ->
_ ->
Find = fun({all,AliasName},Acc) -> [AliasName|Acc];
({Var,AliasName},Acc) ->
- case lists:keysearch(Var, #param.name, Ps) of
- {value, _} -> [AliasName|Acc];
- _ -> Acc
+ case lists:keymember(Var, #param.name, Ps) of
+ true -> [AliasName|Acc];
+ false -> Acc
end
end,
case lists:foldl(Find, [], Aliases) of
@@ -873,11 +871,14 @@ add_method2(M0=#method{name=Name,params=Ps0,type=T0},#class{name=CName,parent=Pa
end,
M1 = M0#method{defined_in=CName,
min_arity = length(Req),
- max_arity = length(Req) + if length(Opt) > 0 -> 1; true -> 0 end,
+ max_arity = length(Req) + case Opt of
+ [_ | _] -> 1;
+ _ -> 0
+ end,
type = Type,
method_type = IsStatic,
where = Where,
- id=next_id(func_id),
+ id = next_id(func_id),
pre_hook = get_opt(pre_hook, Name, length(Ps), Opts),
post_hook = get_opt(post_hook, Name, length(Ps), Opts),
doc = get_opt(doc, Name, length(Ps), Opts)
@@ -1037,10 +1038,10 @@ types_differ([list|R1], [opt_list|R2]) ->
types_differ([opt_list|R1], [list|R2]) ->
types_differ(R1,R2);
types_differ([C1|R1], [C2|R2]) when is_tuple(C1), is_tuple(C2) ->
- (size(C1) =/= size(C2)) orelse types_differ(R1,R2);
+ (tuple_size(C1) =/= tuple_size(C2)) orelse types_differ(R1,R2);
types_differ([C1|_R1], [_C2|_R2]) when is_tuple(C1) ->
true;
-types_differ([_C1|_R1], [C2|_R2]) when is_tuple(C2)->
+types_differ([_C1|_R1], [C2|_R2]) when is_tuple(C2) ->
true;
types_differ([_C1|R1], [_C2|R2]) -> %% More cases?
types_differ(R1,R2);
@@ -1198,7 +1199,7 @@ name(Name0, #hs{alias=Alias}) ->
Name0;
"esaBrekciP" ++ _ -> %% Arrg uses base
Name0;
- "esaB" ++ Rest when hd(Name0) == $w ->
+ "esaB" ++ Rest when hd(Name0) =:= $w ->
%% Arrg Some decl uses base class directly
reverse(Rest);
_F ->