Own deferred class metadata and validate initializer completion - #1850
Conversation
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (13)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe compiler replaces separate deferred class maps with ChangesDeferred class registry
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Sequence Diagram(s)sequenceDiagram
participant ClassCompiler
participant DeferredClassDefinitionRegistry
participant ClassEmitter
participant TypeFinalizer
ClassCompiler->>DeferredClassDefinitionRegistry: Declare deferred class definition
ClassEmitter->>DeferredClassDefinitionRegistry: Resolve registrar and field keys
ClassEmitter->>DeferredClassDefinitionRegistry: Mark initializer emitted
TypeFinalizer->>DeferredClassDefinitionRegistry: Complete emission
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deferred class initialization previously kept separate mutable metadata maps for class declarations, class expressions, initializers, and computed-field keys. This change gives those handles one compilation-owned registry. Emitters share the same immutable definition by AST and TypeBuilder identity; invalid or duplicate declarations fail before publication, and both compilation finalization paths reject missing initializer bodies.
The registry remains open while nested class bodies are emitted, preserves forward method references and generic computed-key storage, and closes before type finalization. Computed-key order and emitted program behavior remain unchanged.
Validation:
Part of #1599. This phase removes deferred-class metadata duplication and adds lifecycle validation. Per-evaluation class identity, dynamic inheritance, remaining registry ownership, and the final residual-state audit remain open.
Summary by CodeRabbit