fixes #120
This commit is contained in:
parent
d9d82fb0af
commit
f28b7be6a3
2 changed files with 4 additions and 7 deletions
|
|
@ -234,16 +234,14 @@ proc getAst*(macroOrTemplate: expr): PNimrodNode {.magic: "ExpandToAst".}
|
|||
## macro FooMacro() =
|
||||
## var ast = getAst(BarTemplate())
|
||||
|
||||
template emit*(s: expr): stmt =
|
||||
template emit*(e: expr[string]): stmt =
|
||||
## accepts a single string argument and treats it as nimrod code
|
||||
## that should be inserted verbatim in the program
|
||||
## Example:
|
||||
##
|
||||
## emit("echo " & '"' & "hello world".toUpper & '"')
|
||||
##
|
||||
block:
|
||||
const evaluated = s
|
||||
eval: result = evaluated.parseStmt
|
||||
eval: result = e.parseStmt
|
||||
|
||||
proc expectKind*(n: PNimrodNode, k: TNimrodNodeKind) {.compileTime.} =
|
||||
## checks that `n` is of kind `k`. If this is not the case,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue