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
|
@ -35,9 +35,12 @@
|
|||
|
||||
|
||||
%% parsing of jsx config
|
||||
-spec parse_config(Config::proplists:proplist()) -> config().
|
||||
|
||||
parse_config(Config) ->
|
||||
parse_config(Config, #config{}).
|
||||
|
||||
|
||||
parse_config([], Config) ->
|
||||
Config;
|
||||
parse_config([replaced_bad_utf8|Rest], Config) ->
|
||||
|
@ -101,6 +104,7 @@ parse_config([ignore_bad_escapes|Rest], Config) ->
|
|||
parse_config(Options, Config) ->
|
||||
erlang:error(badarg, [Options, Config]).
|
||||
|
||||
-spec config_to_list(Config::config()) -> proplists:proplist().
|
||||
|
||||
config_to_list(Config) ->
|
||||
lists:map(
|
||||
|
@ -115,6 +119,7 @@ config_to_list(Config) ->
|
|||
)
|
||||
).
|
||||
|
||||
-spec valid_flags() -> [atom()].
|
||||
|
||||
valid_flags() ->
|
||||
[
|
||||
|
@ -141,6 +146,7 @@ valid_flags() ->
|
|||
ignore_bad_escapes %% ignored_bad_escapes
|
||||
].
|
||||
|
||||
-spec extract_config(Config::proplists:proplist()) -> proplists:proplist().
|
||||
|
||||
extract_config(Config) ->
|
||||
extract_parser_config(Config, []).
|
||||
|
@ -305,4 +311,4 @@ config_to_list_test_() ->
|
|||
fake_error_handler(_, _, _) -> ok.
|
||||
|
||||
|
||||
-endif.
|
||||
-endif.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue