authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-16 15:52:26-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-16 15:52:26-07:00
logedd75d03e312d6020623df4e06c9bb19c2f217c5
tree0b886cea99b5c4d268a92f654b8320d9e7419d0a
parentadc2aed587d009c0d112063fa0f3d03dedc9e50a

ZIR: rename decl_val and decl_ref to remove redundant suffix


3 files changed, 18 insertions(+), 18 deletions(-)

src/AstGen.zig+4-4
......@@ -1276,8 +1276,8 @@ fn blockExprStmts(
12761276 .cmp_gt,
12771277 .cmp_neq,
12781278 .coerce_result_ptr,
1279 .decl_ref_named,
1280 .decl_val_named,
1279 .decl_ref,
1280 .decl_val,
12811281 .load,
12821282 .div,
12831283 .elem_ptr,
......@@ -4260,9 +4260,9 @@ fn identifier(
42604260 // depending on the scope, determined by the generic instantiation.
42614261 const str_index = try gz.identAsString(ident_token);
42624262 switch (rl) {
4263 .ref, .none_or_ref => return gz.addStrTok(.decl_ref_named, str_index, ident_token),
4263 .ref, .none_or_ref => return gz.addStrTok(.decl_ref, str_index, ident_token),
42644264 else => {
4265 const result = try gz.addStrTok(.decl_val_named, str_index, ident_token);
4265 const result = try gz.addStrTok(.decl_val, str_index, ident_token);
42664266 return rvalue(gz, scope, rl, result, ident);
42674267 },
42684268 }
src/Sema.zig+4-4
......@@ -170,8 +170,8 @@ pub fn analyzeBody(
170170 .cmp_lte => try sema.zirCmp(block, inst, .lte),
171171 .cmp_neq => try sema.zirCmp(block, inst, .neq),
172172 .coerce_result_ptr => try sema.zirCoerceResultPtr(block, inst),
173 .decl_ref_named => try sema.zirDeclRefNamed(block, inst),
174 .decl_val_named => try sema.zirDeclValNamed(block, inst),
173 .decl_ref => try sema.zirDeclRef(block, inst),
174 .decl_val => try sema.zirDeclVal(block, inst),
175175 .load => try sema.zirLoad(block, inst),
176176 .div => try sema.zirArithmetic(block, inst),
177177 .elem_ptr => try sema.zirElemPtr(block, inst),
......@@ -1658,7 +1658,7 @@ fn zirDbgStmtNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE
16581658 _ = try block.addDbgStmt(src, abs_byte_off);
16591659}
16601660
1661fn zirDeclRefNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
1661fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
16621662 const inst_data = sema.code.instructions.items(.data)[inst].str_tok;
16631663 const src = inst_data.src();
16641664 const decl_name = inst_data.get(sema.code);
......@@ -1666,7 +1666,7 @@ fn zirDeclRefNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner
16661666 return sema.analyzeDeclRef(block, src, decl);
16671667}
16681668
1669fn zirDeclValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
1669fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
16701670 const inst_data = sema.code.instructions.items(.data)[inst].str_tok;
16711671 const src = inst_data.src();
16721672 const decl_name = inst_data.get(sema.code);
src/Zir.zig+10-10
......@@ -296,12 +296,12 @@ pub const Inst = struct {
296296 /// Declares the beginning of a statement. Used for debug info.
297297 /// Uses the `node` union field.
298298 dbg_stmt_node,
299 /// Same as `decl_ref` except instead of indexing into decls, uses
300 /// a name to identify the Decl. Uses the `str_tok` union field.
301 decl_ref_named,
302 /// Same as `decl_val` except instead of indexing into decls, uses
303 /// a name to identify the Decl. Uses the `str_tok` union field.
304 decl_val_named,
299 /// Uses a name to identify a Decl and takes a pointer to it.
300 /// Uses the `str_tok` union field.
301 decl_ref,
302 /// Uses a name to identify a Decl and uses it as a value.
303 /// Uses the `str_tok` union field.
304 decl_val,
305305 /// Load the value from a pointer. Assumes `x.*` syntax.
306306 /// Uses `un_node` field. AST node is the `x.*` syntax.
307307 load,
......@@ -765,8 +765,8 @@ pub const Inst = struct {
765765 .enum_decl_nonexhaustive,
766766 .opaque_decl,
767767 .dbg_stmt_node,
768 .decl_ref_named,
769 .decl_val_named,
768 .decl_ref,
769 .decl_val,
770770 .load,
771771 .div,
772772 .elem_ptr,
......@@ -1868,8 +1868,8 @@ const Writer = struct {
18681868
18691869 .error_value,
18701870 .enum_literal,
1871 .decl_ref_named,
1872 .decl_val_named,
1871 .decl_ref,
1872 .decl_val,
18731873 .import,
18741874 => try self.writeStrTok(stream, inst),
18751875