the test suite is mostly green again
This commit is contained in:
parent
84806e6a61
commit
72f2a6e275
19 changed files with 46 additions and 67 deletions
|
|
@ -922,12 +922,6 @@ proc delSon(father: PNode, idx: int) =
|
|||
for i in countup(idx, length - 2): father.sons[i] = father.sons[i + 1]
|
||||
setlen(father.sons, length - 1)
|
||||
|
||||
proc hasSons*(n: PNode): bool {.inline.} =
|
||||
result = n.kind notin { nkCharLit..nkInt64Lit,
|
||||
nkFloatLit..nkFloat64Lit,
|
||||
nkStrLit..nkTripleStrLit,
|
||||
nkSym, nkIdent }
|
||||
|
||||
proc copyNode(src: PNode): PNode =
|
||||
# does not copy its sons!
|
||||
if src == nil:
|
||||
|
|
@ -959,18 +953,6 @@ proc shallowCopy*(src: PNode): PNode =
|
|||
of nkStrLit..nkTripleStrLit: result.strVal = src.strVal
|
||||
else: newSeq(result.sons, sonsLen(src))
|
||||
|
||||
proc copySons*(src: PNode): Pnode =
|
||||
# copies a node and its immediate sons
|
||||
if src == nil: return nil
|
||||
assert src.hasSons
|
||||
result = newNode(src.kind)
|
||||
result.info = src.info
|
||||
result.typ = src.typ
|
||||
result.flags = src.flags * PersistentNodeFlags
|
||||
newSeq(result.sons, src.len)
|
||||
for i in countup(0, src.len - 1):
|
||||
result.sons[i] = src.sons[i]
|
||||
|
||||
proc copyTree(src: PNode): PNode =
|
||||
# copy a whole syntax tree; performs deep copying
|
||||
if src == nil:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue