diff options
author | Björn Gustavsson <[email protected]> | 2014-05-16 11:46:08 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-09-01 14:37:13 +0200 |
commit | 2801e8997f25b09d77ad118e20bb69dfbd9eca96 (patch) | |
tree | e0478cb473d12db1436b2c35cd88d4bbaf6c952f /lib/asn1/src | |
parent | 00e8e69831d2dc487bf79f6aad031ebe5b590d4f (diff) | |
download | otp-2801e8997f25b09d77ad118e20bb69dfbd9eca96.tar.gz otp-2801e8997f25b09d77ad118e20bb69dfbd9eca96.tar.bz2 otp-2801e8997f25b09d77ad118e20bb69dfbd9eca96.zip |
Teach the ASN.1 compiler to handle objects in field names
Diffstat (limited to 'lib/asn1/src')
-rw-r--r-- | lib/asn1/src/asn1ct_check.erl | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index e788aa5c6c..ab1cc2a97c 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -1277,10 +1277,25 @@ get_fieldname_element(_S,Def,[{_RefType,_FieldName}|_RestFName]) check_fieldname_element(S,{value,{_,Def}}) -> check_fieldname_element(S,Def); -check_fieldname_element(S,TDef) when is_record(TDef,typedef) -> - check_type(S,TDef,TDef#typedef.typespec); -check_fieldname_element(S,VDef) when is_record(VDef,valuedef) -> - check_value(S,VDef); +check_fieldname_element(S, #typedef{typespec=Ts}=TDef) -> + case Ts of + #'Object'{} -> + check_object(S, TDef, Ts); + _ -> + check_type(S, TDef, Ts) + end; +check_fieldname_element(S, #valuedef{}=VDef) -> + try + check_value(S, VDef) + catch + throw:{objectdef} -> + #valuedef{checked=C,pos=Pos,name=N,type=Type, + value=Def} = VDef, + ClassName = Type#type.def, + NewSpec = #'Object'{classname=ClassName,def=Def}, + NewDef = #typedef{checked=C,pos=Pos,name=N,typespec=NewSpec}, + check_fieldname_element(S, NewDef) + end; check_fieldname_element(S,Eref) when is_record(Eref,'Externaltypereference'); is_record(Eref,'Externalvaluereference') -> |