Cover source call-graph effects and rebinding in Endor

This commit is contained in:
2026-10-22 15:56:23 +08:00
parent 666fd2d973
commit 8d0dbbce29
4 changed files with 42 additions and 7 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
| main.rs | Native window event loop, namespace state and API startup |
| api.rs | Code CRUD, live Console/reset and compatibility evaluation endpoints, worker-owned session, request observation, coalesced native viewport/background-task updates, epoch checks, stale source/destination tab-drop rejection and diagnostics |
| activity.rs | Bounded in-memory HTTP exchanges with marked previews and allowlisted request headers |
| endor_host.rs | Aster compilation, fresh PUT candidates retained after successful publication, shared Console/program VM, asynchronous completion/fault boundaries, bounded execution, conservative compiled source effect query coverage, root cleanup and AST developer tree for function/class/member assignment nodes |
| endor_host.rs | Aster compilation, fresh PUT candidates retained after successful publication, shared Console/program VM, asynchronous completion/fault boundaries, bounded execution, compiled source/call-graph effect query and rebinding coverage, root cleanup and AST developer tree for function/class/member assignment nodes |
| endor_script.rs | Batch complete inputs for Aster's Interactive parser/compiler, retain Module entry, and rebase Aster spans to the original snapshot |
| ui_bridge.rs | Inheritable native nominal constructors with source fields, shared type method tables and bound receiver dispatch, configured unified Function classification and source/field/override checks with deferred typed public/native constructor signatures and split option/field preflight plus shared native arity intervals plus resolved types/unions/effects on methods, tab registry, stable-slot insertion, source-dispatched tab reorder/drop and callback registration checks, Page lifecycle/navigation and immutable frame extraction |
| binding.rs | Target-owned managed property bindings, weak Subscription tokens, zero-argument callback preflight, read-only compute and borrowed dependency/output caches |
+35 -2
View File
@@ -3946,8 +3946,14 @@ page.render(block)
r#"
function simple(value: Number): Number { return value }
function forward(value: Number): Number { return simple(value) }
function unknown(callback: Function): Object { return callback() }
function recursive(value: Number): Number { return recursive(value) }
marker = ui.state(0)
function impure(value: Number): Number { marker.increment() return value }
original = simple
class ReadOnlyModel {
function check(self: ReadOnlyModel, value: Number): Number { return value }
function helper(self: ReadOnlyModel, value: Number): Number { return value }
function check(self: ReadOnlyModel, value: Number): Number { return self.helper(value) }
}
model = ReadOnlyModel()
"#,
@@ -3957,7 +3963,10 @@ page.render(block)
let globals = session.candidate.globals.unwrap();
for (name, expected) in [
("simple", Some(endor_core::CallEffect::ReadOnly)),
("forward", None),
("forward", Some(endor_core::CallEffect::ReadOnly)),
("recursive", Some(endor_core::CallEffect::ReadOnly)),
("unknown", None),
("impure", None),
] {
let Value::Object(function) = session
.candidate
@@ -4000,6 +4009,30 @@ page.render(block)
Some(endor_core::CallEffect::ReadOnly)
);
session.candidate.vm.release(bound).unwrap();
let Value::Object(unbound) = session.candidate.vm.get_attr(model, "check").unwrap() else {
panic!("method")
};
assert_eq!(session.candidate.vm.call_effect(unbound).unwrap(), None);
let Value::Object(forward) = session
.candidate
.vm
.dict_get(globals, &Value::Text("forward".into()))
.unwrap()
.unwrap()
else {
panic!("forward")
};
session.execute("simple = impure", "app.main").unwrap();
assert_eq!(session.candidate.vm.call_effect(forward).unwrap(), None);
session.execute("simple = original", "app.main").unwrap();
assert_eq!(
session.candidate.vm.call_effect(forward).unwrap(),
Some(endor_core::CallEffect::ReadOnly)
);
assert_eq!(
session.execute("marker.value", "app.main").unwrap().value,
"0"
);
}
#[test]