parsav  Diff

Differences From Artifact [8c252399a5]:

To Artifact [d10508934e]:


   106    106   		self.ct = self.ct - n
   107    107   		return self.ptr
   108    108   	end
   109    109   	terra t.methods.null(): t return t { ptr = nil, ct = 0 } end -- maybe should be a macro?
   110    110   	terra t:ref() return self.ptr ~= nil end
   111    111   	t.metamethods.__not = macro(function(self) return `not self:ref() end)
   112    112   	t.metamethods.__apply = macro(function(self,idx) return `self.ptr[ [idx or 0] ] end)
          113  +	t.metamethods.__add = terra(self: &t, sz: intptr): t
          114  +		var n = @self n:advance(sz) return n
          115  +	end
   113    116   	t.metamethods.__update = macro(function(self,idx,rhs)
   114    117   		return quote self.ptr[idx] = rhs end end)
   115    118   	t.metamethods.__cast = function(from,to,exp)
   116    119   		if to == t then
   117    120   			if from == niltype then return `t.null()
   118    121   			elseif from == &ty then return `t {ptr = exp, ct = 1}
   119    122   			elseif from == ty then return `t {ptr = &exp, ct = 1}