aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-05-11 13:08:54 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-05-11 13:08:54 -0500
commit7daf32d654a2ef0d8751e486f16b306ee5cc22e4 (patch)
tree45d2280a804662e9020232250f09b54d39bfa174
parentb14eedb541d76aa08066dbc3527ef89ce968e7c2 (diff)
downloadnimterop-debugbool.tar.gz
nimterop-debugbool.zip
Add reorder pragma for #209, cleanup header pragmadebugbool
-rw-r--r--nimterop/ast2.nim11
1 files changed, 5 insertions, 6 deletions
diff --git a/nimterop/ast2.nim b/nimterop/ast2.nim
index 1230e06..d1e691b 100644
--- a/nimterop/ast2.nim
+++ b/nimterop/ast2.nim
@@ -1718,13 +1718,9 @@ proc setupPragmas(gState: State, root: TSNode, fullpath: string) =
dynPragma: PNode
if not gState.noHeader:
- # Path to header const
- gState.constSection.add gState.newConstDef(
- root, fname = gState.currentHeader, fval = '"' & fullpath & '"')
-
# {.pragma: impnameHdr, header: "xxx".}
hdrPragma = gState.newPragma(root, "pragma", gState.getIdent(gState.impShort & "Hdr"))
- gState.addPragma(root, hdrPragma, "header", gState.getIdent(gState.currentHeader))
+ gState.addPragma(root, hdrPragma, "header", newStrNode(nkStrLit, fullpath))
if gState.dynlib.nBl:
# {.pragma: impnameDyn, dynlib: libname.}
@@ -1737,6 +1733,9 @@ proc setupPragmas(gState: State, root: TSNode, fullpath: string) =
if not dynPragma.isNil:
gState.pragmaSection.add dynPragma
+ # Add `{.experimental: "codeReordering".} for #206
+ gState.pragmaSection.add gState.newPragma(root, "experimental", newStrNode(nkStrLit, "codeReordering"))
+
proc printNimHeader*(gState: State) =
# Top level output with context info
gecho """# Generated at $1
@@ -1793,9 +1792,9 @@ proc printNim*(gState: State) =
# Create output to Nim using Nim compiler renderer
var
tree = newNode(nkStmtList)
+ tree.add gState.pragmaSection
tree.add gState.enumSection
tree.add gState.constSection
- tree.add gState.pragmaSection
tree.add gState.typeSection
tree.add gState.varSection
tree.add gState.procSection