aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-02-04 16:59:16 +0100
committerAnders Svensson <[email protected]>2013-02-08 19:28:47 +0100
commitadb264d08ac8417d3f760c39c3e4ba1543a39500 (patch)
tree6ab5de43a329e57f2182c954b659ddf44ff44d57 /lib/diameter/src
parent2e422db2bf236fb5369cbfe54b6ccd727703b801 (diff)
downloadotp-adb264d08ac8417d3f760c39c3e4ba1543a39500.tar.gz
otp-adb264d08ac8417d3f760c39c3e4ba1543a39500.tar.bz2
otp-adb264d08ac8417d3f760c39c3e4ba1543a39500.zip
Add exprecs '#new-'/1 clause taking list argument
As an inverse to '#get-'/1 in the preceding commit.
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/compiler/diameter_exprecs.erl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/diameter/src/compiler/diameter_exprecs.erl b/lib/diameter/src/compiler/diameter_exprecs.erl
index b5149aa324..cc8458efa1 100644
--- a/lib/diameter/src/compiler/diameter_exprecs.erl
+++ b/lib/diameter/src/compiler/diameter_exprecs.erl
@@ -61,8 +61,10 @@
%% '#info-'(r, Info) ->
%% '#info-r'(Info).
%%
+%% '#new-'([r | Vals]) -> '#new-r'(Vals);
%% '#new-'(r) -> #r{}.
-%% '#new-'(r, Vals) -> '#new-r'(Vals)
+%%
+%% '#new-'(r, Vals) -> '#new-r'(Vals).
%%
%% '#new-r'() -> #r{}.
%% '#new-r'(Vals) -> '#set-r'(Vals, #r{}).
@@ -193,12 +195,15 @@ fname(Op, Rname) ->
'#new-/1'(Exports) ->
{?function, fname(new), 1,
- lists:map(fun 'new-'/1, Exports) ++ [?BADARG(1)]}.
+ lists:flatmap(fun 'new-'/1, Exports) ++ [?BADARG(1)]}.
'new-'(R) ->
- {?clause, [?ATOM(R)],
- [],
- [{?record, R, []}]}.
+ [{?clause, [?ATOM(R)],
+ [],
+ [{?record, R, []}]},
+ {?clause, [{?cons, ?ATOM(R), ?VAR('Vals')}],
+ [],
+ [?CALL(fname(new, R), [?VAR('Vals')])]}].
'#new-/2'(Exports) ->
{?function, fname(new), 2,