From 155156563429fbb8535ca35491d8057d78aa272c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 23 May 2014 16:01:51 +0200 Subject: Eliminate the use of #identifier{} outside the tokeniser and parser The only remaining use of #identifier{} in asn1ct_check was in a temporary packaging of a value that would be ultimately be put into #valuedef{}. Therefore we can eliminate that last usage but putting the value directly into a #valuedef{} and we can move the record definition into asn1ct_parser2. --- lib/asn1/src/asn1_records.hrl | 1 - lib/asn1/src/asn1ct_check.erl | 10 +++------- lib/asn1/src/asn1ct_parser2.erl | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/asn1') diff --git a/lib/asn1/src/asn1_records.hrl b/lib/asn1/src/asn1_records.hrl index 2540f0effc..d6cfd4dc02 100644 --- a/lib/asn1/src/asn1_records.hrl +++ b/lib/asn1/src/asn1_records.hrl @@ -45,7 +45,6 @@ -record(pobjectdef,{checked=false,pos,name,args,class,def}). -record(pobjectsetdef,{checked=false,pos,name,args,class,def}). --record(identifier,{pos,val}). -record('Constraint',{'SingleValue'=no,'SizeConstraint'=no,'ValueRange'=no,'PermittedAlphabet'=no, 'ContainedSubtype'=no, 'TypeConstraint'=no,'InnerSubtyping'=no,e=no,'Other'=no}). -record(simpletableattributes,{objectsetname,c_name,c_index,usedclassfield, diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index fe50f1f3b0..c2673e3eba 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -1818,12 +1818,10 @@ convert_to_defaultfield(S,ObjFieldName,[OFS|RestOFS],CField)-> FieldName); ValSetting = #valuedef{} -> ValSetting; - ValSetting = {'CHOICE',{Alt,_ChVal}} when is_atom(Alt) -> - #valuedef{type=element(3,CField), - value=ValSetting, - module=S#state.mname}; ValSetting -> - #identifier{val=ValSetting} + #valuedef{type=element(3,CField), + value=ValSetting, + module=S#state.mname} end, ?dbg("fixedtypevaluefield ValRef: ~p~n",[ValRef]), case ValRef of @@ -4588,8 +4586,6 @@ do_get_ref_type_1(S, #'Externalvaluereference'{pos=P, module=M, value=V}) -> do_get_ref_type_2(S, P, M, V); -do_get_ref_type_1(S, #identifier{val=Name,pos=Pos}) -> - get_referenced1(S, undefined, Name, Pos); do_get_ref_type_1(_, T) -> {undefined,T}. diff --git a/lib/asn1/src/asn1ct_parser2.erl b/lib/asn1/src/asn1ct_parser2.erl index f9c4387ca0..f6374da52e 100644 --- a/lib/asn1/src/asn1ct_parser2.erl +++ b/lib/asn1/src/asn1ct_parser2.erl @@ -25,7 +25,8 @@ %% Only used internally within this module. -record(typereference, {pos,val}). --record(constraint,{c,e}). +-record(constraint, {c,e}). +-record(identifier, {pos,val}). %% parse all types in module parse(Tokens) -> -- cgit v1.2.3