diff options
author | Zachary Dean <[email protected]> | 2019-08-14 14:39:08 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-08-22 13:59:18 +0200 |
commit | 204252d7dc8e2936f14ef48346317146a2f5f4af (patch) | |
tree | 094bb13456728d22d0e4c0d488bbe10b248453e9 | |
parent | da06fd040775fffee17409ebbd6fa797e34d6f99 (diff) | |
download | otp-204252d7dc8e2936f14ef48346317146a2f5f4af.tar.gz otp-204252d7dc8e2936f14ef48346317146a2f5f4af.tar.bz2 otp-204252d7dc8e2936f14ef48346317146a2f5f4af.zip |
Add unwrap calls to map_field_* in erl_syntax
This adds missing calls to unwrap/1 for the map_field_* name and value functions and puts them inline with map_expr_fields/1.
Using these functions with "wrapped" nodes fails with badarg.
-rw-r--r-- | lib/syntax_tools/src/erl_syntax.erl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index b856a5d1dd..385094d5bd 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -2166,11 +2166,11 @@ revert_map_field_assoc(Node) -> -spec map_field_assoc_name(syntaxTree()) -> syntaxTree(). map_field_assoc_name(Node) -> - case Node of + case unwrap(Node) of {map_field_assoc, _, Name, _} -> Name; - _ -> - (data(Node))#map_field_assoc.name + Node1 -> + (data(Node1))#map_field_assoc.name end. @@ -2182,11 +2182,11 @@ map_field_assoc_name(Node) -> -spec map_field_assoc_value(syntaxTree()) -> syntaxTree(). map_field_assoc_value(Node) -> - case Node of + case unwrap(Node) of {map_field_assoc, _, _, Value} -> Value; - _ -> - (data(Node))#map_field_assoc.value + Node1 -> + (data(Node1))#map_field_assoc.value end. @@ -2224,11 +2224,11 @@ revert_map_field_exact(Node) -> -spec map_field_exact_name(syntaxTree()) -> syntaxTree(). map_field_exact_name(Node) -> - case Node of + case unwrap(Node) of {map_field_exact, _, Name, _} -> Name; - _ -> - (data(Node))#map_field_exact.name + Node1 -> + (data(Node1))#map_field_exact.name end. @@ -2240,11 +2240,11 @@ map_field_exact_name(Node) -> -spec map_field_exact_value(syntaxTree()) -> syntaxTree(). map_field_exact_value(Node) -> - case Node of + case unwrap(Node) of {map_field_exact, _, _, Value} -> Value; - _ -> - (data(Node))#map_field_exact.value + Node1 -> + (data(Node1))#map_field_exact.value end. |