Import macros in plugin, no newlines in enum expressions, strformat issue

This commit is contained in:
Ganesh Viswanathan 2019-05-09 02:57:55 -05:00
commit 2352e77c5e
2 changed files with 3 additions and 3 deletions

View file

@ -258,7 +258,7 @@ macro cPlugin*(body): untyped =
sym.name = sym.name.replace("SDL_", "")
let
data = "import nimterop/plugin\n\n" & body.repr
data = "import macros, nimterop/plugin\n\n" & body.repr
hash = data.hash().abs()
path = getTempDir() / "nimterop_" & $hash & ".nim"

View file

@ -94,7 +94,7 @@ proc checkIdentifier(name, kind, parent, origName: string) =
if name.len != 0:
let
origStr = if name != origName: ", originally '{origName}' before 'cPlugin:onSymbol()', still" else: ""
origStr = if name != origName: &", originally '{origName}' before 'cPlugin:onSymbol()', still" else: ""
errmsg = &"Identifier '{parentStr}{name}' ({kind}){origStr} contains"
doAssert name[0] != '_' and name[^1] != '_', errmsg & " leading/trailing underscores '_'"
@ -331,7 +331,7 @@ proc getNimExpression*(expr: string): string =
(" ", ""),
("<<", " shl "), (">>", " shr "),
("^", " xor "), ("&", " and "), ("|", " or "),
("~", " not ")
("~", " not "), ("\n", " "), ("\r", "")
])
proc getSplitComma*(joined: seq[string]): seq[string] =