diff options
author | James Fish <james@fishcakez.com> | 2014-04-27 13:49:35 +0100 |
---|---|---|
committer | James Fish <james@fishcakez.com> | 2014-04-27 13:49:35 +0100 |
commit | 29e0fadec143ec0123bf550656e19bd6be1d78b2 (patch) | |
tree | 552a9d030cd0d60cfea166b1b9f13f4407dff666 /lib | |
parent | a4b6770174f34875384116cf18fb8e55105dd576 (diff) | |
download | elixir-29e0fadec143ec0123bf550656e19bd6be1d78b2.tar.gz |
Fix compiler abstract code
Previously the source filename of a module was sometimes a binary, this
change ensures it is always an erlang string.
Previously dialyzer did not know not to auto import bifs as it does not
read the compile options from a beam. This change uses an attribute in
the abstract code rather than a compile option so that dialyzer does not
auto import bifs.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/elixir/src/elixir_compiler.erl | 5 | ||||
-rw-r--r-- | lib/elixir/src/elixir_utils.erl | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/elixir/src/elixir_compiler.erl b/lib/elixir/src/elixir_compiler.erl index 21ae4a05c..250afbcc1 100644 --- a/lib/elixir/src/elixir_compiler.erl +++ b/lib/elixir/src/elixir_compiler.erl @@ -140,7 +140,7 @@ module(Forms, File, RawOptions, Bootstrap, Callback) when Options = RawOptions ++ elixir_code_server:call(erl_compiler_options), Listname = elixir_utils:characters_to_list(File), - case compile:noenv_forms(Forms, [no_auto_import,return,{source,Listname}|Options]) of + case compile:noenv_forms([no_auto_import()|Forms], [return,{source,Listname}|Options]) of {ok, ModuleName, Binary, Warnings} -> format_warnings(Bootstrap, Warnings), code:load_binary(ModuleName, Listname, Binary), @@ -150,6 +150,9 @@ module(Forms, File, RawOptions, Bootstrap, Callback) when format_errors(Errors) end. +no_auto_import() -> + {attribute, 0, compile, no_auto_import}. + %% CORE HANDLING core() -> diff --git a/lib/elixir/src/elixir_utils.erl b/lib/elixir/src/elixir_utils.erl index 1b5d51221..20c331a9f 100644 --- a/lib/elixir/src/elixir_utils.erl +++ b/lib/elixir/src/elixir_utils.erl @@ -31,7 +31,7 @@ file_type(File, Op) -> relative_to_cwd(Path) -> case elixir_compiler:get_opt(internal) of true -> Path; - false -> 'Elixir.Path':relative_to_cwd(Path) + false -> 'Elixir.List':'from_char_data!'('Elixir.Path':relative_to_cwd(Path)) end. characters_to_list(Data) when is_list(Data) -> @@ -172,4 +172,4 @@ do_convert_to_boolean(Line, Expr, Bool, S) -> do_guarded_convert_to_boolean(Line, Expr, Op, Comp) -> Left = {op, Line, Comp, Expr, {atom, Line, false}}, Right = {op, Line, Comp, Expr, {atom, Line, nil}}, - {op, Line, Op, Left, Right}.
\ No newline at end of file + {op, Line, Op, Left, Right}. |