aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2012-03-23 14:53:15 +0100
committerHenrik Nord <[email protected]>2012-04-10 12:32:23 +0200
commit2d785c07fbf9f533bf4627a65315a51c3efc2113 (patch)
tree852ae25edd463ba52745c315372776af1fda4a2f /lib/compiler/src
parent5573888eea1ff6e3e169a6c873c2f5ada81eab62 (diff)
downloadotp-2d785c07fbf9f533bf4627a65315a51c3efc2113.tar.gz
otp-2d785c07fbf9f533bf4627a65315a51c3efc2113.tar.bz2
otp-2d785c07fbf9f533bf4627a65315a51c3efc2113.zip
Allow the source to be set when compiling forms
This commit adds a source option to compile:forms() that sets the source value returned by module_info(compile).
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/compile.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 9b505ad15c..7911f51a73 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -247,10 +247,12 @@ internal(Master, Input, Opts) ->
catch error:Reason -> {error, Reason}
end}.
-internal({forms,Forms}, Opts) ->
- {_,Ps} = passes(forms, Opts),
- internal_comp(Ps, "", "", #compile{code=Forms,options=Opts,
- mod_options=Opts});
+internal({forms,Forms}, Opts0) ->
+ {_,Ps} = passes(forms, Opts0),
+ Source = proplists:get_value(source, Opts0, ""),
+ Opts1 = proplists:delete(source, Opts0),
+ Compile = #compile{code=Forms,options=Opts1,mod_options=Opts1},
+ internal_comp(Ps, Source, "", Compile);
internal({file,File}, Opts) ->
{Ext,Ps} = passes(file, Opts),
Compile = #compile{options=Opts,mod_options=Opts},