diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-02 15:01:15 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-02 15:01:15 +0100 |
commit | 334d32e77e309e1e49d2f0710ff98208a4bb5c08 (patch) | |
tree | ee4dba7266763bb5abbc5a66531aea974ee2a3f4 /codegen.py | |
parent | d81c817d65ceba84c8095b0df866e068779c92f2 (diff) | |
download | rabbitmq-server-334d32e77e309e1e49d2f0710ff98208a4bb5c08.tar.gz |
better types
Diffstat (limited to 'codegen.py')
-rw-r--r-- | codegen.py | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -333,7 +333,8 @@ def genErl(spec): -export([amqp_exception/1]). -export_type([amqp_table/0, amqp_property_type/0, amqp_method_record/0, - amqp_method_name/0, amqp_method/0, amqp_class_id/0]). + amqp_method_name/0, amqp_method/0, amqp_class_id/0, + amqp_value/0, amqp_array/0]). bitvalue(true) -> 1; bitvalue(false) -> 0; @@ -353,9 +354,7 @@ bitvalue(undefined) -> 0. -spec(encode_properties/1 :: (amqp_method_record()) -> binary()). -spec(lookup_amqp_exception/1 :: (amqp_exception()) -> {boolean(), amqp_exception_code(), binary()}). -spec(amqp_exception/1 :: (amqp_exception_code()) -> amqp_exception()). --endif. % use_specs --ifdef(use_specs). -type(amqp_field_type() :: 'longstr' | 'signedint' | 'decimal' | 'timestamp' | 'table' | 'byte' | 'double' | 'float' | 'long' | @@ -363,10 +362,23 @@ bitvalue(undefined) -> 0. -type(amqp_property_type() :: 'shortstr' | 'longstr' | 'octet' | 'shortint' | 'longint' | 'longlongint' | 'timestamp' | 'bit' | 'table'). -%% we could make this more precise but ultimately are limited by -%% dialyzer's lack of support for recursive types --type(amqp_table() :: [{binary(), amqp_field_type(), any()}]). --type(amqp_properties() :: tuple()). + +-type(amqp_table() :: [{binary(), amqp_field_type(), amqp_value()}]). +-type(amqp_array() :: [{amqp_field_type(), amqp_value()}]). +-type(amqp_value() :: binary() | % longstr + integer() | % signedint + {non_neg_integer(), non_neg_integer()} | % decimal + amqp_table() | + amqp_array() | + byte() | % byte + float() | % double + integer() | % long + integer() | % short + boolean() | % bool + binary() | % binary + 'undefined' | % void + non_neg_integer() % timestamp + ). -endif. % use_specs """ print "-ifdef(use_specs)." |