Implement Module.eval_quoted in Elixir

This commit is contained in:
José Valim
2013-11-25 12:59:14 +01:00
parent 5c00882bff
commit 63fdbfb8cf
3 changed files with 11 additions and 20 deletions
+1 -18
View File
@@ -1,6 +1,6 @@
-module(elixir_module).
-export([compile/4, compile/5, data_table/1, docs_table/1,
eval_quoted/4, format_error/1, eval_callbacks/5]).
format_error/1, eval_callbacks/5]).
-include("elixir.hrl").
-define(acc_attr, '__acc_attributes').
@@ -9,23 +9,6 @@
-define(persisted_attr, '__persisted_attributes').
-define(overridable_attr, '__overridable').
eval_quoted(Module, Quoted, Binding, Opts) ->
Scope = scope_for_eval(Module, Opts),
elixir_def:reset_last(Module),
case lists:keyfind(line, 1, Opts) of
{ line, Line } -> Line;
false -> Line = 1
end,
{ Value, FinalBinding, _Scope } = elixir:eval_quoted([Quoted], Binding, Line, Scope),
{ Value, FinalBinding }.
scope_for_eval(Module, #elixir_scope{} = S) ->
S#elixir_scope{module=Module};
scope_for_eval(Module, Opts) ->
scope_for_eval(Module, elixir:scope_for_eval(Opts)).
%% TABLE METHODS
data_table(Module) ->