Do not walk into type sub-nodes for cast/conv expr (#10616)

This commit is contained in:
LemonBoy 2019-02-09 19:55:26 +01:00 • committed by Andreas Rumpf
commit d83520ec8f
2 changed files with 24 additions and 0 deletions

View file

@ -601,6 +601,12 @@ proc p(n: PNode; c: var Con): PNode =
of nkNone..nkNilLit, nkTypeSection, nkProcDef, nkConverterDef, nkMethodDef,
nkIteratorDef, nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
result = n
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
result = copyNode(n)
# Destination type
result.add n[0]
# Analyse the inner expression
result.add p(n[1], c)
else:
result = copyNode(n)
recurse(n, result)