Commit Graph
90 Commits
Author SHA1 Message Date
José Valim db47bd56b4 Add Path.relative_to_cwd and rely on it when generating stacktraces 2013-08-14 12:36:54 +02:00
José Valim 03d2260776 Fix warnings and update CHANGELOG 2013-08-07 12:51:31 +02:00
José Valim d8393f97ca Remove deprecated code 2013-08-06 17:21:40 +02:00
José Valim 34b6e17a1b Fix shadowing warning in case with function, closes #1524 2013-08-02 13:04:03 +02:00
José Valim 6a68ca5eef Deprecate function/1 and function/3 2013-07-31 12:58:07 +02:00
José Valim b5428adda6 Add &local/arity and &Remote.fun/arity 2013-07-31 12:58:07 +02:00
José Valim ebb5500086 Clean up Elixir internal errors
In particular, we reserve SyntaxError for synatx errors (doh)
and for macros that expects a given format at compilation time.

For example, defmodule/2 expects a :do keyword in the second
argument, not providing one is a syntax error.

In other places we impose similar restrictions bue the values
are allowed to be any expression as long as the final result
at compilation time is a given expression, for example:

    when foo in @value

The right side of in can be anything as long it is a list or
a range at compilation time. Those kind of errors are now
CompileError.
2013-07-12 11:44:49 +02:00
José Valim 9754f056dd Improve error messages for in-erlang macros 2013-07-12 10:15:01 +02:00
José Valim 88ac1f6a7b Improve coverage for lexical scope on try and case 2013-07-09 14:24:57 +02:00
José Valim 15c1a9891c Implement bindings in Elixir 2013-07-04 10:18:46 +02:00
José Valim 447a57750f Simplify binding handling 2013-06-27 17:47:45 +02:00
José Valim 7e11cea780 Ensure binding(..., false) also works 2013-06-24 16:24:08 +02:00
José Valim c572cb80fc Support binding/2 that goes across all contexts 2013-06-19 14:17:45 +02:00
Andrzej Sliwa 8fa6c4f96f refactor/rename Macro.to_binary to Macro.to_string with deprecation warning 2013-06-18 23:35:13 +02:00
José Valim c4dac6fd7a Catch invalid arguments for binding/1 2013-06-18 16:29:12 +02:00
José Valim d3122ddcc5 Add binding/0 and binding/1 for retrieving bindings 2013-06-18 16:14:03 +02:00
José Valim 9904bdce9d Warn on undefined module attributes, closes #963 2013-06-18 12:19:15 +02:00
Eric Meadows-Jonsson 27000ea1b4 Emit warning for 'x in []' in guards 2013-06-18 11:57:27 +02:00
José Valim 67896b56c5 Ensure errors point to the proper -> clauses
This commit changes the -> clauses representation from:

    { :->, meta, list({ list(expr), expr }) }

To:

    { :->, meta, list({ list(expr), meta, expr }) }

Now clauses can store metadata, which allows us to provide
accurate reporting information.

Closes #1215
2013-06-16 17:27:14 +02:00
José Valim 7f5744bde7 Ensure defmodule :atom does not define an alias 2013-06-16 13:10:59 +02:00
José Valim a3aa1e8de5 Ensure noname scope does not leak after assignment 2013-06-03 00:24:14 +09:00
José Valim 2c98c0999d An Elixir module now translates to Elixir.Module instead of Elixir-Module 2013-05-23 14:36:56 +02:00
José Valim d9b98a62c8 Check if the module is in the same context before checking if it is open 2013-05-19 19:42:13 +02:00
José Valim 23cbf3e853 Support options from macros and @attributes in import, alias and require 2013-05-13 21:51:07 -06:00
José Valim baf5fcf096 Ensure nested modules are properly defined, closes #1057 2013-05-13 16:24:29 -06:00
José Valim e18c1602ba Only add quoted: true to required ast nodes 2013-05-13 15:56:15 -06:00
José Valim 32ae6d3424 Ensure imports respect the quote context 2013-05-13 15:56:15 -06:00
José Valim f38cf28cbd Store in the AST if contents come from a quoted expression
This provides a more robust way of checking from where
the original expressions are coming from compared to the
lexical check_clauses field we had in elixir_scope.

