Validate declared class fields at construction and attribute writes

This commit is contained in:
2026-10-22 11:44:09 +08:00
parent 6346041f77
commit 20e29e3c5a
13 changed files with 342 additions and 26 deletions
+2 -1
View File
@@ -501,7 +501,8 @@ impl Vm {
_ => Err(VmError::ObjectKindMismatch("class method")),
})
.collect::<Result<std::collections::BTreeMap<_, _>, _>>()?;
self.objects.new_class(name, base, fields, methods)
self.objects
.new_class_with_scope(name, base, fields, methods, Some(frame.function))
}
fn eval_frames(