aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_check.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-10-30 14:12:51 +0100
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:26 +0100
commit5abac511937a99414902d3052fb633e1a65812d3 (patch)
tree923ba92f5ff7ebe2a71e01f04e694436fe3b6651 /lib/asn1/src/asn1ct_check.erl
parentd0b902b1909ae6d17fd2548baf0fd95ab44f0631 (diff)
downloadotp-5abac511937a99414902d3052fb633e1a65812d3.tar.gz
otp-5abac511937a99414902d3052fb633e1a65812d3.tar.bz2
otp-5abac511937a99414902d3052fb633e1a65812d3.zip
Fix instantiation of an inlined type in a value definition
Diffstat (limited to 'lib/asn1/src/asn1ct_check.erl')
-rw-r--r--lib/asn1/src/asn1ct_check.erl25
1 files changed, 8 insertions, 17 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl
index 5f07933c74..904979e86e 100644
--- a/lib/asn1/src/asn1ct_check.erl
+++ b/lib/asn1/src/asn1ct_check.erl
@@ -395,7 +395,7 @@ do_checkv(S, Name, Value)
{pobjectsetdef,Name};
{objectsetdef} ->
{objectsetdef,Name};
- {objectdef} ->
+ {asn1_class, _} ->
%% this is an object, save as typedef
#valuedef{checked=C,pos=Pos,name=N,type=Type,
value=Def} = Value,
@@ -1398,7 +1398,7 @@ check_fieldname_element_1(S, #valuedef{}=VDef) ->
try
check_value(S, VDef)
catch
- throw:{objectdef} ->
+ throw:{asn1_class, _} ->
#valuedef{checked=C,pos=Pos,name=N,type=Type,
value=Def} = VDef,
ClassName = Type#type.def,
@@ -2091,8 +2091,9 @@ check_value(S, #valuedef{}=V) ->
end.
check_valuedef(#state{recordtopname=TopName}=S0, V0) ->
- #valuedef{name=Name,type=Vtype,value=Value,module=ModName} = V0,
+ #valuedef{name=Name,type=Vtype0,value=Value,module=ModName} = V0,
V = V0#valuedef{checked=true},
+ Vtype = check_type(S0, #typedef{name=Name,typespec=Vtype0},Vtype0),
Def = Vtype#type.def,
S1 = S0#state{type=Vtype,tname=Def,value=V0,vname=Name},
SVal = update_state(S1, ModName),
@@ -2102,15 +2103,8 @@ check_valuedef(#state{recordtopname=TopName}=S0, V0) ->
%% If V isn't a value but an object Type is a #classdef{}
S2 = update_state(S1, RefM),
case Type of
- #classdef{} ->
- throw({objectdef});
#typedef{typespec=TypeSpec0}=TypeDef ->
- TypeSpec = try check_type(S2, TypeDef, TypeSpec0) of
- TypeSpec1 -> TypeSpec1
- catch
- throw:{asn1_class,_} ->
- throw({objectdef})
- end,
+ TypeSpec = check_type(S2, TypeDef, TypeSpec0),
S3 = case is_contextswitchtype(Type) of
true ->
S2;
@@ -2127,7 +2121,7 @@ check_valuedef(#state{recordtopname=TopName}=S0, V0) ->
V#valuedef{type=Type}),
V#valuedef{value=CheckedVal}
end;
- 'ANY' ->
+ 'ASN1_OPEN_TYPE' ->
{opentypefieldvalue,ANYType,ANYValue} = Value,
CheckedV = check_value(SVal,#valuedef{name=Name,
type=ANYType,
@@ -2141,11 +2135,6 @@ check_valuedef(#state{recordtopname=TopName}=S0, V0) ->
#'SEQUENCE'{} ->
{ok,SeqVal} = convert_external(SVal, Value),
V#valuedef{value=normalize_value(SVal, Vtype, SeqVal, TopName)};
- {'SelectionType',SelName,SelT} ->
- CheckedT = check_selectiontype(SVal, SelName, SelT),
- NewV = V#valuedef{type=CheckedT},
- SelVDef = check_value(S1#state{value=NewV}, NewV),
- V#valuedef{value=SelVDef#valuedef.value};
_ ->
V#valuedef{value=normalize_value(SVal, Vtype, Value, TopName)}
end.
@@ -3220,6 +3209,8 @@ check_type(S=#state{recordtopname=TopName},Type,Ts) when is_record(Ts,type) ->
CheckedT = check_selectiontype(S,Name,T),
TempNewDef#newt{tag=merge_tags(Tag,CheckedT#type.tag),
type=CheckedT#type.def};
+ 'ASN1_OPEN_TYPE' ->
+ TempNewDef;
Other ->
exit({'cant check' ,Other})
end,