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-05-21 00:02:29 +00:00
2026-04-23 20:11:04 +00:00
2026-05-14 08:29:17 +00:00
2026-07-11 01:22:44 +00:00
2026-10-21 13:20:54 +00:00
2026-10-06 17:23:49 +00:00
2026-10-06 17:23:49 +00:00
2025-11-14 00:40:26 +00:00
2026-06-08 02:42:23 +00:00
2026-06-19 00:22:05 +00:00
2026-10-15 15:23:17 +00:00
2026-10-06 15:13:10 +00:00
2026-11-02 20:37:01 +00:00
2026-11-02 20:37:01 +00:00
2026-10-20 20:43:34 +00:00
2026-10-20 20:43:34 +00:00
2025-07-02 19:21:01 +00:00
2026-10-26 21:35:01 +00:00
2026-04-24 17:33:23 +00:00
2026-04-24 17:33:23 +00:00
2026-08-06 13:32:37 +00:00
2026-10-16 20:59:16 +00:00
2026-08-06 13:32:37 +00:00
2026-08-06 13:32:37 +00:00
2026-01-30 22:24:18 +00:00
2026-01-30 22:24:18 +00:00
2026-05-14 08:29:17 +00:00
2026-06-07 16:27:22 +00:00
2026-10-21 13:20:54 +00:00
2026-10-06 15:13:10 +00:00
2026-10-15 06:08:57 +00:00
2026-10-15 06:08:57 +00:00
2026-09-29 20:49:37 +00:00
2026-10-15 02:00:24 +00:00
2026-10-15 02:00:24 +00:00
2026-10-15 02:00:24 +00:00
2026-09-29 20:49:37 +00:00
2026-10-21 13:20:54 +00:00
2026-10-21 13:20:54 +00:00
2026-07-14 22:58:05 +00:00
2026-10-06 15:13:10 +00:00
2026-09-22 22:07:35 +00:00
2026-02-18 22:17:15 +00:00
2025-04-25 16:06:10 +00:00
2026-11-02 20:05:00 +00:00
2026-10-08 22:44:41 +00:00
2026-06-01 19:02:01 +00:00
2026-09-02 20:28:05 +00:00
2026-10-27 22:16:05 +00:00
2026-10-21 13:20:54 +00:00
2026-02-25 23:18:09 +00:00
2026-02-25 23:18:09 +00:00
2026-10-20 21:18:50 +00:00
2026-10-07 01:10:33 +00:00
2026-10-15 00:30:09 +00:00
2026-10-15 21:13:38 +00:00
2026-10-14 14:12:56 +00:00
2026-10-14 18:31:23 +00:00
2026-09-30 00:06:06 +00:00
2025-07-10 21:21:19 +00:00
2026-10-20 20:38:22 +00:00
2026-10-21 13:20:54 +00:00
2026-07-20 19:15:09 +00:00
2026-07-30 19:59:10 +00:00
2025-10-30 18:03:34 +00:00
2026-05-14 08:29:17 +00:00
2026-10-15 00:37:06 +00:00
2026-09-24 23:10:18 +00:00
2026-10-14 14:12:56 +00:00
2026-05-19 23:16:51 +00:00
2026-03-24 20:56:44 +00:00
2026-11-06 02:53:03 +00:00
2026-09-24 23:10:18 +00:00
2026-11-06 02:53:03 +00:00
2026-07-08 17:07:10 +00:00
2026-07-14 22:58:05 +00:00
2026-10-06 15:13:10 +00:00
2026-05-14 08:29:17 +00:00
2026-08-11 19:29:46 +00:00
2026-11-06 02:53:03 +00:00
2026-11-06 02:53:03 +00:00
2026-02-19 16:24:07 +00:00
2026-06-01 19:19:08 +00:00
2026-06-07 16:27:22 +00:00
2026-06-08 02:42:23 +00:00
2026-06-08 02:42:23 +00:00
2026-05-14 08:29:17 +00:00
2026-08-11 19:29:46 +00:00
2026-07-08 17:07:10 +00:00
2026-07-08 17:07:10 +00:00
2026-10-30 21:03:16 +00:00
2025-11-13 17:04:58 +00:00
2026-10-16 16:33:29 +00:00
2026-10-16 16:33:29 +00:00
2026-05-14 08:29:17 +00:00
2026-05-14 08:29:17 +00:00
2026-11-03 14:15:14 +00:00
2026-05-14 08:29:17 +00:00
2026-05-14 08:29:17 +00:00
2025-11-13 23:00:20 +00:00
2026-11-06 02:53:03 +00:00
2026-09-15 23:11:58 +00:00
2026-05-14 08:29:17 +00:00
2026-10-06 15:13:10 +00:00
2026-11-06 02:53:03 +00:00
2026-09-15 23:11:58 +00:00
2026-06-09 21:10:18 +00:00
2026-10-06 17:23:49 +00:00
2026-10-06 17:23:49 +00:00
2026-11-03 14:15:14 +00:00
2026-09-22 15:04:40 +00:00
2026-07-07 13:30:53 +00:00
2026-09-22 15:04:40 +00:00
2025-04-25 16:06:10 +00:00
2026-11-06 02:53:03 +00:00
2026-05-14 08:29:17 +00:00
2026-05-14 08:29:17 +00:00
2026-10-20 20:38:22 +00:00