summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2019-03-19 12:55:28 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-19 12:55:28 +0100
commitbfc7522401dec97834d2f0d79f34821d86bc448e (patch)
tree0e53fbd87ac1c893c5c5fbe391205097692241f0
parentcd9caf09d1878141871d46a5110648b119b7cb31 (diff)
downloadNim-bfc7522401dec97834d2f0d79f34821d86bc448e.tar.gz
docgen: generate pragma after generic, fixes #10792 (#10865)
-rw-r--r--compiler/renderer.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index 2fef1234a..832add378 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -1217,8 +1217,14 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
     else:
       put(g, tkDistinct, "distinct")
   of nkTypeDef:
-    gsub(g, n, 0)
-    gsub(g, n, 1)
+    if n.sons[0].kind == nkPragmaExpr:
+      # generate pragma after generic
+      gsub(g, n.sons[0], 0)
+      gsub(g, n, 1)
+      gsub(g, n.sons[0], 1)
+    else:
+      gsub(g, n, 0)
+      gsub(g, n, 1)
     put(g, tkSpaces, Space)
     if n.len > 2 and n.sons[2].kind != nkEmpty:
       putWithSpace(g, tkEquals, "=")