fixes regression: overloading by 'var'

This commit is contained in:
Araq 2015-04-25 23:13:38 +02:00
commit e40b667891
3 changed files with 140 additions and 131 deletions

View file

@ -159,7 +159,7 @@ proc sumGeneric(t: PType): int =
inc result inc result
inc isvar inc isvar
of tyGenericInvocation, tyTuple: of tyGenericInvocation, tyTuple:
result = ord(t.kind == tyGenericInvocation) result += ord(t.kind == tyGenericInvocation)
for i in 0 .. <t.len: result += t.sons[i].sumGeneric for i in 0 .. <t.len: result += t.sons[i].sumGeneric
break break
of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break
@ -167,7 +167,8 @@ proc sumGeneric(t: PType): int =
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128, tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
tyUInt..tyUInt64: tyUInt..tyUInt64:
return isvar return isvar
else: return 0 else:
return 0
#var ggDebug: bool #var ggDebug: bool

View file

@ -512,10 +512,10 @@ proc getZAxis*(m:TMatrix3d):TVector3d {.noInit.}=
proc `$`*(m:TMatrix3d):string= proc `$`*(m:TMatrix3d):string=
## String representation of `m` ## String representation of `m`
return rtos(m.ax) & "," & rtos(m.ay) & "," &rtos(m.az) & "," & rtos(m.aw) & return rtos(m.ax) & "," & rtos(m.ay) & "," & rtos(m.az) & "," & rtos(m.aw) &
"\n" & rtos(m.bx) & "," & rtos(m.by) & "," &rtos(m.bz) & "," & rtos(m.bw) & "\n" & rtos(m.bx) & "," & rtos(m.by) & "," & rtos(m.bz) & "," & rtos(m.bw) &
"\n" & rtos(m.cx) & "," & rtos(m.cy) & "," &rtos(m.cz) & "," & rtos(m.cw) & "\n" & rtos(m.cx) & "," & rtos(m.cy) & "," & rtos(m.cz) & "," & rtos(m.cw) &
"\n" & rtos(m.tx) & "," & rtos(m.ty) & "," &rtos(m.tz) & "," & rtos(m.tw) "\n" & rtos(m.tx) & "," & rtos(m.ty) & "," & rtos(m.tz) & "," & rtos(m.tw)
proc apply*(m:TMatrix3d, x,y,z:var float, translate=false)= proc apply*(m:TMatrix3d, x,y,z:var float, translate=false)=
## Applies transformation `m` onto `x` , `y` , `z` , optionally ## Applies transformation `m` onto `x` , `y` , `z` , optionally

View file

@ -12,7 +12,9 @@ ref T
2 2
1 1
@[123, 2, 1] @[123, 2, 1]
Called!''' Called!
merge with var
merge no var'''
""" """
# Things that's even in the spec now! # Things that's even in the spec now!
@ -103,8 +105,14 @@ proc mget*[T](future: FutureVar[T]): var T =
proc reset*[T](future: FutureVar[T]) = proc reset*[T](future: FutureVar[T]) =
echo "Called!" echo "Called!"
proc merge[T](x: Future[T]) = echo "merge no var"
proc merge[T](x: var Future[T]) = echo "merge with var"
when true: when true:
var foo = newFutureVar[string]() var foo = newFutureVar[string]()
foo.mget() = "" foo.mget() = ""
foo.mget.add("Foobar") foo.mget.add("Foobar")
foo.reset() foo.reset()
var bar = newFuture[int]()
bar.merge # merge with var
merge(newFuture[int]()) # merge no var