Jon Ross-Perkins
4cb61ae4e1
Remove ArgKinds to encourage safer coding patterns ( #5212 )
...
#5171 ran into an issue where the wrong kind was associated with an arg
(`auto arg1 = RefineOperand(context, loc_id, arg0_kind,
action.arg1());`). This PR is trying to reduce risk of similar errors by
replaced `ArgKinds()` with instead an `ArgAndKind` structure and
corresponding accessors.
A couple things I considered and discarded were:
- Adding `CARBON_KIND_SWITCH` support (in this PR -- see #5216 ).
- The particular way that `ForCase` works would need to change, and I
was hesitant to do that here.
- But this is why I did add `As` to `ArgAndKind`, because it had me
thinking in that direction.
- Trying to make wrapper functions like `MutateArgs(callback_fn);`. This
kind of approach gets a little messy due to some of the conditional
passes, and in particular the reverse-iteration done for `PopOperand` in
subst.cpp
- Making something like `args_and_kinds() -> std::array<ArgAndKind, 2>`.
There's one spot where iteration is already set up as a loop, but for
others it felt a little convoluted with less gain than
`MutateArgs`-style things.
I'm not sure if there's a better way to set up the table generators, I
might keep tinkering with those for ideas.
2025-03-28 23:24:36 +00:00
..
2025-02-20 22:42:47 +00:00
2025-03-28 16:02:41 +00:00
2025-03-28 23:24:36 +00:00
2025-03-28 00:29:17 +00:00
2025-03-27 21:17:54 +00:00
2025-03-28 00:29:17 +00:00
2024-09-05 23:39:58 +00:00
2025-01-27 23:48:44 +00:00
2025-03-28 16:24:17 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 00:41:30 +00:00
2025-03-28 00:29:17 +00:00
2025-03-28 00:29:17 +00:00
2025-03-28 16:24:11 +00:00
2025-02-19 21:46:46 +00:00
2025-03-01 07:56:04 +00:00
2025-03-27 18:14:26 +00:00
2025-03-21 22:26:08 +00:00
2025-03-28 23:24:36 +00:00
2025-03-14 00:44:51 +00:00
2024-11-20 20:58:58 +00:00
2024-11-20 20:58:58 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 00:41:30 +00:00
2025-03-27 21:17:54 +00:00
2025-03-27 21:46:08 +00:00
2025-03-19 20:19:21 +00:00
2025-03-28 23:24:36 +00:00
2025-03-26 15:10:23 +00:00
2025-02-27 00:21:01 +00:00
2025-02-19 22:10:11 +00:00
2025-03-04 21:01:59 +00:00
2025-02-27 17:01:29 +00:00
2025-02-27 17:01:29 +00:00
2024-07-03 16:58:47 +00:00
2025-03-01 07:56:04 +00:00
2025-03-28 15:14:02 +00:00
2025-03-26 22:53:32 +00:00
2025-03-18 23:49:24 +00:00
2024-07-03 17:49:47 +00:00
2025-02-14 19:44:36 +00:00
2025-02-20 22:42:47 +00:00
2025-03-21 21:45:53 +00:00
2024-12-02 18:51:44 +00:00
2025-03-21 21:45:53 +00:00
2025-03-21 22:26:08 +00:00
2024-07-12 22:38:06 +00:00
2025-03-05 21:55:30 +00:00
2024-07-12 22:38:06 +00:00
2024-07-12 22:38:06 +00:00
2025-03-28 00:29:17 +00:00
2025-02-12 00:21:07 +00:00
2025-02-14 19:44:36 +00:00
2025-03-27 18:14:26 +00:00
2025-02-11 21:33:57 +00:00
2025-02-14 19:44:36 +00:00
2025-03-21 22:26:08 +00:00
2025-03-28 00:29:17 +00:00
2025-03-26 19:12:10 +00:00
2025-02-14 19:44:36 +00:00
2024-07-12 22:38:06 +00:00
2025-02-15 01:36:46 +00:00
2025-03-26 19:12:10 +00:00
2024-07-12 22:38:06 +00:00
2025-03-21 21:45:53 +00:00
2024-12-18 00:19:12 +00:00
2025-02-25 02:07:10 +00:00
2024-07-12 22:38:06 +00:00
2025-02-20 03:17:45 +00:00
2024-07-12 22:38:06 +00:00
2025-03-26 19:12:10 +00:00
2025-02-14 19:44:36 +00:00
2025-02-27 00:21:01 +00:00
2024-07-12 22:38:06 +00:00
2025-03-28 23:24:36 +00:00
2025-03-27 21:46:08 +00:00
2025-03-26 23:43:45 +00:00
2025-02-19 22:10:11 +00:00
2025-03-28 08:46:17 +00:00
2025-03-03 10:38:19 +00:00
2025-03-27 21:46:08 +00:00
2025-02-19 07:19:23 +00:00
2025-03-26 19:12:10 +00:00
2025-03-15 20:41:48 +00:00
2025-03-21 23:09:37 +00:00
2025-01-23 02:21:48 +00:00
2025-03-19 20:19:21 +00:00
2025-03-28 00:29:17 +00:00
2025-03-12 13:54:49 +00:00
2025-03-12 13:54:49 +00:00
2025-01-25 02:13:52 +00:00
2024-11-04 04:00:17 +00:00
2025-02-14 19:44:36 +00:00
2024-12-03 18:46:27 +00:00
2025-03-28 00:29:17 +00:00
2025-03-28 00:29:17 +00:00
2025-03-26 19:12:10 +00:00
2025-02-27 17:01:29 +00:00
2025-03-27 00:41:30 +00:00
2024-10-17 22:47:40 +00:00
2025-03-18 00:31:17 +00:00
2025-01-22 23:15:00 +00:00
2025-03-26 22:53:32 +00:00
2025-02-19 07:19:23 +00:00
2025-03-28 16:24:17 +00:00
2025-03-28 16:24:17 +00:00
2025-02-07 22:35:18 +00:00
2025-03-14 20:16:01 +00:00
2025-02-26 18:44:36 +00:00
2025-02-26 18:44:36 +00:00
2025-02-25 02:07:43 +00:00
2025-03-28 00:29:17 +00:00
2025-01-23 02:21:48 +00:00
2025-03-28 16:24:11 +00:00
2025-02-14 19:44:36 +00:00
2024-03-18 17:40:00 +00:00
2025-03-01 07:56:04 +00:00
2025-02-26 18:44:36 +00:00
2025-01-17 17:51:34 +00:00
2025-03-01 08:00:17 +00:00
2025-03-28 00:29:17 +00:00
2025-03-28 00:29:17 +00:00
2025-03-21 23:09:37 +00:00
2025-02-20 03:17:45 +00:00
2025-03-28 23:24:36 +00:00
2025-03-25 22:53:25 +00:00
2025-03-28 15:29:02 +00:00
2025-03-27 18:14:26 +00:00
2025-03-28 16:24:23 +00:00
2025-03-20 23:52:50 +00:00
2025-02-28 00:50:43 +00:00
2025-02-28 00:50:43 +00:00