aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src/erl_recomment.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-02-17 15:48:13 +0000
committerErlang/OTP <[email protected]>2010-02-17 15:48:13 +0000
commit8b39d0582bee5d4071b7ae4c7407d6662c0414a9 (patch)
tree75b0787b36ae39f477c46e8daadfdf2647b93a1a /lib/syntax_tools/src/erl_recomment.erl
parentedac07ff1e8b49a1ddfd69c712fb2ab3ce37b5ab (diff)
parentabe48c24c115fd629063653eef7bdabd0f82fbbc (diff)
downloadotp-8b39d0582bee5d4071b7ae4c7407d6662c0414a9.tar.gz
otp-8b39d0582bee5d4071b7ae4c7407d6662c0414a9.tar.bz2
otp-8b39d0582bee5d4071b7ae4c7407d6662c0414a9.zip
Merge branch 'ks/hipe' into ccase/r13b04_dev
* ks/hipe: dialyzer: Fix system_limit exception in race analysis syntax_tools: Add types and specs for most exported functions syntax_tools: Support the --enable-native-libs configure option syntax_tools: Remove $Id$ annotations dialyzer: New version for the R13B04 release hipe: Miscellaneous additions typer: New version for the R13B04 release Fix a HiPE compiler bug evaluating an expression that throws system_limit OTP-8460 ks/hipe
Diffstat (limited to 'lib/syntax_tools/src/erl_recomment.erl')
-rw-r--r--lib/syntax_tools/src/erl_recomment.erl45
1 files changed, 27 insertions, 18 deletions
diff --git a/lib/syntax_tools/src/erl_recomment.erl b/lib/syntax_tools/src/erl_recomment.erl
index 62ec7da200..145bbc6f37 100644
--- a/lib/syntax_tools/src/erl_recomment.erl
+++ b/lib/syntax_tools/src/erl_recomment.erl
@@ -47,6 +47,9 @@
%% comments. Comments within function definitions or declarations
%% ("forms") are simply ignored.
+-spec quick_recomment_forms(erl_syntax:forms(), [erl_comment_scan:comment()]) ->
+ erl_syntax:syntaxTree().
+
quick_recomment_forms(Tree, Cs) ->
recomment_forms(Tree, Cs, false).
@@ -109,6 +112,9 @@ quick_recomment_forms(Tree, Cs) ->
%% @see recomment_tree/2
%% @see quick_recomment_forms/2
+-spec recomment_forms(erl_syntax:forms(), [erl_comment_scan:comment()]) ->
+ erl_syntax:syntaxTree().
+
recomment_forms(Tree, Cs) ->
recomment_forms(Tree, Cs, true).
@@ -209,7 +215,7 @@ comment_delta(Text) ->
%% the source file itself, but have been included by preprocessing. This
%% way, comments will not be inserted into such parts by mistake.
--record(filter, {file = undefined, line = 0}).
+-record(filter, {file = undefined, line = 0 :: integer()}).
filter_forms(Fs) ->
filter_forms(Fs, false, #filter{}).
@@ -330,6 +336,9 @@ check_file_attr_2(L) ->
%%
%% @see recomment_forms/2
+-spec recomment_tree(erl_syntax:syntaxTree(), [erl_comment_scan:comment()]) ->
+ {erl_syntax:syntaxTree(), [erl_comment_scan:comment()]}.
+
recomment_tree(Tree, Cs) ->
{Tree1, Cs1} = insert_comments(Cs, build_tree(Tree)),
{revert_tree(Tree1), Cs1}.
@@ -592,23 +601,23 @@ expand_comment(C) ->
%% syntax tree for any such tree that can have no subtrees, i.e., such
%% that `erl_syntax:is_leaf' yields `true'.
--record(leaf, {min = 0,
- max = 0,
- precomments = [],
- postcomments = [],
- value}).
-
--record(tree, {min = 0,
- max = 0,
- type,
- attrs,
- precomments = [],
- postcomments = [],
- subtrees = []}).
-
--record(list, {min = 0,
- max = 0,
- subtrees = []}).
+-record(leaf, {min = 0 :: integer(),
+ max = 0 :: integer(),
+ precomments = [] :: [erl_syntax:syntaxTree()],
+ postcomments = [] :: [erl_syntax:syntaxTree()],
+ value :: erl_syntax:syntaxTree()}).
+
+-record(tree, {min = 0 :: integer(),
+ max = 0 :: integer(),
+ type :: atom(),
+ attrs :: erl_syntax:syntaxTreeAttributes(),
+ precomments = [] :: [erl_syntax:syntaxTree()],
+ postcomments = [] :: [erl_syntax:syntaxTree()],
+ subtrees = [] :: [erl_syntax:syntaxTree()]}).
+
+-record(list, {min = 0 :: integer(),
+ max = 0 :: integer(),
+ subtrees = [] :: [erl_syntax:syntaxTree()]}).
leaf_node(Min, Max, Value) ->
#leaf{min = Min,