Added string.add(openarray[char]) and macros.typedParams
This commit is contained in:
parent
b18e8877a7
commit
3b28f390fc
|
@ -226,3 +226,11 @@ proc newLitFixed*(arg: tuple): NimNode {.compileTime.} =
|
|||
for a,b in arg.fieldPairs:
|
||||
result.add nnkExprColonExpr.newTree(newIdentNode(a), newLitFixed(b))
|
||||
|
||||
iterator typedParams*(n: NimNode, skip = 0): (NimNode, NimNode) =
|
||||
for i in (1 + skip) ..< n.params.len:
|
||||
let paramNodes = n.params[i]
|
||||
let paramType = paramNodes[^2]
|
||||
|
||||
for j in 0 ..< paramNodes.len - 2:
|
||||
yield (paramNodes[j], paramType)
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
proc add*(s: var string, data: openarray[char]) =
|
||||
if data.len > 0:
|
||||
let prevEnd = s.len
|
||||
s.setLen(prevEnd + data.len)
|
||||
copyMem(addr s[prevEnd], unsafeAddr data[0], data.len)
|
||||
|
Loading…
Reference in New Issue