Export exported fields in gdobj
This commit is contained in:
parent
fb8c42a2cc
commit
728e3012c6
1 changed files with 6 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ type
|
||||||
hint: string
|
hint: string
|
||||||
hintTip: string
|
hintTip: string
|
||||||
usage: string
|
usage: string
|
||||||
|
isExported: bool
|
||||||
|
|
||||||
MethodDecl = ref object
|
MethodDecl = ref object
|
||||||
name: string
|
name: string
|
||||||
|
|
@ -123,7 +124,8 @@ proc identDefsToVarDecls(identDefs: NimNode): seq[VarDecl] =
|
||||||
hint: hint,
|
hint: hint,
|
||||||
hintTip: hintTip,
|
hintTip: hintTip,
|
||||||
isNoGodot: isNoGodot,
|
isNoGodot: isNoGodot,
|
||||||
usage: usage
|
usage: usage,
|
||||||
|
isExported: nameNode.isExported()
|
||||||
))
|
))
|
||||||
|
|
||||||
proc parseMethod(meth: NimNode): MethodDecl =
|
proc parseMethod(meth: NimNode): MethodDecl =
|
||||||
|
|
@ -375,7 +377,9 @@ proc genType(obj: ObjectDecl): NimNode {.compileTime.} =
|
||||||
if not decl.defaultValue.isNil and decl.defaultValue.kind != nnkEmpty:
|
if not decl.defaultValue.isNil and decl.defaultValue.kind != nnkEmpty:
|
||||||
parseError(decl.defaultValue,
|
parseError(decl.defaultValue,
|
||||||
"Default values are not supported for fields for now.")
|
"Default values are not supported for fields for now.")
|
||||||
recList.add(newIdentDefs(decl.name, decl.typ))
|
let name = if not decl.isExported: decl.name
|
||||||
|
else: postfix(decl.name, "*")
|
||||||
|
recList.add(newIdentDefs(name, decl.typ))
|
||||||
|
|
||||||
# 2. {.this: self.} for convenience
|
# 2. {.this: self.} for convenience
|
||||||
result.add(newNimNode(nnkPragma).add(newNimNode(nnkExprColonExpr).add(
|
result.add(newNimNode(nnkPragma).add(newNimNode(nnkExprColonExpr).add(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue