summaryrefslogtreecommitdiff
path: root/lib/stdlib/src/epp.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2015-11-17 09:16:24 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2015-11-17 09:16:24 +0100
commitda6d480a65cce9392d4da80d142600f941d52881 (patch)
tree041ca45d393a4a765e8ca7e749401df16b6ae227 /lib/stdlib/src/epp.erl
parent57c53b4918bafc72097315d980fea2d0f296b1bb (diff)
downloaderlang-da6d480a65cce9392d4da80d142600f941d52881.tar.gz
epp: Refactor user_predef/2 to share more code
Diffstat (limited to 'lib/stdlib/src/epp.erl')
-rw-r--r--lib/stdlib/src/epp.erl11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl
index d9a579ebc6..87cffc9e16 100644
--- a/lib/stdlib/src/epp.erl
+++ b/lib/stdlib/src/epp.erl
@@ -593,16 +593,7 @@ user_predef([{M,Val}|Pdm], Ms) when is_atom(M) ->
user_predef(Pdm, dict:store({atom,M}, [{none, {none,Exp}}], Ms))
end;
user_predef([M|Pdm], Ms) when is_atom(M) ->
- case dict:find({atom,M}, Ms) of
- {ok,_Defs} when is_list(_Defs) -> %% User defined macros
- {error,{redefine,M}};
- {ok,_Def} -> %% Predefined macros
- {error,{redefine_predef,M}};
- error ->
- A = line1(),
- user_predef(Pdm,
- dict:store({atom,M}, [{none, {none,[{atom,A,true}]}}], Ms))
- end;
+ user_predef([{M,true}|Pdm], Ms);
user_predef([Md|_Pdm], _Ms) -> {error,{bad,Md}};
user_predef([], Ms) -> {ok,Ms}.