Allow gdExport without Nim export
This commit is contained in:
parent
fd40716b58
commit
f91a0d0364
1 changed files with 3 additions and 12 deletions
|
|
@ -125,10 +125,6 @@ proc identDefsToVarDecls(identDefs: NimNode): seq[VarDecl] =
|
||||||
let hintStr = removeStrPragma(nameNode, "hintStr")
|
let hintStr = removeStrPragma(nameNode, "hintStr")
|
||||||
let usage = removeStrPragma(nameNode, "usage")
|
let usage = removeStrPragma(nameNode, "usage")
|
||||||
let isGdExport = removePragma(nameNode, "gdExport")
|
let isGdExport = removePragma(nameNode, "gdExport")
|
||||||
if not nameNode.isExported() and isGdExport:
|
|
||||||
parseError(nameNode, "gdExport is not applicable for private fields")
|
|
||||||
|
|
||||||
let isNoGodot = not nameNode.isExported() or not isGdExport
|
|
||||||
|
|
||||||
result.add(VarDecl(
|
result.add(VarDecl(
|
||||||
name: if nameNode.kind == nnkPragmaExpr: nameNode[0].basename()
|
name: if nameNode.kind == nnkPragmaExpr: nameNode[0].basename()
|
||||||
|
|
@ -137,21 +133,16 @@ proc identDefsToVarDecls(identDefs: NimNode): seq[VarDecl] =
|
||||||
defaultValue: identDefs[identDefs.len - 1],
|
defaultValue: identDefs[identDefs.len - 1],
|
||||||
hint: hint,
|
hint: hint,
|
||||||
hintStr: hintStr,
|
hintStr: hintStr,
|
||||||
isNoGodot: isNoGodot,
|
isNoGodot: not isGdExport,
|
||||||
usage: usage,
|
usage: usage,
|
||||||
isExported: nameNode.isExported()
|
isExported: nameNode.isExported()
|
||||||
))
|
))
|
||||||
|
|
||||||
proc parseMethod(meth: NimNode): MethodDecl =
|
proc parseMethod(meth: NimNode): MethodDecl =
|
||||||
assert(meth.kind in {nnkProcDef, nnkMethodDef})
|
assert(meth.kind in {nnkProcDef, nnkMethodDef})
|
||||||
let methName = meth[0]
|
|
||||||
let isGdExport = removePragma(meth, "gdExport")
|
let isGdExport = removePragma(meth, "gdExport")
|
||||||
if not methName.isExported() and isGdExport:
|
let isNoGodot = (meth.kind != nnkMethodDef and not isGdExport) or
|
||||||
parseError(meth, "gdExport is not applicable for private procs/methods")
|
removePragma(meth, "noExport")
|
||||||
let isNoGodot = meth.kind != nnkMethodDef and (
|
|
||||||
not methName.isExported() or
|
|
||||||
not isGdExport
|
|
||||||
) or removePragma(meth, "noExport")
|
|
||||||
result = MethodDecl(
|
result = MethodDecl(
|
||||||
name: $meth[0].basename,
|
name: $meth[0].basename,
|
||||||
args: newSeq[VarDecl](),
|
args: newSeq[VarDecl](),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue