Commit 69d18ad7f0

Andrew Kelley <andrew@ziglang.org>
2021-05-04 03:47:53
ZIR: typeof uses the un_node field not un_tok
1 parent 95b014c
Changed files (2)
src/Sema.zig
@@ -4614,7 +4614,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro
 }
 
 fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
-    const inst_data = sema.code.instructions.items(.data)[inst].un_tok;
+    const inst_data = sema.code.instructions.items(.data)[inst].un_node;
     const src = inst_data.src();
     const operand = try sema.resolveInst(inst_data.operand);
     return sema.mod.constType(sema.arena, src, operand.ty);
src/Zir.zig
@@ -523,7 +523,7 @@ pub const Inst = struct {
         /// Uses `un_node`.
         negate_wrap,
         /// Returns the type of a value.
-        /// Uses the `un_tok` field.
+        /// Uses the `un_node` field.
         typeof,
         /// Given a value which is a pointer, returns the element type.
         /// Uses the `un_node` field.
@@ -1334,7 +1334,7 @@ pub const Inst = struct {
                 .subwrap = .pl_node,
                 .negate = .un_node,
                 .negate_wrap = .un_node,
-                .typeof = .un_tok,
+                .typeof = .un_node,
                 .typeof_elem = .un_node,
                 .typeof_log2_int_type = .un_node,
                 .log2_int_type = .un_node,