aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/code_server.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-27 10:32:41 +0100
committerBjörn Gustavsson <[email protected]>2016-01-27 16:46:23 +0100
commitc14d4186d7fa6565d187da15bf39b6d71cb717bf (patch)
treedcccec9d86fec3afd9b016fe0a5def9d07d23ef9 /lib/kernel/src/code_server.erl
parent480239fc11d72cf3434e61b541ffec9cb98c2db3 (diff)
downloadotp-c14d4186d7fa6565d187da15bf39b6d71cb717bf.tar.gz
otp-c14d4186d7fa6565d187da15bf39b6d71cb717bf.tar.bz2
otp-c14d4186d7fa6565d187da15bf39b6d71cb717bf.zip
code_server: Add types to the state record
Diffstat (limited to 'lib/kernel/src/code_server.erl')
-rw-r--r--lib/kernel/src/code_server.erl21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 77d531b2bd..2743214bef 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -33,13 +33,15 @@
-define(ANY_NATIVE_CODE_LOADED, any_native_code_loaded).
--record(state, {supervisor,
- root,
- path,
- moddb,
- namedb,
- mode = interactive,
- on_load = []}).
+-type on_load_item() :: {reference(),module(),file:name_all(),[pid()]}.
+
+-record(state, {supervisor :: pid(),
+ root :: file:name_all(),
+ path :: [file:name_all()],
+ moddb :: ets:tab(),
+ namedb :: ets:tab(),
+ mode = interactive :: 'interactive' | 'embedded',
+ on_load = [] :: [on_load_item()]}).
-type state() :: #state{}.
start_link(Args) ->
@@ -80,7 +82,8 @@ init(Ref, Parent, [Root,Mode]) ->
end,
Path = add_loader_path(IPath, Mode),
- State = #state{root = Root,
+ State = #state{supervisor = Parent,
+ root = Root,
path = Path,
moddb = Db,
namedb = init_namedb(Path),
@@ -89,7 +92,7 @@ init(Ref, Parent, [Root,Mode]) ->
put(?ANY_NATIVE_CODE_LOADED, false),
Parent ! {Ref,{ok,self()}},
- loop(State#state{supervisor = Parent}).
+ loop(State).
get_user_lib_dirs() ->
case os:getenv("ERL_LIBS") of