Skip to content

Commit fc03c8b

Browse files
author
José Valim
committed
Get rid of unused compilation mode
1 parent b32f6ef commit fc03c8b

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

lib/elixir/src/elixir_compiler.erl

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ string(Contents, File) when is_list(Contents), is_binary(File) ->
2727
try
2828
put(elixir_compiled, []),
2929
Forms = elixir_translator:'forms!'(Contents, 1, File, []),
30-
eval_forms(Forms, 1, File, [], elixir:scope_for_eval([{file,File}])),
30+
eval_forms(Forms, 1, [], elixir:scope_for_eval([{file,File}])),
3131
lists:reverse(get(elixir_compiled))
3232
after
3333
put(elixir_compiled, Previous)
@@ -49,24 +49,7 @@ file_to_path(File, Path) when is_binary(File), is_binary(Path) ->
4949

5050
%% Evaluates the contents/forms by compiling them to an Erlang module.
5151

52-
eval_forms(Forms, Line, Vars, #elixir_scope{module=nil} = S) ->
53-
eval_forms(Forms, Line, nil, Vars, S);
54-
55-
eval_forms(Forms, Line, Vars, #elixir_scope{module=Value} = S) ->
56-
eval_forms(Forms, Line, Value, Vars, S).
57-
58-
eval_forms(Forms, Line, Value, Vars, S) ->
59-
case (Value == nil) andalso allows_fast_compilation(Forms) of
60-
true -> eval_compilation(Forms, Vars, S);
61-
false -> code_loading_compilation(Forms, Line, Value, Vars, S)
62-
end.
63-
64-
eval_compilation(Forms, Vars, S) ->
65-
Binding = [{ { Var, Kind }, Value } || { _, Kind, Var, Value } <- Vars],
66-
{ Result, _Binding, FS } = elixir:eval_forms(Forms, [{'_@MODULE',nil}|Binding], S),
67-
{ Result, FS }.
68-
69-
code_loading_compilation(Forms, Line, Value, Vars, S) ->
52+
eval_forms(Forms, Line, Vars, S) ->
7053
{ Module, I } = retrieve_module_name(),
7154
{ Exprs, FS } = elixir_translator:translate(Forms, S),
7255
ModuleForm = module_form(Exprs, Line, S#elixir_scope.file, Module, Vars),
@@ -76,7 +59,7 @@ code_loading_compilation(Forms, Line, Value, Vars, S) ->
7659
%% Pass { native, false } to speed up bootstrap
7760
%% process when native is set to true
7861
{ module(ModuleForm, S#elixir_scope.file, [{native,false}], true, fun(_, _) ->
79-
Res = Module:'BOOTSTRAP'(Value, Args),
62+
Res = Module:'BOOTSTRAP'(S#elixir_scope.module, Args),
8063
code:delete(Module),
8164
case code:soft_purge(Module) of
8265
true -> return_module_name(I);
@@ -142,12 +125,6 @@ module_form(Exprs, Line, File, Module, Vars) when
142125
] }
143126
].
144127

145-
%% Fast compilation is available?
146-
147-
allows_fast_compilation([{defmodule,_,_}|T]) -> allows_fast_compilation(T);
148-
allows_fast_compilation([]) -> true;
149-
allows_fast_compilation(_) -> false.
150-
151128
%% Generate module names from code server.
152129

153130
retrieve_module_name() ->

0 commit comments

Comments
 (0)