Skip to content

Commit

Permalink
Remove newSystemVar
Browse files Browse the repository at this point in the history
  • Loading branch information
Nycto committed Feb 16, 2024
1 parent cb6c20d commit c01fa26
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
11 changes: 2 additions & 9 deletions src/necsus/compiletime/localGen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ proc worldFields(name: string, dir: MonoDirective): seq[WorldField] =
@[ (name, nnkBracketExpr.newTree(bindSym("SystemVarData"), dir.argType)) ]

proc generateLocal(details: GenerateContext, arg: SystemArg, name: string, dir: MonoDirective): NimNode =
case details.hook
of Standard:
let varIdent = ident(name)
let argType = dir.argType
return quote:
`appStateIdent`.`varIdent` = newSystemVar[`argType`]()
else:
return newEmptyNode()
return newEmptyNode()

proc systemArg(name: string, dir: MonoDirective): NimNode =
let nameIdent = name.ident
Expand All @@ -23,7 +16,7 @@ proc systemArg(name: string, dir: MonoDirective): NimNode =

let localGenerator* {.compileTime.} = newGenerator(
ident = "Local",
interest = { Standard },
interest = {},
generate = generateLocal,
chooseName = chooseLocalName,
worldFields = worldFields,
Expand Down
3 changes: 0 additions & 3 deletions src/necsus/compiletime/sharedGen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ proc generateShared(details: GenerateContext, arg: SystemArg, name: string, dir:
case details.hook
of Standard:
let varIdent = ident(name)
let argType = dir.argType
result.add quote do:
`appStateIdent`.`varIdent` = newSystemVar[`argType`]()

# Fill in any values from arguments passed to the app
for (inputName, inputDir) in details.inputs:
Expand Down
4 changes: 0 additions & 4 deletions src/necsus/runtime/systemVar.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ type

proc extract[T](sysvar: SystemVar[T]): ptr SystemVarData[T] {.inline.} = cast[ptr SystemVarData[T]](sysvar)

proc newSystemVar*[T](): SystemVarData[T] =
## Constructor
SystemVarData[T](value: none(T))

proc isEmpty*[T](sysvar: SystemVar[T]): bool {.inline.} =
## Returns whether a system variable has a value
sysvar.extract.value.isNone
Expand Down

0 comments on commit c01fa26

Please sign in to comment.