Commit Graph
31 Commits
Author SHA1 Message Date
José Valim 9a6db666a1 Do not make requires/imports compile-time dependencies
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.
2020-06-24 14:30:00 +02:00
José Valim 6055db482a Add start and stop events to compilation tracers, closes #9868 2020-03-02 14:36:19 +01:00
José Valim ba619b1c3e Add Application.compile_env/3 (#9628)
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.
2019-12-06 17:23:01 +01:00
Glauber Campinho 7dd86ec1f7 Execute callbacks on :elixir_compiler after all warnings are emitted (#9447)
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
2019-10-26 10:58:28 +02:00
José Valim 94b507841b Add struct keys to tracing on struct expansion 2019-09-01 09:52:18 -06:00
José Valim b08593b9d1 Add compiler tracing (#9247)
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.
2019-08-02 13:35:12 +02:00
Eric Meadows-Jönsson 1956e95808 Remove dispatch tracking in LexicalTracker (#9228) 2019-07-18 13:48:02 +02:00
José Valim e28931fdaa Pass tracker destination forward to dynamicly defined modules 2018-05-02 12:18:50 +02:00
Michał Muskała c95a877d38 Separate tracking structs from compile-time dependencies
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>
2017-10-31 14:24:48 +01:00
Glauber Campinho 82864d106b Add file information to the dispatches on the source manifests (#6954) 2017-10-21 11:53:06 +02:00
José Valim 579f93bcc7 Ensure elixir_erl:debug_info/4 does not require elixir running (#6401) 2017-07-29 17:27:05 +02:00
Eric Entin b15d641e42 Add mix xref --callers M.f/a (#4683) 2016-05-25 21:53:42 +02:00
Eric Entin 0395bac1c1 Warn for remote calls that cannot be resolved at compile time (#4639) 2016-05-22 11:20:45 +02:00
José Valim b38ace0a79 Tidy up LexicalTracker 2016-05-18 08:42:33 +02:00
Wojtek Mach 743e8c7ed1 Track {module, function, arity} imports and warn on unused ones
Example:

Say, there's following file:

    # example.exs
    import String, only: [upcase: 1, downcase: 1]
    import Enum

    IO.puts upcase("Hello")

Before this patch:

    # $ elixir example.exs
    # HELLO
    # warning.exs:2: warning: unused import Enum

After this patch:

    # $ elixir example.exs
    # HELLO
    # example.exs:1: warning: unused import String.downcase/1
    # example.exs:2: warning: unused import Enum
2016-02-28 19:53:02 +01:00
José Valim 80fd98f01a Streamline aliases and imports in lexical tracker
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.
2015-07-22 09:59:31 +02:00
José Valim 1fd72ba72f Reduce noise in lexical tracker output 2015-07-22 02:53:25 +02:00
José Valim d25d7046e5 Split compile and runtime in lexical tracker 2015-07-21 23:28:07 +02:00
José Valim 6cef8b4eb2 Do not show aliases and import warnings when code cannot compile 2015-01-24 11:47:34 +01:00
José Valim 150a8a1dcd Fix bootstrap issues 2014-12-23 22:26:04 +01:00
José Valim 79fb40ab6a Correctly follow code specs when loading binaries
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
2014-08-06 12:05:55 +02:00
José Valim f5bf9d9659 Do not call handle_file_warning directly 2014-07-08 19:03:22 +02:00
José Valim 1bd0ca6dea Return explicit :ok from more functions 2014-07-05 13:43:52 +02:00
José Valim 8e1f7fddca Always return ok from tracking functions 2014-07-05 13:21:59 +02:00
James Fish 39cd4a6594 Fix unmatched returns dialyzer warnings 2014-07-04 02:45:16 +01:00
José Valim 56f15d9f4e Do not add spaces after { and before }
This makes the source code consistent with the result
returned by inspect/2.
2014-04-21 19:06:35 +02:00
José Valim 254065d3c4 Clean up synax_error, asstions and merge mechanisms 2013-12-29 14:22:45 +01:00
José Valim ade26dedd8 Work on Elixir expressions rather than forms 2013-12-28 11:47:44 +01:00
José Valim d856e667b9 Add warnings for unused aliases 2013-11-01 16:03:12 +01:00
José Valim 5bd12f9cb9 Move lexical tracker to scope 2013-11-01 16:03:12 +01:00
José Valim 3c151d5357 Add Kernel.LexicalTracker 2013-11-01 16:03:12 +01:00