diff options
Diffstat (limited to 'lib/wx')
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 33 | ||||
-rw-r--r-- | lib/wx/examples/demo/demo_html_tagger.erl | 12 |
2 files changed, 23 insertions, 22 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 -> diff --git a/lib/wx/examples/demo/demo_html_tagger.erl b/lib/wx/examples/demo/demo_html_tagger.erl index 9b6d1fd950..243e5d659f 100644 --- a/lib/wx/examples/demo/demo_html_tagger.erl +++ b/lib/wx/examples/demo/demo_html_tagger.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. 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 %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% -module(demo_html_tagger). @@ -462,7 +462,7 @@ fix_remote([H|T]) -> fix_remote([]) -> []. --spec is_keyword(atom()) -> bool(). +-spec is_keyword(atom()) -> boolean(). is_keyword('after' ) -> true; is_keyword('and') -> true; |