aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/beam_lib.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-04-30 12:23:45 +0200
committerBjörn Gustavsson <[email protected]>2015-04-30 12:23:45 +0200
commita5c6199d194b47c4385083d5aca35807c50c1549 (patch)
treec7edf5193895d6252e3dbd61ee48746d0de2b942 /lib/stdlib/src/beam_lib.erl
parent147e8b9bd0b36315f0d8bd38e39c51d93cd9f509 (diff)
parenta1f9b09e47dfa56957c36b39d3d3e541c7cd9d19 (diff)
downloadotp-a5c6199d194b47c4385083d5aca35807c50c1549.tar.gz
otp-a5c6199d194b47c4385083d5aca35807c50c1549.tar.bz2
otp-a5c6199d194b47c4385083d5aca35807c50c1549.zip
Merge branch 'hb/line_abstraction/OTP-12195'
* hb/line_abstraction/OTP-12195: (21 commits) Ensure that erl_anno is used when building the primary bootstrap erl_docgen: Use module erl_anno wx: Use module erl_anno diameter: Use module erl_anno dialyzer: Use module erl_anno eunit: Use module erl_anno hipe: Use module erl_anno edoc: Use module erl_anno syntax_tools: Use module erl_anno test_server: Use module erl_anno tools: Use module erl_anno parsetools: Use module erl_anno kernel: Use module erl_anno asn1: Use module erl_anno debugger: Use module erl_anno stdlib: Silence some of qlc's warnings stdlib: Use module erl_anno compiler: Use module erl_anno emulator: Use module erl_anno Update primary bootstrap ...
Diffstat (limited to 'lib/stdlib/src/beam_lib.erl')
-rw-r--r--lib/stdlib/src/beam_lib.erl27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl
index 1a7b7d5a5e..4a6b489204 100644
--- a/lib/stdlib/src/beam_lib.erl
+++ b/lib/stdlib/src/beam_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2000-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -652,7 +652,13 @@ chunk_to_data(abstract_code=Id, Chunk, File, _Cs, AtomTable, Mod) ->
{'EXIT', _} ->
error({invalid_chunk, File, chunk_name_to_id(Id, File)});
Term ->
- {AtomTable, {Id, Term}}
+ try
+ {AtomTable, {Id, anno_from_term(Term)}}
+ catch
+ _:_ ->
+ error({invalid_chunk, File,
+ chunk_name_to_id(Id, File)})
+ end
end
end;
chunk_to_data(atoms=Id, _Chunk, _File, Cs, AtomTable0, _Mod) ->
@@ -878,7 +884,22 @@ decrypt_abst(Type, Module, File, Id, AtomTable, Bin) ->
decrypt_abst_1({Type,Key,IVec,_BlockSize}, Bin) ->
ok = start_crypto(),
NewBin = crypto:block_decrypt(Type, Key, IVec, Bin),
- binary_to_term(NewBin).
+ Term = binary_to_term(NewBin),
+ anno_from_term(Term).
+
+anno_from_term({raw_abstract_v1, Forms}) ->
+ {raw_abstract_v1, anno_from_forms(Forms)};
+anno_from_term({Tag, Forms}) when Tag =:= abstract_v1; Tag =:= abstract_v2 ->
+ try {Tag, anno_from_forms(Forms)}
+ catch
+ _:_ ->
+ {Tag, Forms}
+ end;
+anno_from_term(T) ->
+ T.
+
+anno_from_forms(Forms) ->
+ [erl_parse:anno_from_term(Form) || Form <- Forms].
start_crypto() ->
case crypto:start() of