for certain nodes that we invent we might not have a original source file to

map from, so just use "?".  and in any case, don't fail hard when addMapping throws.
This commit is contained in:
Mihai Bazon
2012-10-08 12:52:25 +03:00
parent fe1411bba1
commit 80a18fe2fa

View File

@@ -248,12 +248,23 @@ function OutputStream(options) {
}; };
var add_mapping = options.source_map ? function(token, name) { var add_mapping = options.source_map ? function(token, name) {
options.source_map.add( try {
token.file, if (token) options.source_map.add(
current_line, current_col, token.file || "?",
token.line, token.col, current_line, current_col,
(!name && token.type == "name") ? token.value : name token.line, token.col,
); (!name && token.type == "name") ? token.value : name
);
} catch(ex) {
AST_Node.warn("Couldn't figure out mapping for {file}:{line},{col} → {cline},{ccol} [{name}]", {
file: token.file,
line: token.line,
col: token.col,
cline: current_line,
ccol: current_col,
name: name || ""
})
}
} : noop; } : noop;
function get() { function get() {