docs: clarify typed example callbacks and delegation contracts

This commit is contained in:
2026-11-12 21:20:10 +08:00
parent c3e7d01c09
commit 40b43ac3c3
6 changed files with 9 additions and 4 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ class BaseRect: RectBlock {
class WideRect: BaseRect {
// 调用基类后复制测量数值到新的 Sized;新结果仍满足 MeasureResult 协议。
function measure(self: WideRect, mount: Object, constraints: Object): Sized {
// 宿主布局驱动仍传入 Mount/Constraints;Object 注解只放宽覆盖签名,不改变实际输入对象。
// 宿主布局驱动仍传入 Mount/Constraints;Object 注解只放宽本覆盖的参数检查,不改变实际输入对象。
// 若手工传入其他 Object,下一行委托 BaseRect.measure 仍检查其较窄的 Mount/Constraints 契约,不保证调用成功。
measured = BaseRect.measure(self, mount, constraints)
// 拷贝的是本轮测量结果的两个数值,不复制业务矩形或 Mount;返回新结果供宿主校验。
return Sized(measured.width, measured.height)