in packages/babel-plugin-idx/src/babel-plugin-idx.js [154:171]
function visitIdxCallExpression(path, state) {
const node = path.node;
checkIdxArguments(state.file, node);
const temp = path.scope.generateUidIdentifier('ref');
const replacement = makeChain(node.arguments[1].body, {
file: state.file,
input: node.arguments[0],
base: node.arguments[1].params[0],
temp,
});
path.replaceWith(replacement);
// Hoist to the top if it's an async method.
if (path.scope.path.isClassMethod({async: true})) {
path.scope.push({id: temp, _blockHoist: 3});
} else {
path.scope.push({id: temp});
}
}