|
1 | 1 | %% Elixir compiler front-end to the Erlang backend.
|
2 | 2 | -module(elixir_compiler).
|
3 |
| --export([string/3, quoted/3, bootstrap/0, file/2, compile/3]). |
| 3 | +-export([string/3, quoted/3, bootstrap/0, file/2, compile/4]). |
4 | 4 | -include("elixir.hrl").
|
5 | 5 |
|
6 | 6 | string(Contents, File, Callback) ->
|
@@ -36,30 +36,30 @@ maybe_fast_compile(Forms, Args, E) ->
|
36 | 36 | case (?key(E, module) == nil) andalso allows_fast_compilation(Forms) andalso
|
37 | 37 | (not elixir_config:is_bootstrap()) of
|
38 | 38 | true -> fast_compile(Forms, E);
|
39 |
| - false -> compile(Forms, Args, E) |
| 39 | + false -> compile(Forms, Args, [], E) |
40 | 40 | end,
|
41 | 41 | ok.
|
42 | 42 |
|
43 |
| -compile(Quoted, ArgsList, #{line := Line} = E) -> |
| 43 | +compile(Quoted, ArgsList, CompilerOpts, #{line := Line} = E) -> |
44 | 44 | Block = no_tail_optimize([{line, Line}], Quoted),
|
45 | 45 | {Expanded, SE, EE} = elixir_expand:expand(Block, elixir_env:env_to_ex(E), E),
|
46 | 46 | elixir_env:check_unused_vars(SE, EE),
|
47 | 47 |
|
48 | 48 | {Module, Fun, Purgeable} =
|
49 |
| - elixir_erl_compiler:spawn(fun() -> spawned_compile(Expanded, E) end), |
| 49 | + elixir_erl_compiler:spawn(fun() -> spawned_compile(Expanded, CompilerOpts, E) end), |
50 | 50 |
|
51 | 51 | Args = list_to_tuple(ArgsList),
|
52 | 52 | {dispatch(Module, Fun, Args, Purgeable), SE, EE}.
|
53 | 53 |
|
54 |
| -spawned_compile(ExExprs, #{line := Line, file := File} = E) -> |
| 54 | +spawned_compile(ExExprs, CompilerOpts, #{line := Line, file := File} = E) -> |
55 | 55 | {Vars, S} = elixir_erl_var:from_env(E),
|
56 | 56 | {ErlExprs, _} = elixir_erl_pass:translate(ExExprs, erl_anno:new(Line), S),
|
57 | 57 |
|
58 | 58 | Module = retrieve_compiler_module(),
|
59 | 59 | Fun = code_fun(?key(E, module)),
|
60 | 60 | Forms = code_mod(Fun, ErlExprs, Line, File, Module, Vars),
|
61 | 61 |
|
62 |
| - {Module, Binary} = elixir_erl_compiler:noenv_forms(Forms, File, [nowarn_nomatch, no_bool_opt, no_ssa_opt]), |
| 62 | + {Module, Binary} = elixir_erl_compiler:noenv_forms(Forms, File, [nowarn_nomatch | CompilerOpts]), |
63 | 63 | code:load_binary(Module, "", Binary),
|
64 | 64 | {Module, Fun, is_purgeable(Module, Binary)}.
|
65 | 65 |
|
|
0 commit comments