aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-02-15 10:13:21 +0100
committerGitHub <[email protected]>2017-02-15 10:13:21 +0100
commitd09bb6b2bdfc32dfb10c051f9e3e3c32a806cfb4 (patch)
treeeb3861b8a088b20f538b592bf69b4661b0651c27 /lib
parent0dfe26c8747362f954bbee4c8a99160af9adf5a5 (diff)
parent4bf5cb8aec7680a51a99a92ce124ca270c9b5895 (diff)
downloadotp-d09bb6b2bdfc32dfb10c051f9e3e3c32a806cfb4.tar.gz
otp-d09bb6b2bdfc32dfb10c051f9e3e3c32a806cfb4.tar.bz2
otp-d09bb6b2bdfc32dfb10c051f9e3e3c32a806cfb4.zip
Merge pull request #1340 from josevalim/jv-erl-expand-records-to-maps
Use maps instead of dict in erl_expand_records
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/erl_expand_records.erl18
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);