Support default values for seq[T] parameters

This commit is contained in:
Zahary Karadjov 2021-05-16 17:49:56 +03:00
parent f091a70a5b
commit c222804b3b
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 5 additions and 1 deletions

View File

@ -570,7 +570,11 @@ template setField[T](loc: var T, val: Option[TaintedString], defaultVal: untyped
else: FieldType(defaultVal)
template setField[T](loc: var seq[T], val: Option[TaintedString], defaultVal: untyped) =
loc.add parseCmdArgAux(type(loc[0]), val.get)
if val.isSome:
loc.add parseCmdArgAux(type(loc[0]), val.get)
else:
type FieldType = type(loc)
loc = FieldType(defaultVal)
proc makeDefaultValue*(T: type): T =
discard