Function structInit [src]
Prototype
pub fn structInit(tree: Ast, node: Node.Index) full.StructInit
Parameters
tree: Ast
node: Node.Index
Source
pub fn structInit(tree: Ast, node: Node.Index) full.StructInit {
assert(tree.nodeTag(node) == .struct_init or
tree.nodeTag(node) == .struct_init_comma);
const type_expr, const extra_index = tree.nodeData(node).node_and_extra;
const fields = tree.extraDataSlice(tree.extraData(extra_index, Node.SubRange), Node.Index);
return .{
.ast = .{
.lbrace = tree.nodeMainToken(node),
.fields = fields,
.type_expr = type_expr.toOptional(),
},
};
}