diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-02-28 20:30:17 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-02-28 20:30:17 +0100 |
commit | 0495e6cf3a1cf0f5f71622a8408d24fbc27642a0 (patch) | |
tree | 4e70338483c08aef22dc62e7f0a551d8906637a9 /lib/core | |
parent | a897371797154844f96906e72fa013b8205d0393 (diff) | |
download | Nim-0495e6cf3a1cf0f5f71622a8408d24fbc27642a0.tar.gz |
steps to get for loops as expressions
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/macros.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index ed9c304fe..f2a39f43b 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -902,7 +902,7 @@ proc newIfStmt*(branches: varargs[tuple[cond, body: NimNode]]): ## result = newNimNode(nnkIfStmt) for i in branches: - result.add(newNimNode(nnkElifBranch).add(i.cond, i.body)) + result.add(newTree(nnkElifBranch, i.cond, i.body)) proc newEnum*(name: NimNode, fields: openArray[NimNode], public, pure: bool): NimNode {.compileTime.} = @@ -1227,7 +1227,7 @@ proc customPragmaNode(n: NimNode): NimNode = let recList = typDef[2][2] for identDefs in recList: for i in 0 .. identDefs.len - 3: - if identDefs[i].kind == nnkPragmaExpr and + if identDefs[i].kind == nnkPragmaExpr and identDefs[i][0].kind == nnkIdent and $identDefs[i][0] == $n[1]: return identDefs[i][1] @@ -1237,7 +1237,7 @@ macro hasCustomPragma*(n: typed, cp: typed{nkSym}): untyped = ## ## .. code-block:: nim ## template myAttr() {.pragma.} - ## type + ## type ## MyObj = object ## myField {.myAttr.}: int ## var o: MyObj @@ -1255,7 +1255,7 @@ macro getCustomPragmaVal*(n: typed, cp: typed{nkSym}): untyped = ## ## .. code-block:: nim ## template serializationKey(key: string) {.pragma.} - ## type + ## type ## MyObj = object ## myField {.serializationKey: "mf".}: int ## var o: MyObj |