Don't search orig_maps if the source filename is unknown.
When the AST is not associated with a filename, only orig_map can be queried to get the original filename. If that wasn't provided, then the best we can do is add a mapping literally for "?"
This commit is contained in:
parent
87f31ed488
commit
e47ffc6e57
|
|
@ -303,7 +303,7 @@ function OutputStream(options) {
|
||||||
var add_mapping = options.source_map ? function(token, name) {
|
var add_mapping = options.source_map ? function(token, name) {
|
||||||
try {
|
try {
|
||||||
if (token) options.source_map.add(
|
if (token) options.source_map.add(
|
||||||
token.file || "?",
|
token.file,
|
||||||
current_line, current_col,
|
current_line, current_col,
|
||||||
token.line, token.col,
|
token.line, token.col,
|
||||||
(!name && token.type == "name") ? token.value : name
|
(!name && token.type == "name") ? token.value : name
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,14 @@ function SourceMap(options) {
|
||||||
orig_maps[consumer.file] = consumer;
|
orig_maps[consumer.file] = consumer;
|
||||||
}
|
}
|
||||||
function add(source, gen_line, gen_col, orig_line, orig_col, name) {
|
function add(source, gen_line, gen_col, orig_line, orig_col, name) {
|
||||||
var originalMap = orig_maps[source] || orig_map;
|
var originalMap;
|
||||||
|
if (source) {
|
||||||
|
originalMap = orig_maps[source] || orig_map;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
source = "?";
|
||||||
|
originalMap = orig_map;
|
||||||
|
}
|
||||||
|
|
||||||
if (originalMap) {
|
if (originalMap) {
|
||||||
var info = originalMap.originalPositionFor({
|
var info = originalMap.originalPositionFor({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user