aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-12-15 09:17:34 +0100
committerBjörn Gustavsson <[email protected]>2017-01-12 12:10:11 +0100
commit8f1b84b520142f61d7a262ca4b4971fad29a530a (patch)
tree624508c17e55ce2d15a7ac33d12339af9fc28102 /lib
parentcef1a51a881f9b36d2096efec29df262e5f17a3c (diff)
downloadotp-8f1b84b520142f61d7a262ca4b4971fad29a530a.tar.gz
otp-8f1b84b520142f61d7a262ca4b4971fad29a530a.tar.bz2
otp-8f1b84b520142f61d7a262ca4b4971fad29a530a.zip
sys_pre_attributes: Correct and add missing types and specs
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/sys_pre_attributes.erl22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/compiler/src/sys_pre_attributes.erl b/lib/compiler/src/sys_pre_attributes.erl
index 57937d48aa..67adae5acf 100644
--- a/lib/compiler/src/sys_pre_attributes.erl
+++ b/lib/compiler/src/sys_pre_attributes.erl
@@ -25,10 +25,10 @@
-define(OPTION_TAG, attributes).
--record(state, {forms,
- pre_ops = [],
- post_ops = [],
- options}).
+-record(state, {forms :: [form()],
+ pre_ops = [] :: [op()],
+ post_ops = [] :: [op()],
+ options :: [option()]}).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Inserts, deletes and replaces Erlang compiler attributes.
@@ -59,6 +59,20 @@
%% due to that the pre_transform pass did not find the attribute plus
%% all insert operations.
+-type attribute() :: atom().
+-type value() :: term().
+-type form() :: {function, integer(), atom(), arity(), _}
+ | {attribute, integer(), attribute(), _}.
+-type option() :: compile:option()
+ | {'attribute', 'insert', attribute(), value()}
+ | {'attribute', 'replace', attribute(), value()}
+ | {'attribute', 'delete', attribute()}.
+-type op() :: {'insert', attribute(), value()}
+ | {'replace', attribute(), value()}
+ | {'delete', attribute()}.
+
+-spec parse_transform([form()], [option()]) -> [form()].
+
parse_transform(Forms, Options) ->
S = #state{forms = Forms, options = Options},
S2 = init_transform(Options, S),