aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/v3_kernel.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-05-12 11:53:23 +0000
committerErlang/OTP <[email protected]>2010-05-12 11:53:23 +0000
commit653c401730ffa4c00fc08d8a4702aea00ed34d76 (patch)
tree8b35059bbc2643858b0923a6ce8e44768a53e4dd /lib/compiler/src/v3_kernel.erl
parentb5295964210011f0918a02807799426f3d2300a3 (diff)
parent36ad0688fd0c9125717fa5c3e6aa46c7040956dd (diff)
downloadotp-653c401730ffa4c00fc08d8a4702aea00ed34d76.tar.gz
otp-653c401730ffa4c00fc08d8a4702aea00ed34d76.tar.bz2
otp-653c401730ffa4c00fc08d8a4702aea00ed34d76.zip
Merge branch 'bg/compiler-attributes' into dev
* bg/compiler-attributes: Remove opaque declarations from the attributes
Diffstat (limited to 'lib/compiler/src/v3_kernel.erl')
-rw-r--r--lib/compiler/src/v3_kernel.erl19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl
index 974c64a8bc..fbe4d8617e 100644
--- a/lib/compiler/src/v3_kernel.erl
+++ b/lib/compiler/src/v3_kernel.erl
@@ -128,14 +128,27 @@ copy_anno(Kdst, Ksrc) ->
{'ok', #k_mdef{}, [warning()]}.
module(#c_module{anno=A,name=M,exports=Es,attrs=As,defs=Fs}, _Options) ->
+ Kas = attributes(As),
+ Kes = map(fun (#c_var{name={_,_}=Fname}) -> Fname end, Es),
St0 = #kern{lit=dict:new()},
{Kfs,St} = mapfoldl(fun function/2, St0, Fs),
- Kes = map(fun (#c_var{name={_,_}=Fname}) -> Fname end, Es),
- Kas = map(fun ({#c_literal{val=N},V}) ->
- {N,core_lib:literal_value(V)} end, As),
{ok,#k_mdef{anno=A,name=M#c_literal.val,exports=Kes,attributes=Kas,
body=Kfs ++ St#kern.funs},lists:sort(St#kern.ws)}.
+attributes([{#c_literal{val=Name},Val}|As]) ->
+ case include_attribute(Name) of
+ false ->
+ attributes(As);
+ true ->
+ [{Name,core_lib:literal_value(Val)}|attributes(As)]
+ end;
+attributes([]) -> [].
+
+include_attribute(type) -> false;
+include_attribute(spec) -> false;
+include_attribute(opaque) -> false;
+include_attribute(_) -> true.
+
function({#c_var{name={F,Arity}=FA},Body}, St0) ->
try
St1 = St0#kern{func=FA,ff=undefined,vcount=0,fcount=0,ds=sets:new()},