Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get rid of unused compilation mode

  • Loading branch information...
commit fc03c8b43d70d5b5779ddf055cd805115880236b 1 parent b32f6ef
José Valim josevalim authored
Showing with 3 additions and 26 deletions.
  1. +3 −26 lib/elixir/src/elixir_compiler.erl
29 lib/elixir/src/elixir_compiler.erl
View
@@ -27,7 +27,7 @@ string(Contents, File) when is_list(Contents), is_binary(File) ->
try
put(elixir_compiled, []),
Forms = elixir_translator:'forms!'(Contents, 1, File, []),
- eval_forms(Forms, 1, File, [], elixir:scope_for_eval([{file,File}])),
+ eval_forms(Forms, 1, [], elixir:scope_for_eval([{file,File}])),
lists:reverse(get(elixir_compiled))
after
put(elixir_compiled, Previous)
@@ -49,24 +49,7 @@ file_to_path(File, Path) when is_binary(File), is_binary(Path) ->
%% Evaluates the contents/forms by compiling them to an Erlang module.
-eval_forms(Forms, Line, Vars, #elixir_scope{module=nil} = S) ->
- eval_forms(Forms, Line, nil, Vars, S);
-
-eval_forms(Forms, Line, Vars, #elixir_scope{module=Value} = S) ->
- eval_forms(Forms, Line, Value, Vars, S).
-
-eval_forms(Forms, Line, Value, Vars, S) ->
- case (Value == nil) andalso allows_fast_compilation(Forms) of
- true -> eval_compilation(Forms, Vars, S);
- false -> code_loading_compilation(Forms, Line, Value, Vars, S)
- end.
-
-eval_compilation(Forms, Vars, S) ->
- Binding = [{ { Var, Kind }, Value } || { _, Kind, Var, Value } <- Vars],
- { Result, _Binding, FS } = elixir:eval_forms(Forms, [{'_@MODULE',nil}|Binding], S),
- { Result, FS }.
-
-code_loading_compilation(Forms, Line, Value, Vars, S) ->
+eval_forms(Forms, Line, Vars, S) ->
{ Module, I } = retrieve_module_name(),
{ Exprs, FS } = elixir_translator:translate(Forms, S),
ModuleForm = module_form(Exprs, Line, S#elixir_scope.file, Module, Vars),
@@ -76,7 +59,7 @@ code_loading_compilation(Forms, Line, Value, Vars, S) ->
%% Pass { native, false } to speed up bootstrap
%% process when native is set to true
{ module(ModuleForm, S#elixir_scope.file, [{native,false}], true, fun(_, _) ->
- Res = Module:'BOOTSTRAP'(Value, Args),
+ Res = Module:'BOOTSTRAP'(S#elixir_scope.module, Args),
code:delete(Module),
case code:soft_purge(Module) of
true -> return_module_name(I);
@@ -142,12 +125,6 @@ module_form(Exprs, Line, File, Module, Vars) when
] }
].
-%% Fast compilation is available?
-
-allows_fast_compilation([{defmodule,_,_}|T]) -> allows_fast_compilation(T);
-allows_fast_compilation([]) -> true;
-allows_fast_compilation(_) -> false.
-
%% Generate module names from code server.
retrieve_module_name() ->
Please sign in to comment.
Something went wrong with that request. Please try again.