Source
pub fn switchCaseOne(tree: Ast, node: Node.Index) full.SwitchCase {
const first_value, const target_expr = tree.nodeData(node).opt_node_and_node;
return tree.fullSwitchCaseComponents(.{
.values = if (first_value == .none)
&.{}
else
// Ensure that the returned slice points into the existing memory of the Ast
(@as(*const Node.Index, @ptrCast(&tree.nodes.items(.data)[@intFromEnum(node)].opt_node_and_node[0])))[0..1],
.arrow_token = tree.nodeMainToken(node),
.target_expr = target_expr,
}, node);
}