summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Aloi <robertoaloi@fb.com>2023-04-26 16:36:55 +0200
committerRoberto Aloi <robertoaloi@fb.com>2023-04-26 16:36:55 +0200
commit83c8428e6b00d7255e67a19dd007cc1938d47458 (patch)
treeb35e08a11297b71951db17fcb3948bd46053eb54
parentcd91cd9688b919fa81cd583e62d6950e99c23e81 (diff)
downloaderlang-83c8428e6b00d7255e67a19dd007cc1938d47458.tar.gz
Handle feature attribute in epp_dodger
-rw-r--r--lib/edoc/test/edoc_SUITE.erl15
-rw-r--r--lib/edoc/test/edoc_SUITE_data/module_with_feature.erl2
-rw-r--r--lib/syntax_tools/src/epp_dodger.erl2
3 files changed, 17 insertions, 2 deletions
diff --git a/lib/edoc/test/edoc_SUITE.erl b/lib/edoc/test/edoc_SUITE.erl
index c150ace008..d09e9a2ecb 100644
--- a/lib/edoc/test/edoc_SUITE.erl
+++ b/lib/edoc/test/edoc_SUITE.erl
@@ -24,13 +24,14 @@
%% Test cases
-export([app/1,appup/1,build_std/1,build_map_module/1,otp_12008/1,
- build_app/1, otp_14285/1, infer_module_app_test/1]).
+ build_app/1, otp_14285/1, infer_module_app_test/1,
+ module_with_feature/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[app,appup,build_std,build_map_module,otp_12008, build_app, otp_14285,
- infer_module_app_test].
+ infer_module_app_test, module_with_feature].
groups() ->
[].
@@ -159,3 +160,13 @@ infer_module_app_test_({M, Beam}) ->
R2 = filelib:is_regular(BeamPath2),
R1 orelse R2
end.
+
+module_with_feature(Config) ->
+ DataDir = ?config(data_dir, Config),
+ PrivDir = ?config(priv_dir, Config),
+ Source = filename:join(DataDir, "module_with_feature.erl"),
+ DodgerOpts = [{dir, PrivDir}],
+ ok = edoc:files([Source], DodgerOpts),
+ PreprocessOpts = [{preprocess, true}, {dir, PrivDir}],
+ ok = edoc:files([Source], PreprocessOpts),
+ ok.
diff --git a/lib/edoc/test/edoc_SUITE_data/module_with_feature.erl b/lib/edoc/test/edoc_SUITE_data/module_with_feature.erl
new file mode 100644
index 0000000000..0091b704b4
--- /dev/null
+++ b/lib/edoc/test/edoc_SUITE_data/module_with_feature.erl
@@ -0,0 +1,2 @@
+-module(module_with_feature).
+-feature(maybe_expr, enable).
diff --git a/lib/syntax_tools/src/epp_dodger.erl b/lib/syntax_tools/src/epp_dodger.erl
index 2e0694c2cf..40f67b5660 100644
--- a/lib/syntax_tools/src/epp_dodger.erl
+++ b/lib/syntax_tools/src/epp_dodger.erl
@@ -517,6 +517,8 @@ quickscan_form([{'-', _Anno}, {'else', AnnoA} | _Ts]) ->
kill_form(AnnoA);
quickscan_form([{'-', _Anno}, {atom, AnnoA, endif} | _Ts]) ->
kill_form(AnnoA);
+quickscan_form([{'-', _Anno}, {atom, AnnoA, feature} | _Ts]) ->
+ kill_form(AnnoA);
quickscan_form([{'-', Anno}, {'?', _}, {Type, _, _}=N | [{'(', _} | _]=Ts])
when Type =:= atom; Type =:= var ->
%% minus, macro and open parenthesis at start of form - assume that