aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl/cerl_cconv.erl
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2015-10-05 23:53:27 +0200
committerHans Bolinder <[email protected]>2015-10-09 11:37:54 +0200
commit9221ddadb0eb879462cd96183d3eaf6352830eb3 (patch)
treece049dd5ee655643256375f1cdacb5bf90d599dc /lib/hipe/cerl/cerl_cconv.erl
parentb0ad54fdc41528ddff7c1767403a514a4e0a3f9c (diff)
downloadotp-9221ddadb0eb879462cd96183d3eaf6352830eb3.tar.gz
otp-9221ddadb0eb879462cd96183d3eaf6352830eb3.tar.bz2
otp-9221ddadb0eb879462cd96183d3eaf6352830eb3.zip
Update and cleanup HiPE records
The bulk of the changes concerns cleanups and code refactorings concerning record constructions that assigned 'undefined' to record fields whose type did not contain this value. See commit 8ce35b2. While at it, some new type definitions were introduced and type names were used instead of record type notation. Minor code cleaups were also done.
Diffstat (limited to 'lib/hipe/cerl/cerl_cconv.erl')
-rw-r--r--lib/hipe/cerl/cerl_cconv.erl13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/hipe/cerl/cerl_cconv.erl b/lib/hipe/cerl/cerl_cconv.erl
index 0fc28be5f3..ac9d01ab0e 100644
--- a/lib/hipe/cerl/cerl_cconv.erl
+++ b/lib/hipe/cerl/cerl_cconv.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -710,7 +710,7 @@ ren__new() ->
ren__add(Key, Value, Ren) ->
dict:store(Key, Value, Ren).
-ren__map(Key, Ren) ->
+ren__map(Key, Ren) ->
case dict:find(Key, Ren) of
{ok, Value} ->
Value;
@@ -722,11 +722,14 @@ ren__map(Key, Ren) ->
%% ---------------------------------------------------------------------
%% State
--record(state, {module :: module(), function :: {atom(), arity()},
- names, refs, defs = []}).
+-record(state, {module :: module(),
+ function :: {atom(), arity()} | 'undefined',
+ names = sets:new() :: sets:set(), %% XXX: refine
+ refs = dict:new() :: dict:dict(), %% XXX: refine
+ defs = []}).
s__new(Module) ->
- #state{module = Module, names = sets:new(), refs = dict:new()}.
+ #state{module = Module}.
s__add_function_name(Name, S) ->
S#state{names = sets:add_element(Name, S#state.names)}.