charLiteral
Function parameters
Parameters
- gz:*GenZir
- node:Ast.Node.Index
Functions in this namespace
Functions
Source
Implementation
fn charLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zir.Inst.Ref {
const astgen = gz.astgen;
const tree = astgen.tree;
const main_token = tree.nodeMainToken(node);
const slice = tree.tokenSlice(main_token);
switch (std.zig.parseCharLiteral(slice)) {
.success => |codepoint| {
const result = try gz.addInt(codepoint);
return rvalue(gz, ri, result, node);
},
.failure => |err| return astgen.failWithStrLitError(err, main_token, slice, 0),
}
}