issue-0028: ?Protocol = null sentinel-shaped optional protocols
Protocol structs registered via registerProtocolDecl carry a new is_protocol flag; the ?T paths in sizeOf/typeSizeBytes/toLLVMType recognise it and lay out ?Protocol as the protocol struct itself (ctx == null IS the "none" state), matching how ?Closure / ?*T are sentinel-shaped — no extra storage. Method dispatch on ?Protocol auto-unwraps in lowerCall's field-access path; the unwrap is structurally a no-op so we just rebind obj_ty to the payload type. resolveCallParamTypes extended for optional-protocol receivers so enum-literal args (gpu.create_texture(.r8, ...)) get the right target_type and don't silently collapse to tag=0 : s32 — same issue-0031-class bug closed in Session 66, one type-system layer deeper. Library: UIRenderer / UIPipeline / GlyphCache migrated from the verbose gpu: GPU = ---; has_gpu: bool pattern to gpu: ?GPU = null. set_gpu no longer maintains a parallel bool flag. Bundled: dock.sx threads delta_time as a struct field rather than via a global pointer (cleanup unrelated to issue-0028, committed alongside). Verified: 85/85 regression tests pass; iOS-sim chess + macOS chess both render correctly post-migration.
This commit is contained in:
@@ -457,13 +457,11 @@ impl View for DockPanel {
|
||||
// Dock — dockable container with drag-and-drop zones
|
||||
// =============================================================================
|
||||
|
||||
// Global delta_time pointer — set by main.sx
|
||||
g_dock_delta_time : *f32 = null;
|
||||
|
||||
Dock :: struct {
|
||||
children: List(ViewChild);
|
||||
alignments: List(Alignment);
|
||||
interaction: *DockInteraction; // heap-allocated, shared with DockPanels
|
||||
delta_time: *f32;
|
||||
|
||||
// Config
|
||||
background: ?Color;
|
||||
@@ -475,11 +473,12 @@ Dock :: struct {
|
||||
enable_corners: bool;
|
||||
on_dock: ?Closure(s64, DockZone);
|
||||
|
||||
make :: (interaction: *DockInteraction) -> Dock {
|
||||
make :: (interaction: *DockInteraction, delta_time: *f32) -> Dock {
|
||||
d : Dock = ---;
|
||||
d.children = List(ViewChild).{};
|
||||
d.alignments = List(Alignment).{};
|
||||
d.interaction = interaction;
|
||||
d.delta_time = delta_time;
|
||||
d.background = null;
|
||||
d.corner_radius = 0.0;
|
||||
d.hint_size = 40.0;
|
||||
@@ -519,8 +518,7 @@ impl View for Dock {
|
||||
interaction := self.interaction;
|
||||
interaction.ensure_capacity(self.children.len);
|
||||
|
||||
// Tick animations (g_dock_delta_time is always set before main loop)
|
||||
dt : f32 = g_dock_delta_time.*;
|
||||
dt : f32 = self.delta_time.*;
|
||||
interaction.tick_animations(dt);
|
||||
|
||||
i : s64 = 0;
|
||||
|
||||
Reference in New Issue
Block a user