Commit Graph
1655 Commits
Author SHA1 Message Date
Nikola Jichev f963013036 Add Function module for introspecting functions (#7503)
Reason to add it is capturing functions when passing in module name,
function name and arity using variable, because the capture operator
can't handle them.

Done by delegating to `:erlang.make_fun(mod, f, arity)`, also exposed
some erlang functions for getting information for a function.
2018-03-28 11:52:00 +02:00
Andrea Leopardi ae6fb479b5 Remove a useless guard in elixir_tokenizer 2018-03-27 12:32:42 +02:00
Glauber Campinho 0757cf8028 Optimize tokenizer for commas (#7493)
Small optimization skipping the `handle_terminator` function
for commas since they don't require terminators.
2018-03-26 22:31:58 +02:00
José Valim 09e25a75d0 Support specsdiff __info__ spec clauses, closes #7460 (#7461) 2018-03-26 16:04:20 +02:00
José Valim cf6e610afe Avoid multiple check calls in remote 2018-03-25 22:28:12 +02:00
Glauber Campinho a4ed1c93f9 Improve error messages for lists concatenation operator (#7487) 2018-03-25 22:20:58 +02:00
Glauber Campinho 4923b8708f Improve error message for invalid clauses inside local functions (#7484) 2018-03-25 12:52:14 +02:00
Glauber Campinho add3a9666f Fix column count on heredoc tokenizer (#7486) 2018-03-25 12:37:15 +02:00
Michał Muskała 946455ec42 Validate @compile attribute in elixir (#7476)
* error on undefined inlined functions
* warn on parse transforms
2018-03-25 09:52:36 +02:00
José Valim ac1af198c8 Move accumulate attributes to a separate table (#7472)
We also speed up reading and writing of attributes via the @ macro.
2018-03-21 17:13:43 +01:00
José Valim a5a8ad3eaa Refactor how typespecs docs are stored 2018-03-20 18:03:02 +01:00
José Valim 0ce9ea6188 Keep specs, types and callbacks in the bag table
This avoids copying typespecs in and out of the table
every time there is a new entry.

We also make sure the Protocol module is only relying
on public APIs and not on inner typespec behaviour.
2018-03-20 18:03:02 +01:00
José Valim d297fe5195 Avoid full table traversals when building "deprecated" and "docs" chunk 2018-03-20 18:03:02 +01:00
José Valim eb2418d4b1 Remove locals tracker table
Instead we use the bag and set tables accordingly.
2018-03-20 18:03:02 +01:00
José Valim 8c85557346 Share Bag and Set tables across a module functionality
Previously we kept a Set table for attributes and a Bag table
for function definitions and clauses. This led to suboptimal
usage of ets tables.

With this commit, we start using both Bag and Set tables
to store function/macro definition information. In the next
commits we will continue generalizing the tables, storing
specs, docs and accumulated attributes in the Bag and keep
the remaining functionality in Set.
2018-03-20 10:30:37 +01:00
José Valim 141c327685 Ensure bitstring comprehensions work on OTP 20.3 (#7453)
Closes #7452
2018-03-14 21:45:13 +01:00
Andrea Leopardi bf956e2afb Extract some functionality from elixir_erl to Kernel.Typespec (#7436) 2018-03-10 12:04:13 +01:00
Andrea Leopardi 875ce67673 Implement check for @spec attributes for undefined functions (#7431) 2018-03-09 11:31:15 +01:00
Andrea Leopardi 2dee728a3e Add a "erl_lint" check for behaviour_info/1 plus callback attributes (#7422)
Part of #5800.
2018-03-07 22:48:53 +01:00
Aleksei Magusev fa1191be8a Handle nested bitstring pattern matching failures in a better way (#7370) 2018-02-20 23:43:14 +01:00
Andrea Leopardi f30b29aca1 Prevent operators with many of same char to have same char after them (#7344) 2018-02-14 09:43:55 +01:00
José Valim f416a685fb Deprecate outdated Registry.start_link/2 2018-02-12 10:48:00 +01:00
José Valim 179566d9f3 Simplify key check in map match 2018-02-10 21:13:52 +01:00
José Valim b8bf33beff Bring add_doc/6 back, closes #7335 2018-02-10 11:07:19 +01:00
José Valim 7e0acd983a Consistently raise for missing do option in definitions
Closes #7333.
2018-02-09 17:05:59 +01:00
José Valim cf7f2e493c Restart contextual vars on function definitions 2018-02-03 23:21:30 -02:00
Michał Muskała 77c9d4872d Use contextual vars for __CALLER__ (#7309) 2018-02-03 23:10:40 -02:00
Michał Muskała 097de7d308 Introduce __STACKTRACE__ (#7134) 2018-02-03 14:09:47 -02:00
José Valim 84dcbbb4d1 Revert "Do not change argument evaluation semantics in bind_quoted (#7298)"
This reverts commit 7c142fbc86.

This causes a build failure on Erlang 19.
2018-02-03 10:57:40 -02:00
José Valim 7c142fbc86 Do not change argument evaluation semantics in bind_quoted (#7298) 2018-02-01 14:08:47 -02:00
José Valim 1d0ac1caac Do not warn for underscored var access from quoted contexts 2018-02-01 11:02:04 -02:00
Wojtek Mach d58b315d94 Improve struct comparison warning (#7284) 2018-01-30 22:03:06 -02:00
Michał Muskała 4ef61b81c2 Warn about comparison with calendar structs (#7274) 2018-01-30 11:41:43 -02:00
José Valim 4b134c8cf5 Raise on invalid map syntax, closes #7268 2018-01-28 11:04:25 -02:00
José Valim 00c7a3bc60 Merge binaries and bitstrings when possible 2018-01-25 15:40:44 -02:00
José Valim 83e6546f85 Perform merging of bitstring subinaries 2018-01-25 09:25:09 -02:00
José Valim e0dc8b0051 Use posix and raw when extracing stale sources in Mix
Thanks @michalmuskala for the suggestion.
2018-01-25 08:16:59 -02:00
José Valim 9ef646eed5 Support bitstrings in Collectable
Closes #7234
2018-01-21 13:25:11 +01:00
José Valim 054f9172fa Do not track @since attributes while bootstraping 2018-01-20 19:46:43 +01:00
José Valim 219c6cc867 Move unused_vars check to Elixir land
This gives us better control over when and how unused variables are printed.

As a result, we are able to emit unused variable warnings in situations
we could not before. This also opens up the way for us to remove a
dependency on erl_lint and track types information, which allows us to
speed up compilation times about 5% and allow us to emit more performant
code in some situations.
2018-01-20 19:45:48 +01:00
José Valim 1233a6f644 Optimize variable merging 2018-01-20 19:42:08 +01:00
José Valim 239db307a2 Merge match_vars and prematch_vars 2018-01-20 19:42:08 +01:00
José Valim f99bb7c0e5 Process variable versioning on Elixir pass 2018-01-20 19:42:08 +01:00
José Valim fd149eeb56 Remove file from elixir_erl record 2018-01-20 19:42:08 +01:00
José Valim 1ba04d15d8 Remove export_vars in elixir_erl record 2018-01-20 19:42:08 +01:00
José Valim 113d2c69c9 Remove export_vars from Macro.Env 2018-01-20 19:42:08 +01:00
José Valim 97ff1ed89f Clarify not in warnings 2018-01-19 11:28:18 +01:00
José Valim bfa3cfba19 Only rearrange not in if explicitly opted-in
Closes #7227.
2018-01-19 10:54:39 +01:00
José Valim 4175ddebd9 Do not allow stabs mixed with expressions 2018-01-16 12:23:12 +01:00
José Valim b9591267dc Replace Code.load_file/2 by Code.compile_file/2 (#7201)
Currently there is no way to compile a file without leaving
footprints on the system. Plus, the term load_file/2 is very
confusing as loaded is the notation used by modules.

This commit focuses the whole loaded aspect of files exclusively
on require_file/2 (and renames two functions accordingly) and
introduces compile_file/2 which is semantically simpler than
load_file/2.
2018-01-13 22:04:22 +01:00