Add reorder pragma for #209, cleanup header pragma
This commit is contained in:
parent
b14eedb541
commit
7daf32d654
1 changed files with 5 additions and 6 deletions
|
|
@ -1718,13 +1718,9 @@ proc setupPragmas(gState: State, root: TSNode, fullpath: string) =
|
||||||
dynPragma: PNode
|
dynPragma: PNode
|
||||||
|
|
||||||
if not gState.noHeader:
|
if not gState.noHeader:
|
||||||
# Path to header const
|
|
||||||
gState.constSection.add gState.newConstDef(
|
|
||||||
root, fname = gState.currentHeader, fval = '"' & fullpath & '"')
|
|
||||||
|
|
||||||
# {.pragma: impnameHdr, header: "xxx".}
|
# {.pragma: impnameHdr, header: "xxx".}
|
||||||
hdrPragma = gState.newPragma(root, "pragma", gState.getIdent(gState.impShort & "Hdr"))
|
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:
|
if gState.dynlib.nBl:
|
||||||
# {.pragma: impnameDyn, dynlib: libname.}
|
# {.pragma: impnameDyn, dynlib: libname.}
|
||||||
|
|
@ -1737,6 +1733,9 @@ proc setupPragmas(gState: State, root: TSNode, fullpath: string) =
|
||||||
if not dynPragma.isNil:
|
if not dynPragma.isNil:
|
||||||
gState.pragmaSection.add dynPragma
|
gState.pragmaSection.add dynPragma
|
||||||
|
|
||||||
|
# Add `{.experimental: "codeReordering".} for #206
|
||||||
|
gState.pragmaSection.add gState.newPragma(root, "experimental", newStrNode(nkStrLit, "codeReordering"))
|
||||||
|
|
||||||
proc printNimHeader*(gState: State) =
|
proc printNimHeader*(gState: State) =
|
||||||
# Top level output with context info
|
# Top level output with context info
|
||||||
gecho """# Generated at $1
|
gecho """# Generated at $1
|
||||||
|
|
@ -1793,9 +1792,9 @@ proc printNim*(gState: State) =
|
||||||
# Create output to Nim using Nim compiler renderer
|
# Create output to Nim using Nim compiler renderer
|
||||||
var
|
var
|
||||||
tree = newNode(nkStmtList)
|
tree = newNode(nkStmtList)
|
||||||
|
tree.add gState.pragmaSection
|
||||||
tree.add gState.enumSection
|
tree.add gState.enumSection
|
||||||
tree.add gState.constSection
|
tree.add gState.constSection
|
||||||
tree.add gState.pragmaSection
|
|
||||||
tree.add gState.typeSection
|
tree.add gState.typeSection
|
||||||
tree.add gState.varSection
|
tree.add gState.varSection
|
||||||
tree.add gState.procSection
|
tree.add gState.procSection
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue