aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src/erl_syntax.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-10-23 18:44:15 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-10-24 18:00:01 +0200
commit58d64b9bd9a5759451f678e8a1dcf36b8ded19fd (patch)
tree8d759409e5c12022cbf93b22ab5cd25156fba979 /lib/syntax_tools/src/erl_syntax.erl
parent2a038c5360f0e14f079ea266043ec464600f97c7 (diff)
downloadotp-58d64b9bd9a5759451f678e8a1dcf36b8ded19fd.tar.gz
otp-58d64b9bd9a5759451f678e8a1dcf36b8ded19fd.tar.bz2
otp-58d64b9bd9a5759451f678e8a1dcf36b8ded19fd.zip
syntax_tools: Fix is_literal/1 for binary
Diffstat (limited to 'lib/syntax_tools/src/erl_syntax.erl')
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index 46a5ca48df..5da53113e0 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -6209,10 +6209,17 @@ is_literal(T) ->
is_literal(list_head(T)) andalso is_literal(list_tail(T));
tuple ->
lists:all(fun is_literal/1, tuple_elements(T));
+ binary ->
+ lists:all(fun is_literal_binary_field/1, binary_fields(T));
_ ->
false
end.
+is_literal_binary_field(F) ->
+ case binary_field_types(F) of
+ [] -> is_literal(binary_field_body(F));
+ _ -> false
+ end.
%% =====================================================================
%% @doc Returns an `erl_parse'-compatible representation of a