src/necsus/compiletime/codeGenInfo

Types

CodeGenInfo = ref object
  config*: NimNode
  app*: ParsedApp
  systems*: seq[ParsedSystem]
  directives*: Table[DirectiveGen, DirectiveSet[SystemArg]]
  archetypes*: ArchetypeSet[ComponentDef]
Contains all the information needed to do high level code gen

Procs

proc appStateInit(genInfo: CodeGenInfo): NimNode {....raises: [], tags: [],
    forbids: [].}
The name of the object that contains the state of the app
proc appStateTypeName(genInfo: CodeGenInfo): NimNode {....raises: [], tags: [],
    forbids: [].}
The name of the object that contains the state of the app
proc generateForHook(codeGen: CodeGenInfo; hook: GenerateHook): NimNode {.
    ...raises: [], tags: [], forbids: [].}
Generates the code for a specific code-gen hook
proc generateForHook(codeGen: CodeGenInfo; system: ParsedSystem;
                     hook: GenerateHook): NimNode {....raises: [KeyError],
    tags: [], forbids: [].}
Generates the code for a specific code-gen hook
proc nameOf(genInfo: CodeGenInfo; arg: SystemArg): string {....raises: [KeyError],
    tags: [], forbids: [].}
Returns the name used for a specific system arg
proc newCodeGenInfo(config: NimNode; app: ParsedApp;
                    allSystems: openArray[ParsedSystem]): CodeGenInfo {.
    ...raises: [KeyError], tags: [], forbids: [].}
Collects data needed for code gen from all the parsed systems
proc newEmptyCodeGenInfo(config: NimNode; app: ParsedApp): CodeGenInfo {.
    ...raises: [KeyError], tags: [], forbids: [].}
Collects data needed for code gen from all the parsed systems
proc newGenerateContext(codeGen: CodeGenInfo; hook: GenerateHook): GenerateContext {.
    ...raises: [], tags: [], forbids: [].}
Create a GenerateContext for a hook
proc profilingEnabled(): bool {....raises: [], tags: [], forbids: [].}
Returns whether to inject system profiling code
proc systemArg(genInfo: CodeGenInfo; arg: SystemArg): NimNode {.
    ...raises: [KeyError], tags: [], forbids: [].}
Returns the value to pass to a system when executin the given argument
proc worldFields(codeGen: CodeGenInfo): seq[WorldField] {....raises: [Exception],
    tags: [RootEffect], forbids: [].}
Generates the code for a specific code-gen hook

Iterators

iterator allArgs(genInfo: CodeGenInfo): SystemArg {....raises: [], tags: [],
    forbids: [].}
Produces all system arguments within an app