aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-14 15:45:41 +0100
committerBjörn Gustavsson <[email protected]>2013-02-14 17:02:09 +0100
commit4613b7d6c65a1bbced21e84edb45fd26dd440bae (patch)
tree1bb5f96989798b97ac63d6eba88c215011902196 /lib/asn1/src
parentf894be67127261270739039ac291ecc3353c470b (diff)
downloadotp-4613b7d6c65a1bbced21e84edb45fd26dd440bae.tar.gz
otp-4613b7d6c65a1bbced21e84edb45fd26dd440bae.tar.bz2
otp-4613b7d6c65a1bbced21e84edb45fd26dd440bae.zip
der: Correct code generation for checking of empty sets
The ASN.1 compiler would generate an Erlang module with incorrect syntax for: T DEFINITIONS AUTOMATIC TAGS ::= BEGIN Empty ::= SET { } S ::= SEQUENCE { e Empty DEFAULT {} } END
Diffstat (limited to 'lib/asn1/src')
-rw-r--r--lib/asn1/src/asn1ct_gen.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl
index ebc52df1d9..76c4182160 100644
--- a/lib/asn1/src/asn1ct_gen.erl
+++ b/lib/asn1/src/asn1ct_gen.erl
@@ -657,9 +657,13 @@ gen_check_sof(Name,SOF,Type) ->
end,
emit({" ",{asis,NewName},"(DVs,Vs).",nl,nl}).
+gen_check_sequence(Name, []) ->
+ emit([{asis,ensure_atom(Name)},"(_,_) ->",nl,
+ " throw(badval).",nl,nl]);
gen_check_sequence(Name,Components) ->
emit([{asis,ensure_atom(Name)},"(DefaultValue,Value) ->",nl]),
gen_check_sequence(Name,Components,1).
+
gen_check_sequence(Name,[#'ComponentType'{name=N,typespec=Type}|Cs],Num) ->
InnerType = get_inner(Type#type.def),
NthDefV = ["element(",Num+1,",DefaultValue)"],
@@ -671,9 +675,7 @@ gen_check_sequence(Name,[#'ComponentType'{name=N,typespec=Type}|Cs],Num) ->
_ ->
emit({",",nl}),
gen_check_sequence(Name,Cs,Num+1)
- end;
-gen_check_sequence(_,[],_) ->
- ok.
+ end.
gen_check_choice(Name,CList=[#'ComponentType'{}|_Cs]) ->
emit([{asis,ensure_atom(Name)},"({Id,DefaultValue},{Id,Value}) ->",nl]),