first steps to the expr/stmt unification

This commit is contained in:
Araq 2013-04-30 02:38:49 +02:00
commit 2afadc5c9c
8 changed files with 159 additions and 92 deletions

View file

@ -58,10 +58,13 @@ proc fitNode(c: PContext, formal: PType, arg: PNode): PNode =
result = copyNode(arg)
result.typ = formal
var CommonTypeBegin = PType(kind: tyExpr)
proc commonType*(x, y: PType): PType =
# new type relation that is used for array constructors,
# if expressions, etc.:
if x == nil: return y
if x == nil: return x
if y == nil: return y
var a = skipTypes(x, {tyGenericInst})
var b = skipTypes(y, {tyGenericInst})
result = x