parameter passing works the same for macros and templates; use callsite magic to access the invokation AST

This commit is contained in:
Araq 2012-08-28 22:15:29 +02:00
commit b4844a189d
16 changed files with 270 additions and 180 deletions

View file

@ -262,12 +262,13 @@ macro `<>`*(x: expr): expr =
## Constructor macro for XML. Example usage:
##
## .. code-block:: nimrod
## <>a(href="http://force7.de/nimrod", "Nimrod rules.")
## <>a(href="http://nimrod-code.org", "Nimrod rules.")
##
## Produces an XML tree for::
##
## <a href="http://force7.de/nimrod">Nimrod rules.</a>
## <a href="http://nimrod-code.org">Nimrod rules.</a>
##
let x = callsite()
result = xmlConstructor(x)
proc child*(n: PXmlNode, name: string): PXmlNode =