Commit Graph

178 Commits

Author SHA1 Message Date
Clyybber
1355b461aa Show that a variable is cursor in --expandArc (#15002) 2020-07-17 10:56:17 +02:00
Andreas Rumpf
c5358b0d4b An optimizer for ARC (#14962)
* WIP: an optimizer for ARC
* do not optimize away destructors in 'finally' if unstructured control flow is involved
* optimized the optimizer
* minor code cleanup
* first steps to .cursor inference
* cursor inference: big steps to a working solution
* baby steps
* better .cursor inference
* new feature: expandArc for easy inspection of the AST after ARC transformations
* added topt_cursor test
* adapt tests
* cleanups, make tests green
* optimize common traversal patterns
* moved test case
* fixes .cursor inference so that npeg compiles once again
* cursor inference: more bugfixes

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-07-15 23:00:06 +02:00
Araq
78513a9204 renderer.nim: more obvious debug output 2020-07-10 13:36:02 +02:00
Andreas Rumpf
da29222f86 init checks and 'out' parameters (#14521)
* I don't care about observable stores
* enforce explicit initializations
* cleaner code for the stdlib
* stdlib: use explicit initializations
* make tests green
* algorithm.nim: set result explicitly
* remove out parameters and bring the PR into a mergable state
* updated the changelog
2020-06-23 10:53:57 +02:00
cooldome
e5b64af831 Implement rendering of []=, {}, {}= braces (#14539)
* render curly braces
* fix typo
* fix test

Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-06-01 19:56:17 +02:00
Timothee Cour
5beed56d0a fix #14174 do not collapse pragma inside runnableExamples (#14385) 2020-05-18 11:03:34 +02:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
Timothee Cour
eec07b4e84 fix several bugs with repr (#13386) 2020-02-11 21:33:06 +01:00
Arne Döring
b0c06aa711 fix #12740 (#12774)
* fix #12740

* A different kind of a hack

* proper fix

* fix typo
2019-12-04 07:33:01 +00:00
Clyybber
7e747d11c6 Cosmetic compiler cleanup (#12718)
* Cleanup compiler code base

* Unify add calls

* Unify len invocations

* Unify range operators

* Fix oversight

* Remove {.procvar.} pragma

* initCandidate -> newCandidate where reasonable

* Unify safeLen calls
2019-11-28 17:13:04 +01:00
Andreas Rumpf
dfb020b174 .cursor implementation (#12637)
* cursors: first implementation
* added currently failing test
* .cursor works for doubly linked lists
* make -d:useMalloc work again
* added code to nil out refs in a destructor
* it's now called --gc:arc
* renderer.nim: render nkBreakState properly
* make simple closure iterators work without leaking
2019-11-12 15:05:36 +01:00
Andreas Rumpf
7a4d066102 make renderIds work again 2019-11-01 21:02:44 +01:00
Ridho Pratama
7ef4bffa79 renderer letAux fix only for octal literal (#12343)
* renderer letAux fix only for octal literal

* Handle when it's octal -1 for i64

* Added testcases
2019-10-08 11:12:24 +02:00
Andreas Rumpf
9d000c519a render typeof as typeof 2019-10-07 06:47:30 +02:00
Clyybber
ed1d41c51e Small ast.nim cleanup (#12156)
* Remove sonsLen
* Use Indexable
2019-09-09 11:54:15 +02:00
Andreas Rumpf
114da04cbb fixes #12029; finish the 'unused import' feature (#12064) 2019-08-27 19:18:56 +02:00
Timothee Cour
cf22dec584 genSym symbols rendered as b1_416049 instead of b1416049 (#11960) 2019-08-16 12:17:20 +02:00
Timothee Cour
511298242d fixes #10053 (#11951) 2019-08-15 15:55:48 +02:00
Arne Döring
afbcd1b330 int128 on firstOrd, lastOrd and lengthOrd (#11701)
* fixes #11847
2019-08-07 15:53:16 +02:00
Araq
87a2ced1ba there is only one style -- my style 2019-07-10 19:17:06 +02:00
Araq
fc34193483 nimpretty: code cleanups 2019-07-09 11:38:01 +02:00
cooldome
d1f6c820dd Fixes #11662: render ops priority (#11664) 2019-07-05 21:25:36 +02:00
Araq
0f4446b861 docgen: do not render the ugly <//> operator; temporary hack until 0.20 has been released 2019-05-29 10:23:39 +02:00
Araq
90e882d55b fixes #11239 2019-05-22 07:41:16 +02:00
Andreas Rumpf
e26545797e fixes #7816 (#11261) 2019-05-15 21:12:07 +02:00
Andreas Rumpf
69658ad396 fixes #11131 2019-05-13 17:25:57 +02:00
Clyybber
cc28eef38e Replace countup(x, y) with x .. y 2019-05-07 12:37:28 +02:00
Clyybber
f18b3af9d4 Replace countup(x, y-1) with x ..< y 2019-05-07 12:32:05 +02:00
Araq
045e026d0e dfa.nim: track object/tuple field accesses more precisely; sink(o.x); sink(o.y) needs to compile; activate the tuple unpacking transf.nim bugfix 2019-04-16 10:35:43 +02:00
Andreas Rumpf
bf592c4e94 more destructor based changes (#10885)
* mark user defined destructors with sfOverriden to simplify the logic
* refactoring in preparation to merge liftings and generic instantiations for destructors
* ast: introduce nkHiddenTryStmt for destructor generation in order to be able to optimize better the code later on
* renamed 'patterns' switch to 'trmacros' as it was totally misleading before
* destructors: introduce tfCheckedForDestructor flag in preparation of strict =destroy checking
* test for invalid/too late destructor introductions
* liftdestructors: make code robust for nimsuggest
* --newruntime works for hello world again
* newruntime: code generation for closures
2019-03-23 00:12:05 +01:00
Miran
bfc7522401 docgen: generate pragma after generic, fixes #10792 (#10865) 2019-03-19 12:55:28 +01:00
cooldome
d8c3df2683 fixes #10805 (#10806) 2019-03-13 10:23:06 +01:00
Alexander Ivanov
3294ce3831 Render a colon for command if last arg list (#10803) 2019-03-08 13:31:24 +01:00
Andreas Rumpf
dcc3ac74f4 don't crash when rendering wrong nkInfix nodes 2018-10-12 19:22:39 +02:00
Andreas Rumpf
86556ebfdb compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +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
Araq
1abef2dc59 improve the error message for 'addQuitProc' etc; fixes #5794 2018-09-03 12:27:23 +02:00
Araq
64517445ea even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
Andreas Rumpf
dae5450947 WIP: disallow 'nil' for strings and seqs 2018-08-13 11:41:33 +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
cooldome
231a83a6b1 Fixes #8287 (#8288) 2018-07-12 11:03:08 +02:00
Dmitry Atamanov
854aa3958f Fixes maxLineLength's bug in the renderer (#8240) 2018-07-09 20:04:57 +02:00
Zahary Karadjov
5bcf8bcb59 fixes #7222; fixes #5595; fixes #3747
* late instantiation for the generic procs' default param values
* automatic mixin behaviour in concepts

Other fixes:

* don't render the automatically inserted default params in calls
* better rendering of tyFromExpr
2018-06-16 16:46:32 +03:00
Andreas Rumpf
a1bd4a6cbd nimpretty: first version that seems useful for others to test it 2018-06-16 01:46:39 +02:00
Araq
8e9551b1c7 fixex merge conflicts 2018-06-08 19:50:36 +02:00
Andreas Rumpf
3cbc07ac78 Merge pull request #7770 from yglukhov/yield-in-try
Yield in try
2018-06-05 19:58:00 +02:00
Andreas Rumpf
18a3833d60 more refactoring 2018-05-27 15:22:17 +02:00
Andreas Rumpf
669a564492 remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
Andreas Rumpf
e55a1051ea fixes yet another index out of bounds issue in renderer.nim 2018-05-21 19:53:52 +02:00