code: function addReturnNode(ast: Object): Object {
    const statements = ast.program.body;
    const lastStatement = statements[statements.length - 1];
    return statements
      .slice(0, -1)
      .concat(t.returnStatement(lastStatement.expression));
  }
docs: Given an AST, compute its last statement and replace it with a
  return statement.