From 2fb9ec8ac0185e74cee1b86872f860b5c84adf0d Mon Sep 17 00:00:00 2001 From: slepher Date: Wed, 27 Jan 2021 16:24:23 +0800 Subject: [PATCH] remove attr_walk_return --- src/traverse/astranaut_options.erl | 17 ----------------- test/astranaut_SUITE.erl | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/traverse/astranaut_options.erl b/src/traverse/astranaut_options.erl index 41985d9..b06bd96 100644 --- a/src/traverse/astranaut_options.erl +++ b/src/traverse/astranaut_options.erl @@ -22,7 +22,6 @@ -export([forms_with_attribute/5]). -export([options/1]). -export([validate/2, validate/3]). --export([attr_walk_return/1]). -export([by_validator/3]). -export([get_boolean/4]). @@ -98,22 +97,6 @@ validate(Validator, ToValidate, Options) -> fun(ToValidate1) -> validate_1(Validator, ToValidate1, Options) end). - -attr_walk_return(#{node := Node} = Map) -> - Map1 = maps:remove(node, Map), - attr_walk_return(Map1#{nodes => [Node]}); -attr_walk_return(#{} = Map) -> - Nodes = maps:get(nodes, Map, []), - A = maps:get(return, Map, ok), - Map1 = maps:remove(nodes, Map), - astranaut_walk_return:new(Map1#{return => {Nodes, A}}); -attr_walk_return(Return) -> - case astranaut_walk_return:to_map(Return) of - {ok, Map} -> - attr_walk_return(Map); - error -> - attr_walk_return(#{return => Return}) - end. %%-------------------------------------------------------------------- %% @doc %% @spec diff --git a/test/astranaut_SUITE.erl b/test/astranaut_SUITE.erl index 03aeef4..a3dcb98 100644 --- a/test/astranaut_SUITE.erl +++ b/test/astranaut_SUITE.erl @@ -264,7 +264,7 @@ test_forms_with_attribute(_Config) -> astranaut_options:forms_with_attribute( fun(Attr, Acc, #{line := Line}) -> Node = astranaut:attribute_node(mark_1, Line, Attr), - astranaut_options:attr_walk_return(#{node => Node, return => [Attr|Acc]}) + {[Node], [Attr|Acc]} end, [], Forms, mark, #{simplify_return => true}), Marks1 = astranaut_options:with_attribute(