Added typespecs on all exported functions

Made sure all exported types do have a typespec is useful in build scenarios
where the erlang compile options
[warnings_as_errors, warn_missing_spec]
are used.

A few type errors found by Dialyzer are corrected too.

	modified:   src/jsx.erl
	modified:   src/jsx_config.erl
	modified:   src/jsx_config.hrl
	modified:   src/jsx_decoder.erl
	modified:   src/jsx_parser.erl
	modified:   src/jsx_to_json.erl
	modified:   src/jsx_to_term.erl
	modified:   src/jsx_verify.erl
This commit is contained in:
Ola Backstrom 2013-09-19 17:04:38 +02:00
parent a39baa4efc
commit 2943116c08
8 changed files with 48 additions and 10 deletions

View file

@ -32,6 +32,7 @@
}).
-type config() :: [].
-export_type([config/0]).
-spec is_json(Source::binary(), Config::config()) -> true | false.
@ -72,10 +73,14 @@ parse_config([K|Rest] = Options, Config) ->
parse_config([], Config) ->
Config.
-type state() :: {#config{}, any()}.
-spec init(Config::proplists:proplist()) -> state().
init(Config) -> {parse_config(Config), []}.
-spec handle_event(Event::any(), State::state()) -> state().
handle_event(end_json, _) -> true;
handle_event(_, {Config, _} = State) when Config#config.repeated_keys == true -> State;
@ -165,4 +170,4 @@ handle_event_test_() ->
].
-endif.
-endif.