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(...@@ -1276,8 +1276,8 @@ fn blockExprStmts(
1276 .cmp_gt,1276 .cmp_gt,
1277 .cmp_neq,1277 .cmp_neq,
1278 .coerce_result_ptr,1278 .coerce_result_ptr,
1279 .decl_ref_named,1279 .decl_ref,
1280 .decl_val_named,1280 .decl_val,
1281 .load,1281 .load,
1282 .div,1282 .div,
1283 .elem_ptr,1283 .elem_ptr,
...@@ -4260,9 +4260,9 @@ fn identifier(...@@ -4260,9 +4260,9 @@ fn identifier(
4260 // depending on the scope, determined by the generic instantiation.4260 // depending on the scope, determined by the generic instantiation.
4261 const str_index = try gz.identAsString(ident_token);4261 const str_index = try gz.identAsString(ident_token);
4262 switch (rl) {4262 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),
4264 else => {4264 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);
4266 return rvalue(gz, scope, rl, result, ident);4266 return rvalue(gz, scope, rl, result, ident);
4267 },4267 },
4268 }4268 }
src/Sema.zig+4-4
...@@ -170,8 +170,8 @@ pub fn analyzeBody(...@@ -170,8 +170,8 @@ pub fn analyzeBody(
170 .cmp_lte => try sema.zirCmp(block, inst, .lte),170 .cmp_lte => try sema.zirCmp(block, inst, .lte),
171 .cmp_neq => try sema.zirCmp(block, inst, .neq),171 .cmp_neq => try sema.zirCmp(block, inst, .neq),
172 .coerce_result_ptr => try sema.zirCoerceResultPtr(block, inst),172 .coerce_result_ptr => try sema.zirCoerceResultPtr(block, inst),
173 .decl_ref_named => try sema.zirDeclRefNamed(block, inst),173 .decl_ref => try sema.zirDeclRef(block, inst),
174 .decl_val_named => try sema.zirDeclValNamed(block, inst),174 .decl_val => try sema.zirDeclVal(block, inst),
175 .load => try sema.zirLoad(block, inst),175 .load => try sema.zirLoad(block, inst),
176 .div => try sema.zirArithmetic(block, inst),176 .div => try sema.zirArithmetic(block, inst),
177 .elem_ptr => try sema.zirElemPtr(block, inst),177 .elem_ptr => try sema.zirElemPtr(block, inst),
...@@ -1658,7 +1658,7 @@ fn zirDbgStmtNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE...@@ -1658,7 +1658,7 @@ fn zirDbgStmtNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE
1658 _ = try block.addDbgStmt(src, abs_byte_off);1658 _ = try block.addDbgStmt(src, abs_byte_off);
1659}1659}
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 {
1662 const inst_data = sema.code.instructions.items(.data)[inst].str_tok;1662 const inst_data = sema.code.instructions.items(.data)[inst].str_tok;
1663 const src = inst_data.src();1663 const src = inst_data.src();
1664 const decl_name = inst_data.get(sema.code);1664 const decl_name = inst_data.get(sema.code);
...@@ -1666,7 +1666,7 @@ fn zirDeclRefNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner...@@ -1666,7 +1666,7 @@ fn zirDeclRefNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner
1666 return sema.analyzeDeclRef(block, src, decl);1666 return sema.analyzeDeclRef(block, src, decl);
1667}1667}
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 {
1670 const inst_data = sema.code.instructions.items(.data)[inst].str_tok;1670 const inst_data = sema.code.instructions.items(.data)[inst].str_tok;
1671 const src = inst_data.src();1671 const src = inst_data.src();
1672 const decl_name = inst_data.get(sema.code);1672 const decl_name = inst_data.get(sema.code);
src/Zir.zig+10-10
...@@ -296,12 +296,12 @@ pub const Inst = struct {...@@ -296,12 +296,12 @@ pub const Inst = struct {
296 /// Declares the beginning of a statement. Used for debug info.296 /// Declares the beginning of a statement. Used for debug info.
297 /// Uses the `node` union field.297 /// Uses the `node` union field.
298 dbg_stmt_node,298 dbg_stmt_node,
299 /// Same as `decl_ref` except instead of indexing into decls, uses299 /// Uses a name to identify a Decl and takes a pointer to it.
300 /// a name to identify the Decl. Uses the `str_tok` union field.300 /// Uses the `str_tok` union field.
301 decl_ref_named,301 decl_ref,
302 /// Same as `decl_val` except instead of indexing into decls, uses302 /// Uses a name to identify a Decl and uses it as a value.
303 /// a name to identify the Decl. Uses the `str_tok` union field.303 /// Uses the `str_tok` union field.
304 decl_val_named,304 decl_val,
305 /// Load the value from a pointer. Assumes `x.*` syntax.305 /// Load the value from a pointer. Assumes `x.*` syntax.
306 /// Uses `un_node` field. AST node is the `x.*` syntax.306 /// Uses `un_node` field. AST node is the `x.*` syntax.
307 load,307 load,
...@@ -765,8 +765,8 @@ pub const Inst = struct {...@@ -765,8 +765,8 @@ pub const Inst = struct {
765 .enum_decl_nonexhaustive,765 .enum_decl_nonexhaustive,
766 .opaque_decl,766 .opaque_decl,
767 .dbg_stmt_node,767 .dbg_stmt_node,
768 .decl_ref_named,768 .decl_ref,
769 .decl_val_named,769 .decl_val,
770 .load,770 .load,
771 .div,771 .div,
772 .elem_ptr,772 .elem_ptr,
...@@ -1868,8 +1868,8 @@ const Writer = struct {...@@ -1868,8 +1868,8 @@ const Writer = struct {
18681868
1869 .error_value,1869 .error_value,
1870 .enum_literal,1870 .enum_literal,
1871 .decl_ref_named,1871 .decl_ref,
1872 .decl_val_named,1872 .decl_val,
1873 .import,1873 .import,
1874 => try self.writeStrTok(stream, inst),1874 => try self.writeStrTok(stream, inst),
18751875