Richard Smith
d50576ca16
Handle references to global lets and enclosing locals. ( #8061 )
...
When building an expression referencing the result of name lookup, if
the lookup result is non-constant then check we can access it from the
current scope.
* If it is a global, then use a new `GlobalRef` instruction to get the
value of that global. In lowering, create global variables to hold the
values of global `let` bindings so that `GlobalRef` can access those
values.
* If it is a local, walk the lexical scopes between it and the point of
use and ensure it is usable through from all of them. Error if there's
an intervening declarative scope such as a class, add a TODO to handle
captures for intervening functions, and allow `typeof(...)` to name
things it can't read the value of since it's unevaluated.
Global `let`s (which includes `let`s at class scope) now also have their
initializers collected into the global inits block. If the initializer
is non-constant, the wrapper binding also lives in the global inits
block; otherwise it continues to live in the file block and the variable
emitted for it is a global constant.
Assisted-by: Gemini and Claude via Antigravity
2026-11-06 02:53:03 +00:00
..
2026-11-03 18:28:21 +00:00
2025-02-20 22:42:47 +00:00
2026-11-06 02:53:03 +00:00
2026-10-16 19:41:02 +00:00
2026-09-24 23:10:18 +00:00
2026-10-30 21:03:16 +00:00
2026-11-02 20:05:00 +00:00
2026-04-29 18:33:53 +00:00
2026-10-15 06:08:57 +00:00
2026-10-26 20:52:43 +00:00
2026-10-26 20:52:43 +00:00
2026-10-15 06:08:57 +00:00
2026-08-06 13:32:37 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2026-10-21 13:20:54 +00:00
2026-10-30 21:03:16 +00:00
2026-10-15 00:30:09 +00:00
2026-10-15 00:30:09 +00:00
2026-10-15 19:03:10 +00:00
2026-10-15 19:03:10 +00:00
2025-12-11 21:41:47 +00:00
2026-10-26 21:35:01 +00:00
2025-12-11 21:41:47 +00:00
2026-10-26 21:35:01 +00:00
2026-10-26 21:35:01 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2026-10-21 21:03:39 +00:00
2026-07-09 20:38:56 +00:00
2025-06-10 22:09:31 +00:00
2026-06-09 21:10:18 +00:00
2026-10-15 06:08:57 +00:00
2026-02-04 17:24:55 +00:00
2026-10-15 06:08:57 +00:00
2026-10-21 18:32:30 +00:00
2026-11-03 14:15:14 +00:00
2026-09-24 23:10:18 +00:00
2026-11-03 14:15:14 +00:00
2026-09-03 17:06:22 +00:00
2026-10-21 13:20:54 +00:00
2026-10-21 13:20:54 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2026-10-26 20:52:43 +00:00
2026-10-16 21:48:48 +00:00
2026-02-19 16:24:07 +00:00
2026-10-16 19:41:02 +00:00
2026-10-26 20:52:43 +00:00
2026-10-26 20:52:43 +00:00
2026-11-06 02:53:03 +00:00
2026-05-18 20:09:17 +00:00
2026-11-06 02:53:03 +00:00
2026-10-06 17:23:49 +00:00
2026-11-06 02:53:03 +00:00
2025-12-30 19:18:34 +00:00
2026-11-06 02:53:03 +00:00
2026-10-15 06:08:57 +00:00
2026-07-16 15:12:39 +00:00
2026-10-15 06:08:57 +00:00
2026-07-16 15:12:39 +00:00
2024-07-12 22:38:06 +00:00
2026-03-06 17:35:48 +00:00
2026-10-16 21:48:48 +00:00
2026-07-14 00:59:22 +00:00
2026-07-16 15:12:39 +00:00
2026-10-21 18:32:30 +00:00
2026-03-31 22:27:43 +00:00
2026-10-17 00:14:10 +00:00
2026-05-21 21:21:50 +00:00
2026-10-26 21:35:01 +00:00
2026-10-16 21:48:48 +00:00
2026-11-06 02:53:03 +00:00
2026-10-15 21:13:38 +00:00
2026-10-15 19:03:10 +00:00
2026-10-15 06:08:57 +00:00
2026-03-10 20:04:28 +00:00
2026-10-15 06:08:57 +00:00
2026-11-06 02:53:03 +00:00
2026-08-25 18:43:52 +00:00
2026-05-21 00:02:29 +00:00
2024-12-18 00:19:12 +00:00
2026-09-22 15:04:40 +00:00
2026-10-15 06:08:57 +00:00
2026-10-05 22:23:12 +00:00
2024-07-12 22:38:06 +00:00
2026-11-06 02:53:03 +00:00
2026-09-03 19:06:20 +00:00
2026-10-21 18:32:30 +00:00
2024-07-12 22:38:06 +00:00
2026-10-30 21:03:16 +00:00
2026-02-09 22:00:21 +00:00
2026-11-06 02:53:03 +00:00
2026-11-02 20:05:00 +00:00
2026-10-16 21:48:48 +00:00
2026-10-21 18:32:30 +00:00
2026-10-21 18:32:30 +00:00
2026-11-03 14:15:14 +00:00
2026-10-21 13:20:54 +00:00
2026-10-15 06:08:57 +00:00
2025-05-22 18:58:47 +00:00
2026-10-21 18:32:30 +00:00
2026-10-21 18:32:30 +00:00
2026-11-03 14:15:14 +00:00
2025-09-10 21:40:27 +00:00
2026-10-15 06:08:57 +00:00
2026-03-24 20:56:44 +00:00
2025-03-21 23:09:37 +00:00
2025-11-11 16:36:15 +00:00
2026-10-15 19:03:10 +00:00
2026-10-15 19:03:10 +00:00
2026-10-26 21:35:01 +00:00
2026-10-26 21:35:01 +00:00
2025-09-12 22:59:37 +00:00
2026-07-13 19:14:38 +00:00
2026-02-19 23:33:36 +00:00
2026-10-15 06:08:57 +00:00
2026-10-06 17:23:49 +00:00
2026-11-06 02:53:03 +00:00
2026-09-18 19:12:05 +00:00
2026-10-15 21:13:38 +00:00
2026-08-25 18:43:52 +00:00
2026-10-15 06:08:57 +00:00
2026-08-17 20:49:23 +00:00
2026-10-15 19:03:10 +00:00
2026-10-15 00:30:09 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2025-12-09 20:38:50 +00:00
2025-12-09 20:38:50 +00:00
2026-10-16 21:48:48 +00:00
2025-06-10 22:09:31 +00:00
2026-01-14 19:32:03 +00:00
2026-11-03 22:02:33 +00:00
2026-10-26 21:35:01 +00:00
2026-09-28 22:30:56 +00:00
2025-02-25 02:07:43 +00:00
2026-11-06 02:53:03 +00:00
2026-10-15 19:03:10 +00:00
2026-10-21 21:03:39 +00:00
2026-10-21 21:03:39 +00:00
2026-10-07 01:10:33 +00:00
2026-11-02 20:05:00 +00:00
2026-10-14 14:12:56 +00:00
2025-05-01 22:17:55 +00:00
2025-05-01 22:17:55 +00:00
2026-03-28 00:06:06 +00:00
2026-03-26 15:26:56 +00:00
2026-03-26 15:26:56 +00:00
2026-10-15 21:13:38 +00:00
2026-10-15 00:30:09 +00:00
2025-11-14 13:50:56 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2026-10-30 21:03:16 +00:00
2026-10-30 21:03:16 +00:00
2026-10-20 21:18:50 +00:00
2026-10-20 21:18:50 +00:00
2026-10-15 19:03:10 +00:00
2026-07-24 18:43:12 +00:00
2026-11-03 14:15:14 +00:00
2026-10-21 13:20:54 +00:00
2026-05-11 14:17:18 +00:00
2026-09-22 15:04:40 +00:00
2026-10-11 23:09:12 +00:00
2026-10-11 23:09:12 +00:00
2026-10-15 06:08:57 +00:00
2026-02-19 23:33:36 +00:00