Jon Ross-Perkins and Geoff Romer
03e693873b
Detect control flow in entities nested inside functions ( #5336 )
...
Right now, return_scope_stack is being used to determine whether logic
is in a function scope. However, we need to handle nested entities
inside function scopes. For example where this crashes right now:
```
base class C(B:! bool) {}
fn F() {
class B {
extend base: C(true or false);
}
}
```
This is doing a few things to make this kind of code not crash:
- Split `scope_stack().Push` into `PushForDeclName`, `PushForEntity`,
`PushForExpr`, and `PushForFunction` so that better decisions can be
made about behaviors.
- Hide `return_scope_stack` in the API, instead using interfaces to get
at the underlying data.
- Also using `PushForFunction` to update it similar to the other stacks
that `ScopeStack` manages.
- Add `IsInFunctionScope` as the best way to determine presence in
function scope.
- Remove `PeekIsLexicalScope` since destruction really wants function
scope information anyways.
- Clean up `destroy_id_stack` handling to be for function scopes rather
than lexical scopes.
- Return after related `context.TODO`s in a couple more spots, so that
code doesn't proceed to add control flow in spite of the lack of
support.
---------
Co-authored-by: Geoff Romer <gromer@google.com >
2025-04-23 19:03:53 +00:00
..
2025-02-20 22:42:47 +00:00
2025-04-23 19:03:53 +00:00
2025-04-15 22:40:29 +00:00
2025-04-11 21:47:43 +00:00
2025-04-18 14:17:48 +00:00
2025-04-17 18:57:20 +00:00
2024-09-05 23:39:58 +00:00
2025-01-27 23:48:44 +00:00
2025-04-23 19:03:53 +00:00
2025-04-02 21:51:25 +00:00
2025-04-17 15:37:57 +00:00
2025-03-27 00:41:30 +00:00
2025-04-17 18:57:20 +00:00
2025-04-10 20:53:42 +00:00
2025-04-17 15:37:57 +00:00
2025-04-23 19:03:53 +00:00
2025-04-23 19:03:53 +00:00
2025-03-28 00:29:17 +00:00
2025-04-23 16:39:09 +00:00
2025-04-15 22:40:29 +00:00
2025-04-23 15:20:18 +00:00
2025-04-23 19:03:53 +00:00
2025-03-21 22:26:08 +00:00
2025-04-15 22:40:29 +00:00
2025-03-14 00:44:51 +00:00
2025-04-17 15:37:57 +00:00
2024-11-20 20:58:58 +00:00
2025-04-17 15:37:57 +00:00
2025-04-14 14:28:15 +00:00
2025-04-14 14:28:15 +00:00
2025-04-17 15:37:57 +00:00
2025-04-23 16:39:09 +00:00
2025-04-15 22:40:29 +00:00
2025-04-21 20:38:11 +00:00
2025-04-14 14:28:15 +00:00
2025-04-23 16:39:09 +00:00
2025-04-14 14:28:15 +00:00
2025-03-04 21:01:59 +00:00
2025-04-15 22:40:29 +00:00
2025-04-15 00:33:39 +00:00
2025-04-17 21:58:37 +00:00
2025-03-01 07:56:04 +00:00
2025-04-15 22:40:29 +00:00
2025-04-14 14:28:15 +00:00
2025-03-18 23:49:24 +00:00
2024-07-03 17:49:47 +00:00
2025-04-17 21:58:37 +00:00
2025-04-17 18:57:20 +00:00
2025-04-22 17:15:53 +00:00
2024-12-02 18:51:44 +00:00
2025-04-23 19:03:53 +00:00
2025-04-23 19:03:53 +00:00
2025-04-23 19:03:53 +00:00
2025-04-17 21:58:37 +00:00
2024-07-12 22:38:06 +00:00
2024-07-12 22:38:06 +00:00
2025-04-23 19:03:53 +00:00
2025-04-23 19:03:53 +00:00
2025-02-14 19:44:36 +00:00
2025-04-23 19:03:53 +00:00
2025-02-11 21:33:57 +00:00
2025-04-15 22:40:29 +00:00
2025-04-23 19:03:53 +00:00
2025-04-22 17:15:53 +00:00
2025-04-17 18:57:20 +00:00
2025-02-14 19:44:36 +00:00
2024-07-12 22:38:06 +00:00
2025-04-23 15:20:18 +00:00
2025-04-17 18:57:20 +00:00
2024-07-12 22:38:06 +00:00
2025-04-17 21:58:37 +00:00
2024-12-18 00:19:12 +00:00
2025-04-23 19:03:53 +00:00
2024-07-12 22:38:06 +00:00
2025-04-10 20:53:42 +00:00
2024-07-12 22:38:06 +00:00
2025-04-23 19:03:53 +00:00
2025-04-10 20:53:42 +00:00
2025-04-23 19:03:53 +00:00
2024-07-12 22:38:06 +00:00
2025-04-23 16:39:09 +00:00
2025-04-23 16:39:09 +00:00
2025-04-17 18:57:20 +00:00
2025-04-11 20:30:04 +00:00
2025-04-17 18:57:20 +00:00
2025-03-03 10:38:19 +00:00
2025-04-23 16:39:09 +00:00
2025-02-19 07:19:23 +00:00
2025-04-17 18:57:20 +00:00
2025-04-14 14:28:15 +00:00
2025-03-21 23:09:37 +00:00
2025-01-23 02:21:48 +00:00
2025-04-21 21:19:14 +00:00
2025-04-11 21:47:43 +00:00
2025-04-17 15:37:57 +00:00
2025-04-14 14:28:15 +00:00
2025-04-23 15:20:18 +00:00
2024-11-04 04:00:17 +00:00
2025-04-17 18:57:20 +00:00
2024-12-03 18:46:27 +00:00
2025-04-23 16:39:09 +00:00
2025-04-05 16:08:09 +00:00
2025-04-15 22:40:29 +00:00
2025-04-14 14:28:15 +00:00
2025-04-23 15:20:18 +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-04-17 15:37:57 +00:00
2025-04-14 14:28:15 +00:00
2025-04-17 15:37:57 +00:00
2025-03-28 16:24:17 +00:00
2025-02-07 22:35:18 +00:00
2025-04-22 17:15:53 +00:00
2025-04-15 22:40:29 +00:00
2025-02-26 18:44:36 +00:00
2025-02-25 02:07:43 +00:00
2025-04-17 15:37:57 +00:00
2025-01-23 02:21:48 +00:00
2025-03-28 16:24:11 +00:00
2025-04-15 22:40:29 +00:00
2024-03-18 17:40:00 +00:00
2025-04-14 14:28:15 +00:00
2025-04-23 19:03:53 +00:00
2025-01-17 17:51:34 +00:00
2025-03-01 08:00:17 +00:00
2025-04-23 19:03:53 +00:00
2025-04-23 19:03:53 +00:00
2025-03-21 23:09:37 +00:00
2025-02-20 03:17:45 +00:00
2025-04-21 21:19:14 +00:00
2025-04-11 21:47:43 +00:00
2025-04-17 18:57:20 +00:00
2025-04-14 14:28:15 +00:00
2025-04-15 22:40:29 +00:00
2025-04-08 19:02:55 +00:00
2025-04-23 16:39:09 +00:00
2025-04-23 16:39:09 +00:00