aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/shell.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-12-13 11:51:25 +0100
committerBjörn Gustavsson <[email protected]>2013-12-13 11:51:25 +0100
commitfa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4 (patch)
tree86f2b4178f0a15e33d300cf648a0b235252b9990 /lib/stdlib/src/shell.erl
parentaf17798534de376505498b86525ab8618753ebf7 (diff)
parent4df233adc5a1d5ab54d3c7419a463ae1ef417c12 (diff)
downloadotp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.tar.gz
otp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.tar.bz2
otp-fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4.zip
Merge branch 'nox/eep37/OTP-11537'
* nox/eep37/OTP-11537: Support EEP37 named funs in emacs erlang-mode Document named fun expressions Test named funs Support named funs in the debugger interpreter Update primary bootstrap for named funs in the shell Support named funs in the shell Update primary bootstrap for named funs EEP 37: Funs with names Support non top level letrecs in dialyzer
Diffstat (limited to 'lib/stdlib/src/shell.erl')
-rw-r--r--lib/stdlib/src/shell.erl7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index 0d2fc47d13..3b90542452 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -424,6 +424,8 @@ expand_expr({remote,L,M,F}, C) ->
{remote,L,expand_expr(M, C),expand_expr(F, C)};
expand_expr({'fun',L,{clauses,Cs}}, C) ->
{'fun',L,{clauses,expand_exprs(Cs, C)}};
+expand_expr({named_fun,L,Name,Cs}, C) ->
+ {named_fun,L,Name,expand_exprs(Cs, C)};
expand_expr({clause,L,H,G,B}, C) ->
%% Could expand H and G, but then erl_eval has to be changed as well.
{clause,L,H, G, expand_exprs(B, C)};
@@ -1313,6 +1315,11 @@ list_bindings([{Name,Val}|Bs], RT) ->
F = {'fun',0,{clauses,FCs}},
M = {match,0,{var,0,Name},F},
io:fwrite(<<"~ts\n">>, [erl_pp:expr(M, enc())]);
+ {named_fun_data,_FBs,FName,FCs0} ->
+ FCs = expand_value(FCs0), % looks nicer
+ F = {named_fun,0,FName,FCs},
+ M = {match,0,{var,0,Name},F},
+ io:fwrite(<<"~ts\n">>, [erl_pp:expr(M, enc())]);
false ->
Namel = io_lib:fwrite(<<"~s = ">>, [Name]),
Nl = iolist_size(Namel)+1,