Skip to content

Commit

Permalink
refactor: redesigned to procedures to use all parameters
Browse files Browse the repository at this point in the history
FossilOrigin-Name: a052d49be9599126705069fde1e46d8a743f10c909ed34d978c61e6fbf882c61
  • Loading branch information
thindil committed Feb 8, 2024
1 parent 5505884 commit d0460f7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/theme.nim
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ proc dbValue(val: ColorName): DbValue {.raises: [], tags: [],
body:
dbValue(v = $val)

{.push ruleOff: "paramsUsed".}
proc to(dbVal: DbValue, T: typedesc[ColorName]): T {.raises: [], tags: [],
contractual.} =
## Convert the value from the database to enumeration
Expand All @@ -97,10 +96,9 @@ proc to(dbVal: DbValue, T: typedesc[ColorName]): T {.raises: [], tags: [],
## Returns the converted dbVal parameter
body:
try:
parseEnum[ColorName](s = dbVal.s)
parseEnum[T](s = dbVal.s)
except:
default
{.pop ruleOff: "paramsUsed".}

proc dbType(T: typedesc[ThemeColor]): string {.raises: [], tags: [],
contractual.} =
Expand All @@ -122,7 +120,6 @@ proc dbValue(val: ThemeColor): DbValue {.raises: [], tags: [],
body:
dbValue(v = $val)

{.push ruleOff: "paramsUsed".}
proc to(dbVal: DbValue, T: typedesc[ThemeColor]): T {.raises: [], tags: [],
contractual.} =
## Convert the value from the database to enumeration
Expand All @@ -133,10 +130,9 @@ proc to(dbVal: DbValue, T: typedesc[ThemeColor]): T {.raises: [], tags: [],
## Returns the converted dbVal parameter
body:
try:
parseEnum[ThemeColor](s = dbVal.s)
parseEnum[T](s = dbVal.s)
except:
errors
{.pop ruleOff: "paramsUsed".}

proc newColor*(name: ThemeColor = errors; cValue: ColorName = default;
description: string = ""; bold: bool = false; underline: bool = false;
Expand Down

0 comments on commit d0460f7

Please sign in to comment.