aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2014-01-28 15:29:27 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-01-29 15:05:44 +0100
commit1552476d5ba74e177ea9d6b2d2714fd7354a465d (patch)
treef60bb004d898d4a8dd207b7a63469ba593232588
parent3f9526617a72b8683f0f3a37a41597eaf57e902a (diff)
downloadotp-1552476d5ba74e177ea9d6b2d2714fd7354a465d.tar.gz
otp-1552476d5ba74e177ea9d6b2d2714fd7354a465d.tar.bz2
otp-1552476d5ba74e177ea9d6b2d2714fd7354a465d.zip
Fix representation of named funs in syntax_tools
A named fun's name is a variable name, its type in syntax_tools is named_fun_expr.
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index 78a37445ed..93187fa018 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -5691,15 +5691,15 @@ fun_expr_arity(Node) ->
-spec named_fun_expr(syntaxTree(), [syntaxTree()]) -> syntaxTree().
named_fun_expr(Name, Clauses) ->
- tree(fun_expr, #named_fun_expr{name = Name, clauses = Clauses}).
+ tree(named_fun_expr, #named_fun_expr{name = Name, clauses = Clauses}).
revert_named_fun_expr(Node) ->
Pos = get_pos(Node),
Name = named_fun_expr_name(Node),
Clauses = [revert_clause(C) || C <- named_fun_expr_clauses(Node)],
case type(Name) of
- var ->
- {named_fun, Pos, concrete(Name), Clauses};
+ variable ->
+ {named_fun, Pos, variable_name(Name), Clauses};
_ ->
Node
end.
@@ -5715,7 +5715,7 @@ revert_named_fun_expr(Node) ->
named_fun_expr_name(Node) ->
case unwrap(Node) of
{named_fun, Pos, Name, _} ->
- set_pos(atom(Name), Pos);
+ set_pos(variable(Name), Pos);
Node1 ->
(data(Node1))#named_fun_expr.name
end.