diff options
author | Björn Gustavsson <[email protected]> | 2013-03-12 16:45:16 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-05-31 14:52:20 +0200 |
commit | f4e25971233abdc0fe8872cb8d7b5113d4198a3d (patch) | |
tree | a2f1fec4ea1ce32db9787faf88135f4ff3c120ba /lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl | |
parent | 66cc5110814e74d602f6bda65e8388babc3982a3 (diff) | |
download | otp-f4e25971233abdc0fe8872cb8d7b5113d4198a3d.tar.gz otp-f4e25971233abdc0fe8872cb8d7b5113d4198a3d.tar.bz2 otp-f4e25971233abdc0fe8872cb8d7b5113d4198a3d.zip |
Eliminate the {notype,_} return value from asn1ct_gen:type/1
The last clause in asn1ct_gen:type/1 does a catched call to type2/1.
If the type2/1 fails {notype,X} is returned.
Since the body of type2/1 essentially is:
case lists:member(X, [...]) of
true ->
{primitive,bif};
false ->
case lists:member(X, [...]) of
true ->
{constructed,bif};
false ->
{undefined,user}
end
end
there is no way that type2/1 can fail. Therefore, we can eliminate
the catch and put the body of type2/1 into the last clause of
type/1. We can also eliminate the code in the callers of type/1
that match {notype,X}.
Diffstat (limited to 'lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl b/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl index bc8189c2c8..9a55b139b9 100644 --- a/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl +++ b/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl @@ -999,9 +999,7 @@ gen_enc_line(Erules,TopType,Cname,Type,Element,Indent,OptOrMand,Assign,EncObj) {componentrelation,_,_}} -> {_LeadingAttrName,Fun} = EncObj, case RefedFieldName of -%% {notype,T} -> -%% throw({error,{notype,type_from_object,T}}); - {Name,RestFieldNames} when is_atom(Name), Name =/= notype -> + {Name,RestFieldNames} when is_atom(Name) -> case OptOrMand of mandatory -> ok; _ -> @@ -1041,8 +1039,6 @@ gen_enc_line(Erules,TopType,Cname,Type,Element,Indent,OptOrMand,Assign,EncObj) end, ?ASN1CT_GEN_BER:gen_encode_prim(ber,EncType,{asis,Tag}, Element); -%% {notype,_} -> -%% emit(["'enc_",InnerType,"'(",Element,", ",{asis,Tag},")"]); 'ASN1_OPEN_TYPE' -> case Type#type.def of #'ObjectClassFieldType'{} -> %Open Type |