A direct consequence of this commit is that, the following
code:

    defrecord Sample, [:hello] do
      import List
    end

Now raises a warning if the List import is not used,
where it didn't previously.
2013-05-13 15:56:15 -06:00
José Valim 930be9d99f Improve function(some_macro/x) error message 2013-05-12 11:34:43 -06:00
José Valim 7bae0029f2 Automatically detect when to warn on import 2013-05-06 20:22:18 -06:00
José Valim 1019879bd0 Improve previous clause does not match warning
We have redefined the warning to say:

  "trying to override previously defined function NAME/ARITY"

We have also relaxed the rules that causes the warning to
emitted. For example, if any kind of meta-programming or
unquoting is detected in the function definition, we skip
the warning altogether.

Closes #934.
2013-05-04 14:59:15 -06:00
José Valim c14ee51d15 Refactor elixir_quote to work on Elixir expressions
This allows us to re-use the code from Macro.escape,
reducing the duplication, and gives us more visibility
into the transformation process.
2013-05-04 14:31:58 -06:00
Devin Torres 901fedf266 Liberate in, fixes #817 2013-05-03 16:12:30 -05:00
José Valim 70432ca7f2 Remove deprecations 2013-04-20 19:22:13 -06:00
José Valim 963efc4593 Do not import IEx.Helpers since we delegate to them, closes, closes #957 2013-04-16 12:04:29 -07:00
José Valim 531bd8da0c Ensure hygiene also works with directl calls to Kernel.function 2013-04-13 17:19:19 -07:00
José Valim 3f7b867740 Refactor elixir_dispatch to rely more on elixir_scope 2013-04-13 17:19:19 -07:00
José Valim f2e78d3d39 function(:is_atom, 1) is deprecated in favor of function(is_atom/1)
This is required so we can identity the proper function/arity
from quoting and properly hygienize function retrievals.
2013-04-13 17:19:19 -07:00
José Valim e412ce6b22 Can defined a nested module called Elixir, closes #858 2013-04-10 16:32:30 -07:00
José Valim e01f958b1a Allow match syntax on nested records, closes #871 2013-04-10 16:22:38 -07:00
José Valim 15ac6e947a Improve docs for function 2013-04-03 08:42:03 -06:00
José Valim f7cad1cffc Improve error messages 2013-03-27 09:54:00 -06:00
José Valim 2817b2ee90 Allow unquote in def*/2
This makes meta-programming in Elixir much easier and more friendly.
For example, here is how to convert a keywords argument into a bunch
of functions:

    Enum.each [foo: 1, bar: 2, baz: 3], fn { k, v } ->
      def unquote(k)(), do: unquote(v)
    end
2013-03-10 17:59:04 -06:00
José Valim 28211b2714 Ensure aliases expansion also works for implicit aliases 2013-02-03 21:57:39 -07:00
José Valim 109c07e757 Improve aliases hygiene by using metadata 2013-02-03 15:12:38 -07:00
José Valim 3537bbbbf4 Refactor aliases handling 2013-02-03 13:07:20 -07:00
José Valim 7196543060 Improve how aliases for defmodule are generated 2013-01-30 16:43:29 -07:00
José Valim 9a62a43340 Aliases for defmodule also works for raw atoms 2013-01-21 18:40:10 -07:00
José Valim 89cbe93bba The AST now allows metadata to be attached to each node
This means the second item in the AST is no longer an integer
(representing the line), but a keywords list. Code that relies
on the line information from AST or that manually generate AST
nodes need to be properly updated.
2013-01-21 15:42:03 -07:00
José Valim 449532e1fb Fix identation, improve error messages 2013-01-12 23:43:07 +01:00