diff options
author | Anthony Ramine <[email protected]> | 2013-05-18 21:06:02 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2013-11-11 15:44:56 +0100 |
commit | 384d59cedf515d34f1b3dbcad992ffe5261b905d (patch) | |
tree | 163f1b36d93a9ae59439fbdfee13ead6d3bc336a /lib/syntax_tools | |
parent | 290dc2b08a2f92157ac5358fba815f4dbb32f8f2 (diff) | |
download | otp-384d59cedf515d34f1b3dbcad992ffe5261b905d.tar.gz otp-384d59cedf515d34f1b3dbcad992ffe5261b905d.tar.bz2 otp-384d59cedf515d34f1b3dbcad992ffe5261b905d.zip |
Fix transformation of implicit funs in igor
Function erl_syntax_lib:analyze_implicit_fun/1 should not be called on
implicit external funs, as their parts can contain variables instead of
atoms and integers.
Diffstat (limited to 'lib/syntax_tools')
-rw-r--r-- | lib/syntax_tools/src/igor.erl | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl index d385c2b690..19b1cd592f 100644 --- a/lib/syntax_tools/src/igor.erl +++ b/lib/syntax_tools/src/igor.erl @@ -1803,20 +1803,25 @@ transform_rule(T, Env, St) -> transform_implicit_fun(T, Env, St) -> {T1, St1} = default_transform(T, Env, St), - F = erl_syntax_lib:analyze_implicit_fun(T1), - {V, Text} = case (Env#code.map)(F) of - F -> - %% Not renamed - {none, []}; - {Atom, Arity} -> - %% Renamed - N = rewrite( - erl_syntax:implicit_fun_name(T1), - erl_syntax:arity_qualifier( - erl_syntax:atom(Atom), - erl_syntax:integer(Arity))), - T2 = erl_syntax:implicit_fun(N), - {{value, T2}, ["function was renamed"]} + {V, Text} = case erl_syntax:type(erl_syntax:implicit_fun_name(T1)) of + arity_qualifier -> + F = erl_syntax_lib:analyze_implicit_fun(T1), + case (Env#code.map)(F) of + F -> + %% Not renamed + {none, []}; + {Atom, Arity} -> + %% Renamed + N = rewrite( + erl_syntax:implicit_fun_name(T1), + erl_syntax:arity_qualifier( + erl_syntax:atom(Atom), + erl_syntax:integer(Arity))), + T2 = erl_syntax:implicit_fun(N), + {{value, T2}, ["function was renamed"]} + end; + module_qualifier -> + {none, []} end, {maybe_modified_quiet(V, T1, 2, Text, Env), St1}. |