addFieldAccess
Function parameters
Parameters
- tag:Zir.Inst.Tag
- gz:*GenZir
- scope:*Scope
- node:Ast.Node.Index
Functions in this namespace
Functions
Source
Implementation
fn addFieldAccess(
tag: Zir.Inst.Tag,
gz: *GenZir,
scope: *Scope,
lhs_ri: ResultInfo,
node: Ast.Node.Index,
) InnerError!Zir.Inst.Ref {
const astgen = gz.astgen;
const tree = astgen.tree;
const object_node, const field_ident = tree.nodeData(node).node_and_token;
const str_index = try astgen.identAsString(field_ident);
const lhs = try expr(gz, scope, lhs_ri, object_node);
const cursor = maybeAdvanceSourceCursorToMainToken(gz, node);
try emitDbgStmt(gz, cursor);
return gz.addPlNode(tag, node, Zir.Inst.Field{
.lhs = lhs,
.field_name_start = str_index,
});
}