Macro Utils
⚠ Warning: This Module Is LOW-LEVEL API ⚠
Consts
slots = r"hpxSlots"
UniqueComponentId = "uniqCompId"
uniqueId = r"uniqueId"
Procs
proc addAttribute(node, key, value: NimNode; inComponent: bool = false) {. ...raises: [], tags: [], forbids: [].}
proc attribute(attr: NimNode; inComponent: bool = false): NimNode {....raises: [], tags: [], forbids: [].}
- Converts nnkExprEqExpr to nnkColonExpr
proc bracket(node: seq[NimNode] | seq[string]): NimNode
proc bracket(node: varargs[NimNode]): NimNode {....raises: [], tags: [], forbids: [].}
proc buildHtmlProcedure(root, body: NimNode; inComponent: bool = false; componentName: NimNode = newEmptyNode(); inCycle: bool = false; cycleTmpVar: string = ""; compTmpVar: NimNode = newEmptyNode(); cycleVars: var seq[NimNode]; parent: NimNode = newEmptyNode()): NimNode {....raises: [], tags: [], forbids: [].}
proc discardStmt(): NimNode {....raises: [], tags: [], forbids: [].}
proc enableWarning(warnName: static[string]; enable: static[bool]): NimNode
proc endsWithBuildHtml(statement: NimNode): bool {....raises: [], tags: [], forbids: [].}
proc findAllUses(body, name: NimNode; uses: var seq[NimNode]) {....raises: [], tags: [], forbids: [].}
- Рекурсивно ищет все использования идентификатора name в дереве AST body.
proc formatNode(node: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
proc getIdentUses(body, name: NimNode): seq[NimNode] {....raises: [], tags: [], forbids: [].}
- Возвращает все использования идентификатора name в дереве AST body.
proc getTagName(name: string): string {....raises: [], tags: [], forbids: [].}
-
Checks tag name at compile time
tagDiv, tDiv, hDiv -> div
proc isExpr(node: NimNode): bool {....raises: [], tags: [], forbids: [].}
proc isIdentUsed(body, name: NimNode): bool {....raises: [], tags: [], forbids: [].}
- Finds usage ident name in body
proc liveviewParam(name: string): NimNode {....raises: [], tags: [], forbids: [].}
proc newCast(fromType, toType: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
proc newLambda(body: NimNode; params: seq[NimNode] | NimNode = @[newEmptyNode()]; pragmas: seq[NimNode] | seq[string] = @[newEmptyNode()]): NimNode
- Creates a new lambda
proc newMultiVarStmt(extractNames: openArray[NimNode]; val: NimNode; isLet: bool = false): NimNode {....raises: [], tags: [], forbids: [].}
proc pragmaBlock(pragmas: openArray[NimNode]; statementList: NimNode): NimNode {. ...raises: [], tags: [], forbids: [].}
proc replaceIter(root: NimNode; search: proc (x: NimNode): bool; replace: proc (x: NimNode): NimNode): bool {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
proc replaceSelfComponent(statement, componentName: NimNode; parent: NimNode = nil; convert: bool = false; is_constructor: bool = false; is_field: bool = true): NimNode {. discardable, ...raises: [], tags: [], forbids: [].}
proc replaceUseInComponent(body: NimNode) {....raises: [], tags: [], forbids: [].}
proc useComponent(statement: NimNode; inCycle, inComponent: bool; cycleTmpVar: string; compTmpVar: NimNode; cycleVars: var seq[NimNode]; returnTagRef: bool = true; constructor: bool = false; nameIsIdent: bool = false): NimNode {. ...raises: [], tags: [], forbids: [].}