diff options
author | José Valim <[email protected]> | 2017-02-12 19:59:12 +0100 |
---|---|---|
committer | José Valim <[email protected]> | 2017-02-12 20:03:24 +0100 |
commit | 4bf5cb8aec7680a51a99a92ce124ca270c9b5895 (patch) | |
tree | 7790fea72077cd7415ac34a2644b6ac0ee947f9d /lib/stdlib | |
parent | 1526eaead833b3bdcd3555a12e2af62c359e7868 (diff) | |
download | otp-4bf5cb8aec7680a51a99a92ce124ca270c9b5895.tar.gz otp-4bf5cb8aec7680a51a99a92ce124ca270c9b5895.tar.bz2 otp-4bf5cb8aec7680a51a99a92ce124ca270c9b5895.zip |
Use maps instead of dict in erl_expand_records
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/erl_expand_records.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/stdlib/src/erl_expand_records.erl b/lib/stdlib/src/erl_expand_records.erl index 2280464bff..16220bceb4 100644 --- a/lib/stdlib/src/erl_expand_records.erl +++ b/lib/stdlib/src/erl_expand_records.erl @@ -30,13 +30,13 @@ -import(lists, [map/2,foldl/3,foldr/3,sort/1,reverse/1,duplicate/2]). --record(exprec, {compile=[], % Compile flags - vcount=0, % Variable counter - calltype=#{}, % Call types - records=dict:new(), % Record definitions - strict_ra=[], % strict record accesses - checked_ra=[] % successfully accessed records - }). +-record(exprec, {compile=[], % Compile flags + vcount=0, % Variable counter + calltype=#{}, % Call types + records=#{}, % Record definitions + strict_ra=[], % strict record accesses + checked_ra=[] % successfully accessed records + }). -spec(module(AbsForms, CompileOptions) -> AbsForms2 when AbsForms :: [erl_parse:abstract_form()], @@ -72,7 +72,7 @@ init_calltype_imports([], Ctype) -> Ctype. forms([{attribute,_,record,{Name,Defs}}=Attr | Fs], St0) -> NDefs = normalise_fields(Defs), - St = St0#exprec{records=dict:store(Name, NDefs, St0#exprec.records)}, + St = St0#exprec{records=maps:put(Name, NDefs, St0#exprec.records)}, {Fs1, St1} = forms(Fs, St), {[Attr | Fs1], St1}; forms([{function,L,N,A,Cs0} | Fs0], St0) -> @@ -546,7 +546,7 @@ normalise_fields(Fs) -> %% record_fields(RecordName, State) %% find_field(FieldName, Fields) -record_fields(R, St) -> dict:fetch(R, St#exprec.records). +record_fields(R, St) -> maps:get(R, St#exprec.records). find_field(F, [{record_field,_,{atom,_,F},Val} | _]) -> {ok,Val}; find_field(F, [_ | Fs]) -> find_field(F, Fs); |