diff options
author | Dan Gudmundsson <[email protected]> | 2014-11-14 11:57:39 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-01-12 11:40:27 +0100 |
commit | 7339da14195d1eeac133be8b9b7287ac8b577114 (patch) | |
tree | aac4a86effa880f1658dec204de0ff935a6a6aaa | |
parent | ad5b931714295640ff117d23aeb8f691e9cc8a55 (diff) | |
download | otp-7339da14195d1eeac133be8b9b7287ac8b577114.tar.gz otp-7339da14195d1eeac133be8b9b7287ac8b577114.tar.bz2 otp-7339da14195d1eeac133be8b9b7287ac8b577114.zip |
asn1: Minor bug fixes
Fixes needed to avoid a compiling asn1 files in order.
For example the x420 directory in test now compiles with
erlc *.asn
Do not save class records without module information in asn1db files.
Use recursive get_referenced_type in get_objclass_fields/2
-rw-r--r-- | lib/asn1/src/asn1ct_check.erl | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index 2955f55b60..568855a42d 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -438,24 +438,31 @@ do_checkc(S, Name, Class) -> do_checkc_1(S, Name, Class) end. -do_checkc_1(S0, Name, Class0) -> - {Class1,ClassSpec} = - case Class0 of - #classdef{} -> - {Class0,Class0}; - #typedef{} -> - {#classdef{name=Name},Class0#typedef.typespec} - end, - S = S0#state{type=Class0,tname=Name}, - try check_class(S, ClassSpec) of +do_checkc_1(S, Name, #classdef{}=Class) -> + try check_class(S, Class) of + C -> + store_class(S, true, Class#classdef{typespec=C}, Name), + ok + catch + {error,Reason} -> + error({class,Reason,S}) + end; +do_checkc_1(S, Name, #typedef{typespec=#type{def=Def}=TS}) -> + try check_class(S, TS) of C -> - Class = Class1#classdef{checked=true,typespec=C}, - asn1_db:dbput(S#state.mname, Name, Class), + {Mod,Pos} = case Def of + #'Externaltypereference'{module=M, pos=P} -> + {M,P}; + {pt, #'Externaltypereference'{module=M, pos=P}, _} -> + {M,P} + end, + Class = #classdef{name=Name, typespec=C, pos=Pos, module=Mod}, + store_class(S, true, Class, Name), ok - catch - {error,Reason} -> - error({class,Reason,S}) - end. + catch + {error,Reason} -> + error({class,Reason,S}) + end. %% is_classname(Atom) -> true|false. is_classname(Name) when is_atom(Name) -> @@ -1296,7 +1303,7 @@ gen_incl1(S,Fields,[C|CFields]) -> end. get_objclass_fields(S,Eref=#'Externaltypereference'{}) -> - {_,ClassDef} = get_referenced_type(S,Eref), + {_,ClassDef} = get_referenced_type(S,Eref, true), get_objclass_fields(S,ClassDef); get_objclass_fields(S,CD=#classdef{typespec=#'Externaltypereference'{}}) -> get_objclass_fields(S,CD#classdef.typespec); |