code: function traverseToBlockStatement(node) {
  
    if (node === undefined || node === null) {
      return null;
    }
  
    if (node.type !== 'BlockStatement' && node.type !== 'Program') {
      return traverseToBlockStatement(node.parent);
    }
  
    return node;
  }
docs: TODO: refactor a lot of this code.