handle arbitrary expressions dependent on static input params in proc signatures

This commit is contained in:
Zahary Karadjov 2014-03-16 17:12:30 +02:00
commit f0953db3ba
10 changed files with 60 additions and 18 deletions

View file

@ -1255,15 +1255,18 @@ proc getSize(typ: PType): BiggestInt =
if result < 0: internalError("getSize: " & $typ.kind)
proc containsGenericTypeIter(t: PType, closure: PObject): bool =
if t.kind in GenericTypes + tyTypeClasses + {tyFromExpr}:
return true
if t.kind == tyStatic:
return t.n == nil
if t.kind == tyTypeDesc:
if t.base.kind == tyNone: return true
if containsGenericTypeIter(t.base, closure): return true
return false
return t.kind == tyStatic and t.n == nil
if t.kind in GenericTypes + tyTypeClasses + {tyFromExpr}:
return true
return false
proc containsGenericType*(t: PType): bool =
result = iterOverType(t, containsGenericTypeIter, nil)