From edd75d03e312d6020623df4e06c9bb19c2f217c5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 16 Apr 2021 15:52:26 -0700 Subject: ZIR: rename decl_val and decl_ref to remove redundant suffix --- src/AstGen.zig | 8 ++++---- src/Sema.zig | 8 ++++---- src/Zir.zig | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/AstGen.zig b/src/AstGen.zig index 7dde9abf61..303da5c58c 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1276,8 +1276,8 @@ fn blockExprStmts( .cmp_gt, .cmp_neq, .coerce_result_ptr, - .decl_ref_named, - .decl_val_named, + .decl_ref, + .decl_val, .load, .div, .elem_ptr, @@ -4260,9 +4260,9 @@ fn identifier( // depending on the scope, determined by the generic instantiation. const str_index = try gz.identAsString(ident_token); switch (rl) { - .ref, .none_or_ref => return gz.addStrTok(.decl_ref_named, str_index, ident_token), + .ref, .none_or_ref => return gz.addStrTok(.decl_ref, str_index, ident_token), else => { - const result = try gz.addStrTok(.decl_val_named, str_index, ident_token); + const result = try gz.addStrTok(.decl_val, str_index, ident_token); return rvalue(gz, scope, rl, result, ident); }, } diff --git a/src/Sema.zig b/src/Sema.zig index 6272293743..5bc1241ae6 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -170,8 +170,8 @@ pub fn analyzeBody( .cmp_lte => try sema.zirCmp(block, inst, .lte), .cmp_neq => try sema.zirCmp(block, inst, .neq), .coerce_result_ptr => try sema.zirCoerceResultPtr(block, inst), - .decl_ref_named => try sema.zirDeclRefNamed(block, inst), - .decl_val_named => try sema.zirDeclValNamed(block, inst), + .decl_ref => try sema.zirDeclRef(block, inst), + .decl_val => try sema.zirDeclVal(block, inst), .load => try sema.zirLoad(block, inst), .div => try sema.zirArithmetic(block, inst), .elem_ptr => try sema.zirElemPtr(block, inst), @@ -1658,7 +1658,7 @@ fn zirDbgStmtNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE _ = try block.addDbgStmt(src, abs_byte_off); } -fn zirDeclRefNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { +fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { const inst_data = sema.code.instructions.items(.data)[inst].str_tok; const src = inst_data.src(); const decl_name = inst_data.get(sema.code); @@ -1666,7 +1666,7 @@ fn zirDeclRefNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner return sema.analyzeDeclRef(block, src, decl); } -fn zirDeclValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { +fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { const inst_data = sema.code.instructions.items(.data)[inst].str_tok; const src = inst_data.src(); const decl_name = inst_data.get(sema.code); diff --git a/src/Zir.zig b/src/Zir.zig index 9554553fb1..ab883df68e 100644 --- a/src/Zir.zig +++ b/src/Zir.zig @@ -296,12 +296,12 @@ pub const Inst = struct { /// Declares the beginning of a statement. Used for debug info. /// Uses the `node` union field. dbg_stmt_node, - /// Same as `decl_ref` except instead of indexing into decls, uses - /// a name to identify the Decl. Uses the `str_tok` union field. - decl_ref_named, - /// Same as `decl_val` except instead of indexing into decls, uses - /// a name to identify the Decl. Uses the `str_tok` union field. - decl_val_named, + /// Uses a name to identify a Decl and takes a pointer to it. + /// Uses the `str_tok` union field. + decl_ref, + /// Uses a name to identify a Decl and uses it as a value. + /// Uses the `str_tok` union field. + decl_val, /// Load the value from a pointer. Assumes `x.*` syntax. /// Uses `un_node` field. AST node is the `x.*` syntax. load, @@ -765,8 +765,8 @@ pub const Inst = struct { .enum_decl_nonexhaustive, .opaque_decl, .dbg_stmt_node, - .decl_ref_named, - .decl_val_named, + .decl_ref, + .decl_val, .load, .div, .elem_ptr, @@ -1868,8 +1868,8 @@ const Writer = struct { .error_value, .enum_literal, - .decl_ref_named, - .decl_val_named, + .decl_ref, + .decl_val, .import, => try self.writeStrTok(stream, inst), -- cgit v1.2.3