~madcapjake/rhi

9cfae659dd17e2df788cc944426b93faf38a8521 — Jake Russo 1 year, 8 months ago c912700
Fix integer equal
4 files changed, 3 insertions(+), 5 deletions(-)

M internal/vm/chunk.go
M internal/vm/primitives.go
M internal/vm/vm.go
M internal/word/word.go
M internal/vm/chunk.go => internal/vm/chunk.go +1 -2
@@ 123,7 123,6 @@ func (ch Chunk) Execute(vm *VirtualMachine) {
			if code.IsIndexExtension() {
				continue
			} else {
				// FIXME: something is wrong here
				ch.execTagIndex(vm, code.Tag(), int(idx))
				idx = 0
			}


@@ 134,7 133,7 @@ func (ch Chunk) Execute(vm *VirtualMachine) {

func (ch Chunk) execTagIndex(vm *VirtualMachine, tag byte, idx int) {
	literals := ch.ReviveLits(vm)
	fmt.Println("Executing chunk tag:", tag)
	// fmt.Println("Executing chunk tag:", tag)
	switch tag {
	case TAG_VALUE_LITERAL:
		vm.AddLiteralToStack(literals.Get(vm, idx))

M internal/vm/primitives.go => internal/vm/primitives.go +1 -1
@@ 73,7 73,7 @@ func (vm *VirtualMachine) subTwoInts() {
func (vm *VirtualMachine) mulTwoInts() {
	val1, val2 := vm.gatherTwoInts()
	vm.stack = append(vm.stack, word.FromInt(val1*val2))
	logAddedToStack(vm.stack, fmt.Sprint(val1, " x ", val2))
	logAddedToStack(vm.stack, fmt.Sprint(val1, " x ", val2, "  "))
}

func (vm *VirtualMachine) divTwoInts() {

M internal/vm/vm.go => internal/vm/vm.go +0 -1
@@ 366,7 366,6 @@ func (vm *VirtualMachine) SubmitOuterRequest(label word.Word) {
		panic("outer request submitted with non-ra value")
	}
	text := ReviveRuneArray(vm, refAddr.AsAddr()).String(vm)
	fmt.Println(text)
	switch text {
	case ".=", ":=":
		vm.assignLabel()

M internal/word/word.go => internal/word/word.go +1 -1
@@ 225,7 225,7 @@ func (x Word) Equals(y Word) bool {
		return y.IsEmpty()
	} else if x.IsInteger() {
		if y.IsInteger() {
			return x.IsInteger() == y.IsInteger()
			return x.AsInt() == y.AsInt()
		} else {
			return false
		}