-
-
Notifications
You must be signed in to change notification settings - Fork 159
runtime: createRequire node:-prefix normalization + diagnostics_channel builtin (#6644) #6647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1454,7 +1454,19 @@ pub(crate) fn get_param_default(ctx: &mut LoweringContext, pat: &ast::Pat) -> Re | |
| } | ||
| } | ||
| ast::Pat::Assign(assign) => { | ||
| // #6604: a capturing class EXPRESSION used as a default value | ||
| // (`function f(C = class { … }) {}`) must NOT register with the | ||
| // enclosing body's end-of-body capture-refresh machinery: param | ||
| // defaults are lowered BEFORE the callee's own body twin takes | ||
| // its list mark (fn-decl / ctor / method param sites), so the | ||
| // entry would be drained by the WRONG (enclosing) body and its | ||
| // ids interpreted in the wrong function's local numbering. | ||
| // Truncate whatever this default expression recorded — the | ||
| // default is re-evaluated at every call anyway, so its | ||
| // evaluation-time snapshot is per-call fresh. | ||
| let mark = ctx.body_class_expr_captures.len(); | ||
| let default_expr = lower_expr(ctx, &assign.right)?; | ||
| ctx.body_class_expr_captures.truncate(mark); | ||
|
Comment on lines
+1457
to
+1469
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift Do not discard default class expressions that capture body-mutated bindings. Per-call evaluation is fresh, but the class must still observe later body assignments: function f(x, C = class { get() { return x; } }) {
x = 2;
return C;
}Truncating here excludes 🤖 Prompt for AI Agents |
||
| Ok(Some(default_expr)) | ||
| } | ||
| _ => Ok(None), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Preserve per-evaluation captures for assigned-after-class factories.
This registers
ClassExprFreshcaptures in one global, name-keyed snapshot. WithA = make("a"); B = make("b"); new A(), stale slots inAcan be backfilled fromB’s later snapshot.Keep refresh state on the fresh class object, or otherwise key it per evaluation. Add this assigned-after-class multi-evaluation regression alongside the existing assigned-before-class case.
🤖 Prompt for AI Agents