Skip to content

Commit ec959d1

Browse files
committed
fix(eval): resolve nullable outer property access
Two changes work together to fix `outer.optionalProp` resolution in object amendments (the `outer.before` pattern in hk builtins): 1. Arc-wrap Lambda captures (`Value::Lambda` third field changed from `IndexMap` to `Arc<IndexMap>`). Previously, cloning a Lambda deep-copied its entire capture map, causing O(2^n) cost when successive local functions (makeTest, checkPass, checkFail, fixPass, fixFail) each captured the previous ones. With Arc the clone is O(1). 2. In `eval_amended_object`, seed `Null` into `eval_scope` for any nullable-no-default base class properties not already present. This makes `outer.before` (and similar optional properties) resolve to `Null` rather than failing with "field not found" when the property was never assigned in the class or overlay. Together these allow all 128+ hk builtins to evaluate successfully, including those using the `TestMaker` pattern with `outer.before`.
1 parent c1cb4f0 commit ec959d1

3 files changed

Lines changed: 486 additions & 77 deletions

File tree

0 commit comments

Comments
 (0)