Commit Graph
81 Commits
Author SHA1 Message Date
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
José Valim 4e651c8aae Expand aliases inside quote 2013-01-11 09:55:38 +01:00
José Valim eaa9714b3a Improve hygiene for variables, related to #722 2013-01-10 14:29:45 +01:00
José Valim 305ad0b9c0 Support else clauses on try 2012-12-16 22:03:49 +01:00
José Valim 5d27b21ca8 Bump to 0.7.3.dev and get rid of deprecations 2012-12-05 09:46:07 +01:00
José Valim c06a44c2fd Add Macro.extract_args, closes #677 2012-12-02 16:10:46 +01:00
Yurii Rashkovskii e174cbfbfe Add function(Module.fun/arity) and function(fun/arity) syntax
These are equivalent to function(Module, :fun, arity) and function(:fun, arity) constructs, respectively
2012-11-27 01:35:06 -08:00
José Valim 05e694f7e2 Improvements to Regex and String 2012-11-24 21:56:58 +01:00
José Valim caa50368a7 Check if the first aliases argument is indeed an alias atom 2012-11-02 10:15:19 +01:00
José Valim a144d27886 Warn that function definitions should start with lowercase characters or underscore, closes #620 2012-11-02 10:05:17 +01:00