@@ -118,92 +118,10 @@ get_core_from_beam(File, Opts) ->
118
118
{error , " Could not get Core Erlang code for: " ++ File ++ " \n " }
119
119
end ;
120
120
_ ->
121
- deprecated_get_core_from_beam (File , Opts )
121
+ {error , " Could not get Core Erlang code for: " ++ File ++ " \n " ++
122
+ " Recompile with +debug_info or analyze starting from source code" }
122
123
end .
123
124
124
- deprecated_get_core_from_beam (File , Opts ) ->
125
- case get_abstract_code_from_beam (File ) of
126
- error ->
127
- {error , " Could not get abstract code for: " ++ File ++ " \n " ++
128
- " Recompile with +debug_info or analyze starting from source code" };
129
- {ok , AbstrCode } ->
130
- case get_compile_options_from_beam (File ) of
131
- error ->
132
- {error , " Could not get compile options for: " ++ File ++ " \n " ++
133
- " Recompile or analyze starting from source code" };
134
- {ok , CompOpts } ->
135
- case get_core_from_abstract_code (AbstrCode , Opts ++ CompOpts ) of
136
- error ->
137
- {error , " Could not get core Erlang code for: " ++ File };
138
- {ok , _ } = Core ->
139
- Core
140
- end
141
- end
142
- end .
143
-
144
- get_abstract_code_from_beam (File ) ->
145
- case beam_lib :chunks (File , [abstract_code ]) of
146
- {ok , {_ , List }} ->
147
- case lists :keyfind (abstract_code , 1 , List ) of
148
- {abstract_code , {raw_abstract_v1 , Abstr }} -> {ok , Abstr };
149
- _ -> error
150
- end ;
151
- _ ->
152
- % % No or unsuitable abstract code.
153
- error
154
- end .
155
-
156
- get_compile_options_from_beam (File ) ->
157
- case beam_lib :chunks (File , [compile_info ]) of
158
- {ok , {_ , List }} ->
159
- case lists :keyfind (compile_info , 1 , List ) of
160
- {compile_info , CompInfo } -> compile_info_to_options (CompInfo );
161
- _ -> error
162
- end ;
163
- _ ->
164
- % % No or unsuitable compile info.
165
- error
166
- end .
167
-
168
- compile_info_to_options (CompInfo ) ->
169
- case lists :keyfind (options , 1 , CompInfo ) of
170
- {options , CompOpts } -> {ok , CompOpts };
171
- _ -> error
172
- end .
173
-
174
- get_core_from_abstract_code (AbstrCode , Opts ) ->
175
- % % We do not want the parse_transforms around since we already
176
- % % performed them. In some cases we end up in trouble when
177
- % % performing them again.
178
- AbstrCode1 = cleanup_parse_transforms (AbstrCode ),
179
- % % Remove parse_transforms (and other options) from compile options.
180
- Opts2 = cleanup_compile_options (Opts ),
181
- try compile :noenv_forms (AbstrCode1 , Opts2 ++ src_compiler_opts ()) of
182
- {ok , _ , Core } -> {ok , Core };
183
- _What -> error
184
- catch
185
- error :_ -> error
186
- end .
187
-
188
- cleanup_parse_transforms ([{attribute , _ , compile , {parse_transform , _ }}|Left ]) ->
189
- cleanup_parse_transforms (Left );
190
- cleanup_parse_transforms ([Other |Left ]) ->
191
- [Other |cleanup_parse_transforms (Left )];
192
- cleanup_parse_transforms ([]) ->
193
- [].
194
-
195
- cleanup_compile_options (Opts ) ->
196
- lists :filter (fun keep_compile_option /1 , Opts ).
197
-
198
- % % Using abstract, not asm or core.
199
- keep_compile_option (from_asm ) -> false ;
200
- keep_compile_option (from_core ) -> false ;
201
- % % The parse transform will already have been applied, may cause
202
- % % problems if it is re-applied.
203
- keep_compile_option ({parse_transform , _ }) -> false ;
204
- keep_compile_option (warnings_as_errors ) -> false ;
205
- keep_compile_option (_ ) -> true .
206
-
207
125
% % ============================================================================
208
126
% %
209
127
% % Typed Records
0 commit comments