in packages/flow-dev-tools/src/record/recordRunner.js [69:96]
function dfsForRange(node, line, col): ?[number, number] {
const todo = [];
if (typeof node === 'object' && node != null && node.hasOwnProperty('type')) {
if (node.type === 'CallExpression') {
if (node.callee.type === 'MemberExpression') {
if (
node.callee.property.loc.start.line === line &&
node.callee.property.loc.start.column === col - 1
) {
return [node.callee.property.range[0], node.range[1]];
}
}
}
for (var prop in node) {
todo.push(node[prop]);
}
} else if (Array.isArray(node)) {
todo.push(...node);
}
for (const child of todo) {
const ret = dfsForRange(child, line, col);
if (ret != null) {
return ret;
}
}
return null;
}