Commit Graph

99 Commits

Author SHA1 Message Date
LemonBoy
0f080fdce3 Fix range type construction in the VM (#9205)
The `range[X,Y]` representation is wrong, we use `range[X .. Y]`
instead.

Fixes #9194

(cherry picked from commit 8a1055adce)
2018-11-01 17:26:50 +01:00
Andreas Rumpf
de02f5fa0a add tcollect test for the new for-loops as expressions feature 2018-09-11 19:14:31 +02:00
cooldome
c033ff990a Renderer bug fixes (#8804)
Fixes #8763: render bug: pure enums not handled correctly
Fixes #8762: render bug: binary operators called with quotes rendered incorrectly
FIxes #8761: render bug: inversion of operator priorities
2018-09-07 01:52:42 +02:00
cooldome
e63c66b810 Add sym owner to macros (#8253) 2018-09-03 13:25:59 +02:00
LemonBoy
b74faf354e Do not materialize empty varargs[untyped] arrays (#8715)
When an empty nkArgList `varargs[untyped]` is passed around it is now
reused for efficiency sake and to prevent the introduction of a spurious
element: before this commit we'd pass the caller a
nkArgList[nkHiddenStdConv[nkBracket]] node instead of just an empty
nkArgList.

Fixes #8706
2018-08-31 12:16:46 +02:00
LemonBoy
5cd152bfda Allow hint and warning to specify its loc info (#8771)
Let's bring those to feature-parity with `error`.
2018-08-28 22:59:28 +02:00
cooldome
d5e1d102df fixes 8754 (#8755)
* fixes 8754

* improve test
2018-08-24 09:57:38 +02:00
Andreas Rumpf
da41fc1801 put the new for loop macros under an experimental switch named 'forLoopMacros' 2018-08-15 17:45:57 +02:00
andri lim
6e3d1dced5 fixes #5617, 'copyLineInfo' addition (#8523) 2018-08-05 23:38:21 +02:00
andri lim
78c0ac5407 fixes #7827, bindSym enhancement (#8499)
* bindSym power up, working prototype

* update bindSym doc

* add bindSym test

* fix some typo

* fix bindSym doc

* get rid of specialops field from vm

* add experimental: dynamicBindSym
2018-08-02 12:56:44 +02:00
cooldome
ec02940185 Render bug: if expression with statement list expression as condition (#8375)
* Fixes #8348
2018-07-21 13:01:47 +02:00
cooldome
a651809411 Fixes #8343, Fixes #8344 (#8347) 2018-07-18 14:54:44 +02:00
Andreas Rumpf
0cbfd67522 make typesafeprintf test green 2018-07-17 20:33:42 +02:00
cooldome
231a83a6b1 Fixes #8287 (#8288) 2018-07-12 11:03:08 +02:00
Andreas Rumpf
c7298561c1 system.nim: remove deprecated symbols 2018-06-28 07:42:46 +02:00
LemonBoy
52fc16d5d2 Return an error symbol as macro output if needed (#8116)
Return an error symbol if the macro output has no type and a typedesc
is expected.

Fixes #7454
2018-06-27 21:43:07 +02:00
Arne Döring
51fdb071cb fix #5930 2018-06-13 12:18:21 +02:00
Andreas Rumpf
61e1897922 make tests green again 2018-06-11 01:23:14 +02:00
Zahary Karadjov
2b8bf8fc4a A motivating example for the new bindSym behavior.
The example is a proof-of-concept logging library, allowing you to define
lexically-scoped environments where certain logging attributes are applied
automatically to all logging statements.

fixes tmacro1 (use of `bindSym` inside static blocks)
2018-05-07 09:37:49 +02:00
Zahary Karadjov
bdcb729597 Better support for treating templates and macros as symbols.
This allows you to pass a template or a macro to another macro
which can then inspect the implementation of the former template/macro
using `getImpl`.

Since templates can be freely redefined, this allows you to treat
their symbols as compile-time variables that have lexical scope.
A motivating PoC example for a logging library taking advantage of
this will be provided in the next commit.

Implementation details:

* The name of a template or a macro will be consider a symbol if
  the template/macro requires parameters

* For parameterless templates/macros, you can use `bindSym`, which
  was extended to also work outside of compile-time procs.
2018-05-07 09:37:49 +02:00
Arne Döring
9d4fd1f1bb eqIdent new returns false on non identifier types (#7629) 2018-04-17 01:23:38 +02:00
Arne Döring
ed5b7cbac0 move eqIdent to vm.nim (#7585)
* Strutils comment changes.

* fix typo
2018-04-15 23:38:43 +02:00
Andreas Rumpf
c08efb4c51 implements first version of for-loop macros 2018-04-15 01:07:28 +02:00
Arne Döring
6baca58693 Get symbol kind (#7491) 2018-04-11 16:48:01 +02:00
PMunch
a9f21cffdf Add CommentStmt to astGenRepr (#7313)
* Added codeRepr and dumpCode to the macros module.

This allows those writing macros to write examples, get the code to generate the AST for that example, and then modify that code to be dynamic with the macro function.
2018-03-16 15:57:40 +01:00
Andreas Rumpf
6a2b57b4aa fixes #7093 2018-01-18 11:40:18 +01:00
jcosborn
96a5062b8c modify getTypeImpl to reduce result to final implementation (#6891)
* added test case for getTypeImpl
* modify getTypeImpl to reduce result to final implementation
2017-12-09 13:07:37 +01:00
jcosborn
35d7a99b6a fix getTypeInst for tyGenericInst (#6868) 2017-12-04 17:37:25 +01:00
Araq
14468e2336 make tests green again 2017-11-23 14:37:53 +01:00
Andreas Rumpf
68c7da227f make tests green again 2017-10-01 07:46:13 +02:00
Andreas Rumpf
ddc131cf07 the parser finally parses 'echo {1,2}' as it should 2017-09-30 21:35:30 +02:00
BigEpsilon
6f6e6fe4eb Fix #6295 (#6296) 2017-08-30 14:44:11 +02:00
Yuriy Glukhov
8481e9ff14 Fixed NimTypeKind enum, added missing values. (#6157) 2017-07-30 11:10:07 +02:00
PMunch
e00953cbc0 Added codeRepr and dumpCode to the macros module. (#5778) 2017-07-26 00:37:37 +02:00
Arne Döring
000b8afd26 Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
Arne Döring
52cab78ae5 newLit emty seq fix (#6091)
* the type of the empty seq is still the correct type
* updated test
2017-07-13 17:07:33 +02:00
Andreas Rumpf
2ad9a16e0a fixes anon procs created by macros 2017-07-11 18:07:34 +02:00
Arne Döring
eb8e267ff6 improved comment satement support in macros (#5904) 2017-06-02 01:22:21 +02:00
Arne Döring
32143d3c7a more and improved newLit procs in macros module 2017-05-23 19:37:51 +02:00
Andreas Rumpf
503f780676 Merge branch 'zahary' into araq2 2017-05-16 17:32:18 +02:00
jcosborn
ec50dab57d fixed macros.getTypeImpl for a symbol of type tyGenericBody (#5788) (#5812)
* fixed macros.getTypeImpl for a symbol of type tyGenericBody
* added test case and commented test code
2017-05-14 15:08:41 +02:00
Zahary Karadjov
8b63b84924 fix a regression in tlexerex 2017-04-10 13:06:06 +03:00
Araq
aa4260ffa8 overloading resolution for getAst; breaking change 2017-03-18 20:57:45 +01:00
zah
1be0022e7c Fixes #5167 and related problems (#5475)
This commit returns to a bit less strict checking of the number
of macro arguments, because some old immediate macros rely on a
behavior where even the arity of the macro is not being checked.

It may be better if such macros are just declared to use varargs[expr],
but this remains for another day.
2017-03-12 09:33:49 +01:00
Fabian Keller
e2567e2e03 Fix sigsegv in getTypeImpl for unnamed tuple (#5440)
avoid sigsegv in getTypeImpl for unnamed tuple; fixes #4862
2017-03-02 15:30:19 +01:00
Andreas Rumpf
d651012688 template+emit supports volatileRead and volatileWrite ops 2017-01-23 11:22:19 +01:00
Araq
c166394024 fixes #5131 2016-12-20 22:42:25 +01:00
Araq
5c6a4d9e90 make tvarargsuntyped test deterministic, independent of compiler's hashing order 2016-12-13 08:32:30 +01:00
Andrea Ferretti
15f7094fde Added a dump macro for debugging 2016-09-22 12:07:36 +02:00
Andreas Rumpf
34dd08e9ae added missing test files 2016-08-26 14:49:57 +02:00