From f4e25971233abdc0fe8872cb8d7b5113d4198a3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 12 Mar 2013 16:45:16 +0100 Subject: 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}. --- lib/asn1/src/asn1ct_value.erl | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/asn1/src/asn1ct_value.erl') diff --git a/lib/asn1/src/asn1ct_value.erl b/lib/asn1/src/asn1ct_value.erl index ce8be773d8..ecdfa3f645 100644 --- a/lib/asn1/src/asn1ct_value.erl +++ b/lib/asn1/src/asn1ct_value.erl @@ -51,8 +51,6 @@ from_type(M,Typename,Type) when is_record(Type,type) -> from_type(Emod,Etype); {_,user} -> from_type(M,InnerType); - {notype,_} -> - true; {primitive,bif} -> from_type_prim(M, Type); 'ASN1_OPEN_TYPE' -> -- cgit v1.2.3