UNPKG

@powerlang/egg-js

Version:

A Smalltalk VM that runs on top of JavaScript

50 lines (37 loc) 883 B
import EggHeapObject from './EggHeapObject.js'; let EggByteObject = class extends EggHeapObject { constructor() { super(); this._bytes = nil; } asLocalString() { return this._bytes.allButLast().asString(); } at_(index) { return this._bytes.at_(index); } at_put_(index, anLMRObject) { let value; value = anLMRObject.value(); this._bytes.at_put_(index, value); return anLMRObject; } bytes() { return this._bytes; } bytes_(aByteArray) { this.ASSERT_(aByteArray.size()._equal(this._header.size())); this.ASSERT_(aByteArray.class()._equalEqual(Array)); this._bytes = aByteArray; return this; } header_(anLMRObjectHeader) { super.header_(anLMRObjectHeader); this._bytes = Array.new_(this._header.size()); return this; } isBytes() { return true; } } export default EggByteObject