Merge branch 'devel' into araq
This commit is contained in:
commit
ecf1424456
18 changed files with 229 additions and 73 deletions
|
|
@ -1009,6 +1009,12 @@ proc safeLen*(n: PNode): int {.inline.} =
|
|||
if n.kind in {nkNone..nkNilLit} or isNil(n.sons): result = 0
|
||||
else: result = len(n.sons)
|
||||
|
||||
proc safeArrLen*(n: PNode): int {.inline.} =
|
||||
## works for array-like objects (strings passed as openArray in VM).
|
||||
if n.kind in {nkStrLit..nkTripleStrLit}:result = len(n.strVal)
|
||||
elif n.kind in {nkNone..nkFloat128Lit}: result = 0
|
||||
else: result = len(n)
|
||||
|
||||
proc add*(father, son: PNode) =
|
||||
assert son != nil
|
||||
if isNil(father.sons): father.sons = @[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue