made tsequtils green again
This commit is contained in:
parent
22188a0647
commit
f3980eb24a
5 changed files with 45 additions and 8 deletions
|
|
@ -221,6 +221,15 @@ template emit*(s: expr): stmt =
|
||||||
block:
|
block:
|
||||||
const evaluated = s
|
const evaluated = s
|
||||||
eval: result = evaluated.parseStmt
|
eval: result = evaluated.parseStmt
|
||||||
|
when false:
|
||||||
|
template once(x: expr): expr =
|
||||||
|
block:
|
||||||
|
const y = x
|
||||||
|
y
|
||||||
|
|
||||||
|
macro `payload`(x: stmt): stmt = result = once(s).parseStmt
|
||||||
|
`payload`()
|
||||||
|
|
||||||
|
|
||||||
proc expectKind*(n: PNimrodNode, k: TNimrodNodeKind) {.compileTime.} =
|
proc expectKind*(n: PNimrodNode, k: TNimrodNodeKind) {.compileTime.} =
|
||||||
## checks that `n` is of kind `k`. If this is not the case,
|
## checks that `n` is of kind `k`. If this is not the case,
|
||||||
|
|
@ -323,7 +332,7 @@ proc lispRepr*(n: PNimrodNode): string {.compileTime.} =
|
||||||
|
|
||||||
macro dumpTree*(s: stmt): stmt = echo s[1].treeRepr
|
macro dumpTree*(s: stmt): stmt = echo s[1].treeRepr
|
||||||
## Accepts a block of nimrod code and prints the parsed abstract syntax
|
## Accepts a block of nimrod code and prints the parsed abstract syntax
|
||||||
## tree using the `toTree` function.
|
## tree using the `toTree` function. Printing is done *at compile time*.
|
||||||
##
|
##
|
||||||
## You can use this as a tool to explore the Nimrod's abstract syntax
|
## You can use this as a tool to explore the Nimrod's abstract syntax
|
||||||
## tree and to discover what kind of nodes must be created to represent
|
## tree and to discover what kind of nodes must be created to represent
|
||||||
|
|
@ -331,7 +340,7 @@ macro dumpTree*(s: stmt): stmt = echo s[1].treeRepr
|
||||||
|
|
||||||
macro dumpLisp*(s: stmt): stmt = echo s[1].lispRepr
|
macro dumpLisp*(s: stmt): stmt = echo s[1].lispRepr
|
||||||
## Accepts a block of nimrod code and prints the parsed abstract syntax
|
## Accepts a block of nimrod code and prints the parsed abstract syntax
|
||||||
## tree using the `toLisp` function.
|
## tree using the `toLisp` function. Printing is done *at compile time*.
|
||||||
##
|
##
|
||||||
## See `dumpTree`.
|
## See `dumpTree`.
|
||||||
|
|
||||||
|
|
|
||||||
24
tests/run/tdumptree.nim
Normal file
24
tests/run/tdumptree.nim
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
discard """
|
||||||
|
output: '''StmtList
|
||||||
|
VarSection
|
||||||
|
IdentDefs
|
||||||
|
Ident !"x"
|
||||||
|
nil
|
||||||
|
Call
|
||||||
|
DotExpr
|
||||||
|
Ident !"foo"
|
||||||
|
Ident !"create"
|
||||||
|
IntLit 56'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
import macros
|
||||||
|
|
||||||
|
#emit("type\n TFoo = object\n bar: int")
|
||||||
|
|
||||||
|
#var f: TFoo
|
||||||
|
#f.bar = 5
|
||||||
|
#echo(f.bar)
|
||||||
|
|
||||||
|
dumpTree:
|
||||||
|
var x = foo.create(56)
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tsequtils.nim"
|
file: "tsequtils.nim"
|
||||||
output: '''Zip: [{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "b": 6}]
|
output: '''Zip: [{"Field0": 1, "Field1": 2}, {"Field0": 3, "Field1": 4}, {"Field0": 5, "Field1": 6}]
|
||||||
Filter Iterator: 3
|
Filter Iterator: 3
|
||||||
Filter Iterator: 5
|
Filter Iterator: 5
|
||||||
Filter Iterator: 7
|
Filter Iterator: 7
|
||||||
|
|
|
||||||
3
todo.txt
3
todo.txt
|
|
@ -1,7 +1,8 @@
|
||||||
version 0.9.0
|
version 0.9.0
|
||||||
=============
|
=============
|
||||||
|
|
||||||
- make templates hygienic by default
|
- make templates hygienic by default: try to gensym() everything in the 'block'
|
||||||
|
of a template
|
||||||
- ``bind`` for overloaded symbols does not work apparently
|
- ``bind`` for overloaded symbols does not work apparently
|
||||||
- ``=`` should be overloadable; requires specialization for ``=``
|
- ``=`` should be overloadable; requires specialization for ``=``
|
||||||
- fix remaining generics bugs
|
- fix remaining generics bugs
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ Changes affecting backwards compatibility
|
||||||
- Deprecated ``system.GC_setStrategy``.
|
- Deprecated ``system.GC_setStrategy``.
|
||||||
- ``re.findAll`` and ``pegs.findAll`` don't return *captures* anymore but
|
- ``re.findAll`` and ``pegs.findAll`` don't return *captures* anymore but
|
||||||
matching *substrings*.
|
matching *substrings*.
|
||||||
|
- RTTI and thus the ``marshall`` module don't contain the proper field names
|
||||||
|
of tuples anymore. This had to be changed as the old behaviour never
|
||||||
|
produced consistent results.
|
||||||
|
|
||||||
|
|
||||||
Compiler Additions
|
Compiler Additions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue