Nim/tests/macros
PMunch e9ed4dccb6 Quote do now works with result in block (#7343)
* Fix result not being able to use in quote do

This fixes the annoying issue of not be able to use result inside a
quote do block. It works by a simple trick. The quote do mechanic is
based on dynamically creating a template and immediately calling it with
the arguments found within the quote do block. Since this is called in
the scope of the macro the result variable is shadowed. This trick works
by changing all occurences of result (which shouldn't cause any issues
as result isn't used for anything else for the same reason) to another
name and then passing in an IdentNode with result as a named parameter
with that name.

Note that currently this just replaces it with a fixed named variable
"res" which should be changed to a non-colliding, dynamically created
name.

* Fix hard coded parameter "res" to anonymous symbol

This fixes the hard coded parameter "res" to be an anonymous symbol
instead so it won't collide with other parts of the argument list.

* Add test case for result in quote do block

A simple test case based on GitHub issue #7323 on how you can't put
result in a quote do block. This test verifies that it actually works
correctly now.

* Add test for explicit capturing of result

* Rebased against devel
2018-10-31 22:14:29 +01:00
..
macro_bug.nim added tests from issue #497 2015-02-01 04:37:34 -06:00
t7454.nim Return an error symbol as macro output if needed (#8116) 2018-06-27 21:43:07 +02:00
tbindsym.nim fixes #7827, bindSym enhancement (#8499) 2018-08-02 12:56:44 +02:00
tclosuremacro.nim fixes anon procs created by macros 2017-07-11 18:07:34 +02:00
tcollect.nim add tcollect test for the new for-loops as expressions feature 2018-09-11 19:14:31 +02:00
tcomplexecho.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tdumpast.nim overloading resolution for getAst; breaking change 2017-03-18 20:57:45 +01:00
tdumpast2.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tdumpastgen.nim Add CommentStmt to astGenRepr (#7313) 2018-03-16 15:57:40 +01:00
tdumptree.nim stdlib and compiler don't use .immediate anymore 2016-07-29 23:51:01 +02:00
tforloop_macro1.nim put the new for loop macros under an experimental switch named 'forLoopMacros' 2018-08-15 17:45:57 +02:00
tgensym.nim Get symbol kind (#7491) 2018-04-11 16:48:01 +02:00
tgetimpl.nim Add sym owner to macros (#8253) 2018-09-03 13:25:59 +02:00
tgettype.nim Fixed NimTypeKind enum, added missing values. (#6157) 2017-07-30 11:10:07 +02:00
tgettype2.nim added missing test files 2016-08-26 14:49:57 +02:00
tgettype3.nim fixes #5131 2016-12-20 22:42:25 +01:00
tgettypeinst.nim getTypeImpl now returns pragmas for object types (#9538) 2018-10-30 06:41:12 +01:00
tmacro1.nim added test case for or operator 2018-10-18 15:39:22 +02:00
tmacro2.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tmacro3.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tmacro4.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tmacro5.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tmacroaspragma.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tmacrogenerics.nim tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
tmacros1.nim make tests green again 2018-06-11 01:23:14 +02:00
tmacros_issues.nim More descriptive names of test files (#9531) 2018-10-29 17:07:27 +01:00
tmacros_various.nim More descriptive names of test files (#9531) 2018-10-29 17:07:27 +01:00
tmacrostmt.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
tmacrotypes.nim fixes 8754 (#8755) 2018-08-24 09:57:38 +02:00
tmemit.nim template+emit supports volatileRead and volatileWrite ops 2017-01-23 11:22:19 +01:00
tmsginfo.nim compiler: show name of instantiating context in error traces (#6763) (#9207) 2018-10-11 09:34:56 +02:00
tnewlit.nim newLit emty seq fix (#6091) 2017-07-13 17:07:33 +02:00
tnodecompare.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tquotedo.nim Quote do now works with result in block (#7343) 2018-10-31 22:14:29 +01:00
tquotewords.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
trecmacro.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
treturnsempty.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tsame_name_497.nim tester reports ignored tests and supports 'nimout'; fixes #2211 2015-02-25 12:59:32 +01:00
tsametype.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tstaticparamsmacro.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tstringinterp.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tstructuredlogging.nim A motivating example for the new bindSym behavior. 2018-05-07 09:37:49 +02:00
ttemplatesymbols.nim Better support for treating templates and macros as symbols. 2018-05-07 09:37:49 +02:00
ttryparseexpr.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
tvarargsuntyped.nim make tvarargsuntyped test deterministic, independent of compiler's hashing order 2016-12-13 08:32:30 +01:00
tvtable.nim make tests green again 2017-10-01 07:46:13 +02:00
twrapiterator.nim fixes #7093 2018-01-18 11:40:18 +01:00
typesafeprintf.nim make typesafeprintf test green 2018-07-17 20:33:42 +02:00
typesapi2.nim Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00