diff --git a/std_shims/macros_shim.nim b/std_shims/macros_shim.nim index 6d3cee8..636bbb2 100644 --- a/std_shims/macros_shim.nim +++ b/std_shims/macros_shim.nim @@ -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) + diff --git a/std_shims/strings.nim b/std_shims/strings.nim new file mode 100644 index 0000000..4dca78d --- /dev/null +++ b/std_shims/strings.nim @@ -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) +