diff options
-rw-r--r-- | compiler/reorder.nim | 1 | ||||
-rw-r--r-- | tests/pragmas/tpragmas_reorder.nim | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/compiler/reorder.nim b/compiler/reorder.nim index 4fabf9041..4ad3f1219 100644 --- a/compiler/reorder.nim +++ b/compiler/reorder.nim @@ -106,6 +106,7 @@ proc computeDeps(cache: IdentCache; n: PNode, declares, uses: var IntSet; topLev if a.kind == nkExprColonExpr and a[0].kind == nkIdent and a[0].ident.s == "pragma": # user defined pragma decl(a[1]) + for i in 1..<n.safeLen: deps(n[i]) else: for i in 0..<n.safeLen: deps(n[i]) of nkMixinStmt, nkBindStmt: discard diff --git a/tests/pragmas/tpragmas_reorder.nim b/tests/pragmas/tpragmas_reorder.nim new file mode 100644 index 000000000..c4b1a6b0a --- /dev/null +++ b/tests/pragmas/tpragmas_reorder.nim @@ -0,0 +1,19 @@ +discard """ + matrix: "--experimental:codeReordering" +""" + +runnableExamples: + import strtabs + var t = newStringTable() + t["name"] = "John" + t["city"] = "Monaco" + doAssert t.len == 2 + doAssert t.hasKey "name" + doAssert "name" in t + +include "system/inclrtl" + +{.pragma: rtlFunc, rtl.} + +proc hasKey*(): bool {.rtlFunc.} = + discard \ No newline at end of file |