in packages/transform/src/emit.js [298:331]
Ep.getTryLocsList = function() {
if (this.tryEntries.length === 0) {
// To avoid adding a needless [] to the majority of runtime.wrap
// argument lists, force the caller to handle this case specially.
return null;
}
const t = util.getTypes();
let lastLocValue = 0;
return t.arrayExpression(
this.tryEntries.map(function(tryEntry) {
let thisLocValue = tryEntry.firstLoc.value;
assert.ok(thisLocValue >= lastLocValue, "try entries out of order");
lastLocValue = thisLocValue;
let ce = tryEntry.catchEntry;
let fe = tryEntry.finallyEntry;
let locs = [
tryEntry.firstLoc,
// The null here makes a hole in the array.
ce ? ce.firstLoc : null
];
if (fe) {
locs[2] = fe.firstLoc;
locs[3] = fe.afterLoc;
}
return t.arrayExpression(locs.map(loc => loc && t.clone(loc)));
})
);
};