Previously, imports and requires were always added as
compile-time dependencies. With this change, they are
"export" dependencies, which are dependencies that depend
on the API defined by a module, such as struct and its
public definitions.
This change should drastically remove the amount of
modules recompiled in Elixir, making imports more feasible
for large projects.
Mix stores the compile_env in each applications' .app file.
Releases and Mix tasks were also changed to validate against
the runtime configuration against any stored `compile_env`.
In case of mismatches, an error is raised during boot.
Currently the callbacks on :elixir_compiler are called before the warnings of unused aliases and imports are emitted, causing the messages to not consumed during the compilation. This commit changes `:elixir_lexical.run/2` to `:elixir_lexical.run/3` splitting the callback in two, one during the execution to evaluate the forms and another to be called after all the warnings are emitted.
Fixes#9440
This feature allows IDEs and other tools wanting to
perform source code analysis to do so reliably without
a need to reimplement Elixir's compiler expansion and
without relying on Elixir's private APIs.
This commit also adds :parser_options to compiler
options, which allows developers to combine both options
to retrieve more accurate information, such as columns.
This is a first step to limiting recompilations in case a struct is used in a
module, the "parent module" of the struct changes, but struct definition itself
does not change.
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Aliases should not mark nodes as compile or runtime
since it receives the alias to be expanded. The
expanded alias is always called later though as a
remote dispatch.
Imports should always mark nodes as compile time,
since they are compile time dependencies.
Finally, ensure compile nodes have higher priority
over runtime ones.
If we are compiling the module, we will load it with the
output of its beam file. If the module exists only in
memory, :code.which/1 will return `:in_memory`.
Closes#2533