| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1× 107× 107× 107× 157× 157× 57× 100× 50× 50× 100× 50× 50× 1× | function remapBranch(genItem, getMapping) {
const locations = [];
let source;
for (let i = 0; i < genItem.locations.length; ++i) {
const mapping = getMapping(genItem.locations[i]);
if (!mapping) {
return null;
}
if (!source) {
source = mapping.source;
} else {
Iif (source !== mapping.source) {
return null;
}
}
locations.push(mapping.loc);
}
const srcItem = {
line: locations[0].start.line,
type: genItem.type,
locations,
};
return { source, srcItem };
}
module.exports = remapBranch;
|