File 2916-compile-Simplify-module-name-handling-when-from_abst.patch of Package erlang
From b88096d83f17f8e0758de0e99893a5f7d7e5b5c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Sun, 7 Feb 2021 07:39:26 +0100
Subject: [PATCH 06/18] compile: Simplify module name handling when from_abstr
is given
---
lib/compiler/src/compile.erl | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 1a20497531..20fd0df6c7 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -611,7 +611,9 @@ pass(_) -> none.
%% proper diagnostics and for compilation to native code.
fix_first_pass([{consult_abstr, _} | Passes]) ->
- [?pass(get_module_name_from_abstr) | Passes];
+ %% Simply remove this pass. The module name will be set after
+ %% running the v3_core pass.
+ Passes;
fix_first_pass([{parse_core,_}|Passes]) ->
[?pass(get_module_name_from_core)|Passes];
fix_first_pass([{beam_consult_asm,_}|Passes]) ->
@@ -1048,15 +1050,6 @@ consult_abstr(_Code, St) ->
{error,St#compile{errors=St#compile.errors ++ Es}}
end.
-get_module_name_from_abstr(Forms, St) ->
- try get_module(Forms) of
- Mod -> {ok, Forms, St#compile{module = Mod}}
- catch
- _:_ ->
- %% Missing module declaration. Let it crash in a later pass.
- {ok, Forms, St}
- end.
-
parse_core(_Code, St) ->
case file:read_file(St#compile.ifile) of
{ok,Bin} ->
--
2.26.2