fix bug in variable addressing if they weren't immediately written to
This commit is contained in:
		@@ -679,7 +679,7 @@ func (b *Builtins) Variable(c *Context) func(string) error {
 | 
				
			|||||||
				c.Dictionary.AddWord(string(w), Word{Name: string(w), Variable: next})
 | 
									c.Dictionary.AddWord(string(w), Word{Name: string(w), Variable: next})
 | 
				
			||||||
				j, _ := c.RStack.Pop()
 | 
									j, _ := c.RStack.Pop()
 | 
				
			||||||
				c.RStack.Push(j + i - 1) // push the end-point onto the stack
 | 
									c.RStack.Push(j + i - 1) // push the end-point onto the stack
 | 
				
			||||||
				return nil
 | 
									return c.Memory.Write(next, []int{0})
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
				w = append(w, next[i])
 | 
									w = append(w, next[i])
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								mem.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								mem.go
									
									
									
									
									
								
							@@ -28,7 +28,7 @@ func (m *Memory) Write(addr int, values []int) error {
 | 
				
			|||||||
		m.intern[addr+i] = values[i]
 | 
							m.intern[addr+i] = values[i]
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// we've written past our marker, note that
 | 
						// we've written past our marker, note that
 | 
				
			||||||
	if m.nextFree < addr+len(values) {
 | 
						if m.nextFree <= addr+len(values) {
 | 
				
			||||||
		m.nextFree = addr + len(values)
 | 
							m.nextFree = addr + len(values)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user