@@ -159,7 +159,7 @@ compile(Meta, Module, ModuleAsCharlist, Block, Vars, Prune, E) ->
159
159
put_compiler_modules ([Module | CompilerModules ]),
160
160
{Result , ModuleE , CallbackE } = eval_form (Line , Module , DataBag , Block , Vars , Prune , E ),
161
161
CheckerInfo = checker_info (),
162
- { BeamLocation , Forceload } = beam_location (ModuleAsCharlist ),
162
+ BeamLocation = beam_location (ModuleAsCharlist ),
163
163
164
164
{Binary , PersistedAttributes , Autoload } =
165
165
elixir_erl_compiler :spawn (fun () ->
@@ -219,7 +219,7 @@ compile(Meta, Module, ModuleAsCharlist, Block, Vars, Prune, E) ->
219
219
220
220
compile_error_if_tainted (DataSet , E ),
221
221
Binary = elixir_erl :compile (ModuleMap ),
222
- Autoload = Forceload or proplists :get_value (autoload , CompileOpts , false ),
222
+ Autoload = proplists :get_value (autoload , CompileOpts , false ) or load_module ( Module ),
223
223
spawn_parallel_checker (CheckerInfo , Module , ModuleMap , BeamLocation ),
224
224
{Binary , PersistedAttributes , Autoload }
225
225
end ),
@@ -550,12 +550,10 @@ bag_lookup_element(Table, Name, Pos) ->
550
550
551
551
beam_location (ModuleAsCharlist ) ->
552
552
case get (elixir_compiler_dest ) of
553
- {Dest , ForceLoad } when is_binary (Dest ) ->
554
- BeamLocation =
555
- filename :join (elixir_utils :characters_to_list (Dest ), ModuleAsCharlist ++ " .beam" ),
556
- {BeamLocation , ForceLoad };
553
+ Dest when is_binary (Dest ) ->
554
+ filename :join (elixir_utils :characters_to_list (Dest ), ModuleAsCharlist ++ " .beam" );
557
555
_ ->
558
- { " " , true }
556
+ " "
559
557
end .
560
558
561
559
% % Integration with elixir_compiler that makes the module available
@@ -593,6 +591,16 @@ make_module_available(Module, Binary, Loaded) ->
593
591
receive {Ref , ack } -> ok end
594
592
end .
595
593
594
+ load_module (Module ) ->
595
+ case get (elixir_compiler_info ) of
596
+ undefined ->
597
+ true ;
598
+ {PID , _ } ->
599
+ Ref = make_ref (),
600
+ PID ! {'load_module?' , self (), Ref , Module },
601
+ receive {Ref , Boolean } -> Boolean end
602
+ end .
603
+
596
604
% % Error handling and helpers.
597
605
598
606
% % We've reached the elixir_module or eval internals, skip it with the rest
0 commit comments