Nim/compiler
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
..
nimfix implements a --nep1:on switch to make the compiler enforce the naming conventions outlined in NEP-1 2018-06-13 01:44:19 +02:00
plugins Fix locals() interaction with generic types 2018-09-21 22:35:54 +02:00
aliases.nim more modules compile again 2018-05-12 11:58:44 +02:00
ast.nim fixes tnre regression 2018-10-29 10:06:36 +01:00
astalgo.nim improve the error message for 'attempt to redefine X'; fixes #447 2018-09-17 19:54:56 +02:00
bitsets.nim Generate populationCount const at compile time (#7583) 2018-04-16 21:52:27 +02:00
btrees.nim added btrees.contains 2018-06-03 20:15:37 +02:00
canonicalizer.nim implement sizeof and alignof operator (manually squashed #5664) (#9356) 2018-10-14 00:52:28 +02:00
ccgcalls.nim Add toOpenArray[T](ptr UncheckedArray[T]) for clarity. (#9316) 2018-10-12 17:40:07 +02:00
ccgexprs.nim make tmissingbracket compile for C++; refs #7870 2018-10-30 16:52:33 +01:00
ccgliterals.nim --gc:destructors: next steps; WIP 2018-07-21 13:16:53 +02:00
ccgmerge.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
ccgstmts.nim undo try break 2018-10-30 16:35:54 +01:00
ccgthreadvars.nim remove the last global variables in the C code generator 2018-05-28 18:18:43 +02:00
ccgtrav.nim exploit nil seqs for performance (#8688) 2018-08-20 11:54:18 +02:00
ccgtypes.nim change system.nim to adhere to the style guide 2018-10-30 15:03:28 +01:00
ccgutils.nim name mangling: also special case the backslash character 2018-09-17 20:48:55 +02:00
cgen.nim fixes #5549 2018-10-30 15:30:33 +01:00
cgendata.nim Make the registered passes local to the ModuleGraph (#9259) 2018-10-09 19:24:02 +02:00
cgmeth.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
closureiters.nim Field checks for everybody (#8957) 2018-10-09 19:54:12 +02:00
cmdlinehelper.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
commands.nim Nim style checker: document the switch; fixes #9564 2018-10-30 15:03:28 +01:00
condsyms.nim added system.typeof operation; fixes #9093 2018-10-24 17:09:51 +02:00
configuration.nim remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
debuginfo.nim happy new year 2017-01-07 22:35:09 +01:00
depends.nim Make the registered passes local to the ModuleGraph (#9259) 2018-10-09 19:24:02 +02:00
destroyer.nim Remove a hack in the destroyer impl (#9479) 2018-10-24 09:11:46 +02:00
dfa.nim DFA: implement exception handling properly 2018-10-14 17:36:55 +02:00
docgen.nim Change documentation details (closes #5525) (#9542) 2018-10-31 07:40:05 +01:00
docgen2.nim Fixes #9364 and add moduleDescription to jsondoc (#9396) 2018-10-17 00:34:47 +02:00
evalffi.nim remove ast.emptyNode global; cleanup configuration.nim 2018-05-16 03:06:07 +02:00
evaltempl.nim docgen: fixes #9432 [backport] 2018-10-31 00:19:24 +01:00
extccomp.nim Compile pragma. Recompile on external file compilation failure (#9455) 2018-10-22 12:49:57 +02:00
filter_tmpl.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
filters.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
forloops.nim deprecated unary '<' 2017-10-29 08:37:13 +01:00
gorgeimpl.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
guards.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
hlo.nim New approach 2018-06-12 00:20:08 +01:00
idents.nim deprecate the .this pragma 2018-08-09 20:31:40 +02:00
idgen.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
importer.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
incremental.nim compiler: make symbolfiles feature compile again 2018-10-02 16:18:15 +02:00
installer.ini Cleanup installer.ini (#9558) 2018-10-30 06:31:17 +01:00
jsgen.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
jstypes.nim platform.nim doesn't use globals anymore; prepare msgs.nim for not using globals 2018-05-18 15:18:00 +02:00
lambdalifting.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
layouter.nim nimpretty: fixes #9506 2018-10-26 01:53:10 +02:00
lexer.nim nimpretty: fixes #9500 2018-10-25 11:48:06 +02:00
liftlocals.nim refactoring: remove idents.legacy global variable and pass the IdentCache around explicitly 2018-05-27 22:09:15 +02:00
lineinfos.nim compiler: show name of instantiating context in error traces (#6763) (#9207) 2018-10-11 09:34:56 +02:00
linter.nim Nim style checker: document the switch; fixes #9564 2018-10-30 15:03:28 +01:00
lists.nim removed compiler internal list implementation (#5371) 2017-02-22 17:33:12 +01:00
llstream.nim Merge branch 'devel' into araq-better-docgen 2018-09-14 15:48:07 +02:00
lookups.nim improve the error message for 'attempt to redefine X'; fixes #447 2018-09-17 19:54:56 +02:00
lowerings.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
macrocacheimpl.nim completed VM support for incremental compilations 2018-06-04 01:01:08 +02:00
magicsys.nim even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
main.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
modulegraphs.nim Make the registered passes local to the ModuleGraph (#9259) 2018-10-09 19:24:02 +02:00
modulepaths.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
modules.nim compiler: make symbolfiles feature compile again 2018-10-02 16:18:15 +02:00
msgs.nim compiler: show name of instantiating context in error traces (#6763) (#9207) 2018-10-11 09:34:56 +02:00
ndi.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
nim.cfg compiler/nim.cfg: cleanup --path 2018-09-21 00:31:16 +02:00
nim.nim fixes bootstrapping problems 2018-09-07 19:21:17 +02:00
nimblecmd.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
nimconf.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
nimeval.nim test case for #9180 and re-enables the disabled tcompilerapi test (#9181) 2018-10-11 09:44:35 +02:00
nimlexbase.nim fixes an off-by-one error for nimpretty 2017-10-16 00:04:46 +02:00
nimsets.nim remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
nodejs.nim Add "safety compilation". Improved, fixed messages 2015-06-04 07:33:27 +02:00
nversion.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
options.nim Nim style checker: document the switch; fixes #9564 2018-10-30 15:03:28 +01:00
packagehandling.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
parampatterns.nim Allow taking address of skForVar variables (#8632) 2018-08-14 21:28:14 +02:00
parser.nim Maps out keyword to an nnkIdent. Fixes #6011. (#9536) 2018-10-29 16:33:56 +01:00
passaux.nim Make the registered passes local to the ModuleGraph (#9259) 2018-10-09 19:24:02 +02:00
passes.nim Make the registered passes local to the ModuleGraph (#9259) 2018-10-09 19:24:02 +02:00
pathutils.nim fixes #9507 2018-10-25 11:08:46 +02:00
patterns.nim fixes more nil handling regressions 2018-08-13 17:27:44 +02:00
platform.nim fixes #8081 2018-09-22 13:52:40 +02:00
pluginsupport.nim refactoring: fewer global variables 2018-05-27 19:19:12 +02:00
pragmas.nim fixes #9358 2018-10-26 01:25:06 +02:00
prefixmatches.nim remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
procfind.nim make tests green again 2018-05-18 20:53:41 +02:00
readme.txt
renderer.nim don't crash when rendering wrong nkInfix nodes 2018-10-12 19:22:39 +02:00
reorder.nim fixes #9281 2018-10-11 19:52:48 +02:00
rod.nim compiler IC: minor improvements 2018-10-02 16:18:16 +02:00
rodimpl.nim incremental compilation: fixes basic caching logic of 'module' table 2018-10-19 16:27:20 +02:00
rodutils.nim fixes 8594 (#8721) 2018-08-22 12:16:18 +02:00
ropes.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
saturate.nim compiler: Trim .nim files trailing whitespace 2015-09-04 23:03:22 +02:00
scriptconfig.nim Add procs to retrieve project name, directory and full path to nimscript (#9274) 2018-10-11 09:56:12 +02:00
sem.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
semasgn.nim Unchecked arrays now have their own type (#9267) 2018-10-10 21:03:18 +02:00
semcall.nim replace deprecated safeAdd with add (#9416) 2018-10-18 12:29:32 +02:00
semdata.nim Fix overload resolution for pragmas evaluation (#8902) 2018-10-09 19:58:23 +02:00
semexprs.nim Quote do now works with result in block (#7343) 2018-10-31 22:14:29 +01:00
semfields.nim extended system.type/typeof to support an upcoming 'collect' macro that works much better than sugar.lc 2018-09-11 19:02:05 +02:00
semfold.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
semgnrc.nim fixes #8603 2018-10-30 11:28:45 +01:00
seminst.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
semmacrosanity.nim make tests green again 2018-08-13 23:16:03 +02:00
semmagic.nim fixes #9498, typeof is for everybody 2018-10-25 13:04:51 +02:00
semobjconstr.nim WIP: disallow 'nil' for strings and seqs 2018-08-13 11:41:33 +02:00
semparallel.nim Field checks for everybody (#8957) 2018-10-09 19:54:12 +02:00
sempass2.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
semstmts.nim Nim style checker: document the switch; fixes #9564 2018-10-30 15:03:28 +01:00
semtempl.nim fixes regressions 2018-10-30 11:28:45 +01:00
semtypes.nim Nim style checker: document the switch; fixes #9564 2018-10-30 15:03:28 +01:00
semtypinst.nim Change the order of compilation passes, transformation is made lazy at code gen (#8489) 2018-10-18 20:21:25 +02:00
sighashes.nim Merge pull request #8966 from LemonBoy/fix-8964 2018-09-14 22:28:12 +02:00
sigmatch.nim Fixes 6544 (#9427) 2018-10-19 21:04:32 +02:00
sizealignoffsetimpl.nim Merge pull request #9511 from krux02/krux02-devel 2018-10-31 17:12:36 +01:00
suggest.nim .error for routines now can also have a custom error message; improve error message for 'nil' strings 2018-09-25 00:28:39 +02:00
syntaxes.nim nimpretty: fixes #9384 2018-10-17 13:07:29 +02:00
tccgen.nim fixes the remaining fixable Nimrod->Nim renamings; closes #2032 2018-09-03 09:34:31 +02:00
transf.nim Transf minor code optimization (#9433) 2018-10-19 20:17:30 +02:00
trees.nim introduce nkTupleConstr AST node for unary tuple construction; breaking change 2018-04-13 17:45:58 +02:00
treetab.nim even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
types.nim fixes #9532 2018-10-28 13:23:27 +01:00
typesrenderer.nim even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
vm.nim Add test 2018-10-24 20:29:51 +01:00
vmdef.nim Add int float casts to vm 2018-10-24 11:24:23 +01:00
vmdeps.nim getTypeImpl now returns pragmas for object types (#9538) 2018-10-30 06:41:12 +01:00
vmgen.nim fix compiler crash 2018-10-30 13:50:06 +01:00
vmhooks.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
vmmarshal.nim even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
vmops.nim compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
wordrecg.nim Unchecked arrays now have their own type (#9267) 2018-10-10 21:03:18 +02:00
writetracking.nim remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00

This directory contains the Nim compiler written in Nim. Note that this
code has been translated from a bootstrapping version written in Pascal, so
the code is **not** a poster child of good Nim code.