aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-10-08 07:50:29 +0200
committerJohn Högberg <[email protected]>2018-10-08 07:50:29 +0200
commite2a1ec914d9bec9f9310669df877601eed2f808d (patch)
tree287508f59246146dceb080060a5b120f97c4cf2c /lib/compiler/src/compile.erl
parent3ea2ff5697d1ee53a31d7f0530692f49e9d0c516 (diff)
parent4312fba6cf15a41b7331c2309104dd82f29be9d6 (diff)
downloadotp-e2a1ec914d9bec9f9310669df877601eed2f808d.tar.gz
otp-e2a1ec914d9bec9f9310669df877601eed2f808d.tar.bz2
otp-e2a1ec914d9bec9f9310669df877601eed2f808d.zip
Merge branch 'maint'
* maint: compiler: Forward +source flag to epp and fix bug in +deterministic epp: Allow user to set source name independently of input file name
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index a11dc691bc..27e6e8fe00 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -1012,11 +1012,17 @@ parse_module(_Code, St0) ->
end.
do_parse_module(DefEncoding, #compile{ifile=File,options=Opts,dir=Dir}=St) ->
+ SourceName0 = proplists:get_value(source, Opts, File),
+ SourceName = case member(deterministic, Opts) of
+ true -> filename:basename(SourceName0);
+ false -> SourceName0
+ end,
R = epp:parse_file(File,
- [{includes,[".",Dir|inc_paths(Opts)]},
- {macros,pre_defs(Opts)},
- {default_encoding,DefEncoding},
- extra]),
+ [{includes,[".",Dir|inc_paths(Opts)]},
+ {source_name, SourceName},
+ {macros,pre_defs(Opts)},
+ {default_encoding,DefEncoding},
+ extra]),
case R of
{ok,Forms,Extra} ->
Encoding = proplists:get_value(encoding, Extra),