phase_9_79b_1: Add Unified Registry IDs + Builder Slotting\n- MIR BoxCall carries optional method_id (slot)\n- Slot registry with universal slots [0..3]\n- Builder resolves method_id when receiver type known\n- Printer shows method_id; backends updated\n- Update CURRENT_TASK + MIR spec note
This commit is contained in:
@ -21,6 +21,7 @@ pub mod printer;
|
||||
pub mod value_id;
|
||||
pub mod effect;
|
||||
pub mod optimizer;
|
||||
pub mod slot_registry; // Phase 9.79b.1: method slot resolution (IDs)
|
||||
|
||||
// Re-export main types for easy access
|
||||
pub use instruction::{MirInstruction, BinaryOp, CompareOp, UnaryOp, ConstValue, MirType, TypeOpKind, WeakRefOp, BarrierOp};
|
||||
@ -37,6 +38,7 @@ pub use printer::MirPrinter;
|
||||
pub use value_id::{ValueId, LocalId, ValueIdGenerator};
|
||||
pub use effect::{EffectMask, Effect};
|
||||
pub use optimizer::MirOptimizer;
|
||||
pub use slot_registry::{BoxTypeId, MethodSlot};
|
||||
|
||||
/// MIR compilation result
|
||||
#[derive(Debug, Clone)]
|
||||
@ -229,6 +231,23 @@ mod tests {
|
||||
assert!(dump.contains(".push("), "Expected BoxCall to .push(...). Got:\n{}", dump);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_boxcall_method_id_on_universal_slot() {
|
||||
// Build AST: (new ArrayBox()).toString()
|
||||
let ast = ASTNode::MethodCall {
|
||||
object: Box::new(ASTNode::New { class: "ArrayBox".to_string(), arguments: vec![], type_arguments: vec![], span: crate::ast::Span::unknown() }),
|
||||
method: "toString".to_string(),
|
||||
arguments: vec![],
|
||||
span: crate::ast::Span::unknown(),
|
||||
};
|
||||
|
||||
let mut compiler = MirCompiler::new();
|
||||
let result = compiler.compile(ast).expect("compile should succeed");
|
||||
let dump = MirPrinter::new().print_module(&result.module);
|
||||
// Expect a BoxCall with numeric method id [#0] for toString universal slot
|
||||
assert!(dump.contains("toString[#0]"), "Expected method_id #0 for toString. Dump:\n{}", dump);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lowering_await_expression() {
|
||||
// Build AST: await 1 (semantic is nonsensical but should emit Await)
|
||||
|
||||
Reference in New Issue
Block a user