aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/erl_expand_records.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-04-16 13:43:29 +0200
committerBjörn Gustavsson <[email protected]>2015-04-22 10:14:55 +0200
commit68fdf06841859afc4de3ccdc26fac7b78e8b47db (patch)
treea6a8f6a959321a86ebc2dc966ed3e7dd8bef1f00 /lib/stdlib/src/erl_expand_records.erl
parent84705583c517437f59e5b2b3833e1dc1a693830a (diff)
downloadotp-68fdf06841859afc4de3ccdc26fac7b78e8b47db.tar.gz
otp-68fdf06841859afc4de3ccdc26fac7b78e8b47db.tar.bz2
otp-68fdf06841859afc4de3ccdc26fac7b78e8b47db.zip
erl_expand_records: Simplify handling of call_ext instructions
The erl_expand_records module have inherited code from sys_pre_expand. We can simplify the code for handling the call_ext instruction to make the code clearer and a smidge faster.
Diffstat (limited to 'lib/stdlib/src/erl_expand_records.erl')
-rw-r--r--lib/stdlib/src/erl_expand_records.erl25
1 files changed, 6 insertions, 19 deletions
diff --git a/lib/stdlib/src/erl_expand_records.erl b/lib/stdlib/src/erl_expand_records.erl
index 64a00acd88..dc74d611a3 100644
--- a/lib/stdlib/src/erl_expand_records.erl
+++ b/lib/stdlib/src/erl_expand_records.erl
@@ -384,21 +384,11 @@ expr({call,Line,{tuple,_,[{atom,_,erlang},{atom,_,is_record}]},
expr({call,Line,{atom,_La,N}=Atom,As0}, St0) ->
{As,St1} = expr_list(As0, St0),
Ar = length(As),
- case erl_internal:bif(N, Ar) of
- true ->
- {{call,Line,Atom,As},St1};
- false ->
- case imported(N, Ar, St1) of
- {yes,_Mod} ->
- {{call,Line,Atom,As},St1};
- no ->
- case {N,Ar} of
- {record_info,2} ->
- record_info_call(Line, As, St1);
- _ ->
- {{call,Line,Atom,As},St1}
- end
- end
+ case {N,Ar} =:= {record_info,2} andalso not imported(N, Ar, St1) of
+ true ->
+ record_info_call(Line, As, St1);
+ false ->
+ {{call,Line,Atom,As},St1}
end;
expr({call,Line,{remote,Lr,M,F},As0}, St0) ->
{[M1,F1 | As1],St1} = expr_list([M,F | As0], St0),
@@ -832,10 +822,7 @@ add_imports(Mod, [F | Fs], Is) ->
add_imports(_, [], Is) -> Is.
imported(F, A, St) ->
- case orddict:find({F,A}, St#exprec.imports) of
- {ok,Mod} -> {yes,Mod};
- error -> no
- end.
+ orddict:is_key({F,A}, St#exprec.imports).
%%%
%%% Replace is_record/3 in guards with matching if possible.