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:
parent
a39baa4efc
commit
2943116c08
8 changed files with 48 additions and 10 deletions
|
@ -36,12 +36,12 @@ parser(Handler, State, Config) ->
|
|||
%% resume allows continuation from interrupted decoding without having to explicitly export
|
||||
%% all states
|
||||
-spec resume(
|
||||
Rest::binary(),
|
||||
Rest::list(), %% was binary(),
|
||||
State::atom(),
|
||||
Handler::{atom(), any()},
|
||||
Stack::list(atom()),
|
||||
Config::jsx:config()
|
||||
) -> jsx:parser().
|
||||
) -> jsx:parser() | {incomplete, _}.
|
||||
|
||||
resume(Rest, State, Handler, Stack, Config) ->
|
||||
case State of
|
||||
|
@ -208,8 +208,12 @@ clean_string(Bin, Tokens, Handler, Stack, Config) ->
|
|||
|
||||
|
||||
%% for raw input
|
||||
-spec init(proplists:proplist()) -> list().
|
||||
|
||||
init([]) -> [].
|
||||
|
||||
-spec handle_event(Event::any(), Acc::list()) -> list().
|
||||
|
||||
handle_event(end_json, State) -> lists:reverse(State);
|
||||
handle_event(Event, State) -> [Event] ++ State.
|
||||
|
||||
|
@ -313,4 +317,4 @@ raw_test_() ->
|
|||
].
|
||||
|
||||
|
||||
-endif.
|
||||
-endif.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue