aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-04-09 07:23:40 +0200
committerBjörn Gustavsson <[email protected]>2013-05-31 14:52:23 +0200
commit4001ac2a291e26d9fa912dbeefbe92278aceb345 (patch)
tree55037cf1b23c5ee251fbd32a3051f7e0df1c4217 /lib/asn1/src/asn1ct_gen.erl
parent83fe4f33369c6c33f6241d279611dc2b91594298 (diff)
downloadotp-4001ac2a291e26d9fa912dbeefbe92278aceb345.tar.gz
otp-4001ac2a291e26d9fa912dbeefbe92278aceb345.tar.bz2
otp-4001ac2a291e26d9fa912dbeefbe92278aceb345.zip
PER: Generate code for deep table constraints at compile-time
For the PER backends, generate code for accessing deep table constraints at compile-time in the same way as is done for BER. While at it, remove the complicated indentation code. Also modernize the test suite and add a test for a deeper nested constraint.
Diffstat (limited to 'lib/asn1/src/asn1ct_gen.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen.erl19
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl
index 978ac280dd..9095e145a3 100644
--- a/lib/asn1/src/asn1ct_gen.erl
+++ b/lib/asn1/src/asn1ct_gen.erl
@@ -108,8 +108,7 @@ pgen_values(Erules,Module,[H|T]) ->
gen_value(Valuedef),
pgen_values(Erules,Module,T).
-pgen_types(_,_,_,Module,[]) ->
- gen_value_match(Module),
+pgen_types(_, _, _, _, []) ->
true;
pgen_types(Rtmod,Erules,N2nConvEnums,Module,[H|T]) ->
asn1ct_name:clear(),
@@ -573,22 +572,6 @@ gen_types(Erules,Tname,Type) when is_record(Type,type) ->
asn1ct_name:clear(),
Rtmod:gen_decode(Erules,Tname,Type).
-gen_value_match(Module) ->
- case get(value_match) of
- {true,Module} ->
- emit(["value_match([{Index,Cname}|Rest],Value) ->",nl,
- " Value2 =",nl,
- " case element(Index,Value) of",nl,
- " {Cname,Val2} -> Val2;",nl,
- " X -> X",nl,
- " end,",nl,
- " value_match(Rest,Value2);",nl,
- "value_match([],Value) ->",nl,
- " Value.",nl]);
- _ -> ok
- end,
- put(value_match,undefined).
-
gen_check_defaultval(Erules,Module,[{Name,Type}|Rest]) ->
gen_check_func(Name,Type),
gen_check_defaultval(Erules,Module,Rest);