Files
hakorune/lang/src/vm/hakorune-vm/binop_handler.hako
nyash-codex ff62eb0d97 refactor(lang): comprehensive boxification and deduplication
Phase 1-4 Complete:
- Remove legacy archive folder (4 files, ~200 lines eliminated)
- Unify Handler pattern via CoreHandlerBaseBox (5 handlers simplified)
- Create InstFieldExtractorBox for common JSON field extraction
- Reorganize tests into unit/integration/regression categories

Impact:
- Code reduction: 400-600 lines (15-20%)
- Improved maintainability through unified design patterns
- Better test organization and structure
- Enhanced consistency following box-first principles
2025-11-02 12:30:30 +09:00

12 lines
525 B
Plaintext

// BinOpHandlerBox - BinOp instruction handler (simplified via CoreHandlerBaseBox)
// Handles: %dst = %lhs op_kind %rhs (Add/Sub/Mul/Div/Mod)
using "lang/src/vm/hakorune-vm/core_handler_base.hako" as CoreHandlerBaseBox
static box BinOpHandlerBox {
// Handle binop instruction via unified core handler
// inst_json: {"op":"binop","dst":3,"op_kind":"Add","lhs":1,"rhs":2}
// Returns: Result.Ok(0) or Result.Err(message)
handle(inst_json, regs) { return CoreHandlerBaseBox.handle_core_op("binop", inst_json, regs) }
}