Files
hakorune/lang/src/vm/hakorune-vm/const_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

13 lines
565 B
Plaintext

// ConstHandlerBox - Const instruction handler (simplified via CoreHandlerBaseBox)
// Handles: %dst = const value
using "lang/src/vm/hakorune-vm/core_handler_base.hako" as CoreHandlerBaseBox
static box ConstHandlerBox {
// Handle const instruction via unified core handler
// inst_json: {"op":"const","dst":1,"value":{"type":"i64","value":42}}
// or: {"op":"const","dst":2,"value":{"String":"hello"}}
// Returns: Result.Ok(0) or Result.Err(message)
handle(inst_json, regs) { return CoreHandlerBaseBox.handle_core_op("const", inst_json, regs) }
}