optimized evals.nim a bit
This commit is contained in:
parent
beb13ecf62
commit
0b1630b46c
1 changed files with 8 additions and 8 deletions
|
|
@ -295,7 +295,8 @@ proc evalVar(c: PEvalContext, n: PNode): PNode =
|
||||||
# XXX var (x, y) = z support?
|
# XXX var (x, y) = z support?
|
||||||
#assert(a.sons[0].kind == nkSym) can happen for transformed vars
|
#assert(a.sons[0].kind == nkSym) can happen for transformed vars
|
||||||
if a.sons[2].kind != nkEmpty:
|
if a.sons[2].kind != nkEmpty:
|
||||||
result = evalAux(c, a.sons[2], {})
|
# XXX copyTree could be avoided in some cases
|
||||||
|
result = evalAux(c, a.sons[2], {}).copyTree
|
||||||
if isSpecial(result): return
|
if isSpecial(result): return
|
||||||
else:
|
else:
|
||||||
result = getNullValue(a.sons[0].typ, a.sons[0].info)
|
result = getNullValue(a.sons[0].typ, a.sons[0].info)
|
||||||
|
|
@ -1351,10 +1352,9 @@ proc evalAux(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode =
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkSym: result = evalSym(c, n, flags)
|
of nkSym: result = evalSym(c, n, flags)
|
||||||
of nkType..nkNilLit:
|
of nkType..nkNilLit:
|
||||||
# XXX nkStrLit is VERY common in the traces, so we should avoid
|
# nkStrLit is VERY common in the traces, so we should avoid
|
||||||
# the 'copyNode' here. However, for now we cannot do this for unknown
|
# the 'copyNode' here.
|
||||||
# reasons.
|
result = n #.copyNode
|
||||||
result = n.copyNode
|
|
||||||
of nkAsgn, nkFastAsgn: result = evalAsgn(c, n)
|
of nkAsgn, nkFastAsgn: result = evalAsgn(c, n)
|
||||||
of nkCommand..nkHiddenCallConv:
|
of nkCommand..nkHiddenCallConv:
|
||||||
result = evalMagicOrCall(c, n)
|
result = evalMagicOrCall(c, n)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue