preparation for new 'is' operator; breaks bootstrapping again, sorry (use generated C code)

This commit is contained in:
Araq 2011-07-31 00:21:32 +02:00
commit 6a8a409f1b
19 changed files with 86 additions and 203 deletions

View file

@ -614,8 +614,8 @@ proc evalHigh(c: PEvalContext, n: PNode): PNode =
of tyOpenArray, tySequence: result = newIntNodeT(sonsLen(result), n)
of tyString: result = newIntNodeT(len(result.strVal) - 1, n)
else: InternalError(n.info, "evalHigh")
proc evalIs(c: PEvalContext, n: PNode): PNode =
proc evalOf(c: PEvalContext, n: PNode): PNode =
result = evalAux(c, n.sons[1], {})
if isSpecial(result): return
result = newIntNodeT(ord(inheritanceDiff(result.typ, n.sons[2].typ) >= 0), n)
@ -755,7 +755,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
var m = getMagic(n)
case m
of mNone: result = evalCall(c, n)
of mIs: result = evalIs(c, n)
of mOf: result = evalOf(c, n)
of mSizeOf: internalError(n.info, "sizeof() should have been evaluated")
of mHigh: result = evalHigh(c, n)
of mAssert: result = evalAssert(c, n)