hasCustomPragma/getCustomPragmaVal: small fix (#7650)
* fix hasCustomPragma/getCustomPragmaVal for types without pragma * fix pragma on pointer test * removed trailing spaces
This commit is contained in:
parent
0dc4d6dcc2
commit
3402926372
2 changed files with 14 additions and 2 deletions
|
|
@ -51,6 +51,9 @@ block: # A bit more advanced case
|
|||
|
||||
static: assert(hasCustomPragma(myproc, alternativeKey))
|
||||
|
||||
const hasFieldCustomPragma = s.field.hasCustomPragma(defaultValue)
|
||||
static: assert(hasFieldCustomPragma == false)
|
||||
|
||||
# pragma on an object
|
||||
static:
|
||||
assert Subfield.hasCustomPragma(defaultValue)
|
||||
|
|
@ -71,6 +74,8 @@ block: # ref types
|
|||
MyFile {.defaultValue: "closed".} = ref object
|
||||
path {.defaultValue: "invalid".}: string
|
||||
|
||||
TypeWithoutPragma = object
|
||||
|
||||
var s = NodeRef()
|
||||
|
||||
const
|
||||
|
|
@ -91,7 +96,7 @@ block: # ref types
|
|||
|
||||
var ptrS = NodePtr(nil)
|
||||
const
|
||||
ptrRightSerKey = getCustomPragmaVal(s.right, serializationKey)
|
||||
ptrRightSerKey = getCustomPragmaVal(ptrS.right, serializationKey)
|
||||
static:
|
||||
assert ptrRightSerKey == "r"
|
||||
|
||||
|
|
@ -103,6 +108,9 @@ block: # ref types
|
|||
assert fileDefVal == "closed"
|
||||
assert filePathDefVal == "invalid"
|
||||
|
||||
static:
|
||||
assert TypeWithoutPragma.hasCustomPragma(defaultValue) == false
|
||||
|
||||
block:
|
||||
type
|
||||
VariantKind = enum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue