summary refs log tree commit diff stats
path: root/compiler/renderer.nim
Commit message (Collapse)AuthorAgeFilesLines
* fix spurious indent and newlines in rendering of nkRecList (#23121)metagn2023-12-241-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rendering of `nkRecList` produces an indent and adds a new line at the end. However for things like case object `of`/`else` branches or `when` branches this is already done, so this produces 2 indents and an extra new line. Instead, just add an indent in the place where the indent that `nkRecList` produces is needed, for the rendering of the final node of `nkObjectTy`. There doesn't seem to be a need to add the newline. Before: ```nim case x*: bool of true: y*: int of false: nil ``` After: ```nim case x*: bool of true: y*: int of false: nil ```
* retain postfix node in type section typed AST, with docgen fix (#23101)metagn2023-12-231-7/+18
| | | | | | Continued from #23096 which was reverted due to breaking a package and failing docgen tests. Docgen should now work, but ~~a PR is still pending for the package: https://github.com/SciNim/Unchained/pull/45~~ has been merged
* Types: Refactorings; step 1 (#23055)Andreas Rumpf2023-12-121-1/+1
|
* lexer cleanups (#23037)Jacek Sieka2023-12-061-4/+2
| | | | * remove some dead code and leftovers from past features * fix yaml printing of uint64 literals
* prepare for the enforcement of `std` prefix (#22873)ringabout2023-10-291-1/+3
| | | follow up https://github.com/nim-lang/Nim/pull/22851
* fixes #8893; guard against array access in renderer (#22807)ringabout2023-10-091-1/+1
| | | fixes #8893
* renderIr should print the actual return assign node (#22682)ringabout2023-09-101-2/+2
| | | | | | | | | | | | | | | | | | follow up https://github.com/nim-lang/Nim/pull/10806 Eventually we need a new option to print high level IR. It's confusing when I'm debugging the compiler without showing `return result = 1` using the expandArc option. For ```nim proc foo: int = return 2 ``` It now outputs when expanding ARC IR ```nim proc foo: int = return result = 2 ```
* don't render underscore identifiers with id (#22538)metagn2023-08-231-3/+5
|
* refactors initSrcGen and initTokRender into returning objects (#22421)ringabout2023-08-091-53/+31
|
* use strictdefs for compiler (#22365)ringabout2023-08-061-17/+29
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* `infixArgument` fail in `renderer.nim` sometimes (#22264)Ryan McConnell2023-07-201-1/+5
| | | | | * fixing minor typo * Adding err msg
* Fix non-toplevel fields in objects not getting rendered (#22266)Jake Leahy2023-07-161-24/+71
| | | | | | | | | | | | | * Add example object into testproject The proc is there to check the case of an identDef being inside an identDef (We do want to render those even if they are not exported) * Add `inside` set to `TSrcGen` which allows us to see what context we are in This is done instead of adding another inXyz bool parameter We then use this to know if we are inside an object when rendering an nkIdentDefs (To know if we need to skip rendering it) * Update test files
* fix dot calls with resolved symbols in templates (#22076)metagn2023-06-121-0/+1
| | | | | | | | | | | | | * fix dot calls with resolved symbols in templates * make old code work * fix custom number literals test * remove leftover debug marker * enable "bug 9" test too * fix renderer, add test for #7085
* clean up SOME pending/xxx/issue link comments (#21826)metagn2023-05-111-7/+1
| | | | | * clean up SOME pending/xxx/issue link comments * great
* fixes #21483; fixes nim doc skips documentation of annotated elements of ↵ringabout2023-04-291-1/+1
| | | | | | | | | objects (#21743) * fixes #21483; skipPragmaExpr * add a test case for #21483 * fixes HTML
* fixes #19396; Nimdoc hide nonexported fields (#21305)ringabout2023-02-011-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * suppresses non-exported fields of types and adds command-line option to re-enable this if desired * corrected the doctest that produced a CI error * an embarrassingly bad error in reasoning * modified a nimdoc test to reflect updated behavior * needed another change to bring utils.html doctest in sync with update * add info * fix nimdoc * lint * render postfix * fixes a problem * fixes nimdoc * fix nimdoc --------- Co-authored-by: johnperry-math <john.perry@usm.edu> Co-authored-by: johnperry-math <devotus@yahoo.com>
* remove legacy code (#21134)ringabout2022-12-261-4/+3
| | | | | * remove legacy code * fixes
* Make async stacktraces less verbose (#21091)Jake Leahy2022-12-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | * Name iterators something human readable Remove intermediate async procs from stacktraces Clean async traceback message from reraises message * Remove unused import/variable * Fix failing tests Don't add {.stackTrace: off.} to anonymous procs (They already don't appear in stacktrace) * Fix failing tests in pragma category Now check that the nim is a routine type first so we don't run into any assertion defects * Hide stack trace pragma in docs and update doc tests User doesn't need to know if something won't appear so this more becomes verbose noise If this is a bad idea we can always add a `when defined(nimdoc)` switch so we don't add {.stackTrace: off.} to the Future[T] returning proc for docs
* Docs expand `using` parameters (#21076)Jake Leahy2022-12-121-4/+29
| | | | | | | | | | | | | | | * Trying to fix by changing renderer * add renderExpandUsing flag This flag makes the renderer expand parameters that use using statement to have their full type * Update docs * Make comment better explain why checking for nkSym * Fix nil access when macro/template has parameter with no type * Fix nil access when node is not semmed yet
* alternative, much simpler algorithm for strict func checking (#21066)Andreas Rumpf2022-12-111-1/+5
| | | | | | | | | | | | | * alternative, much simpler algorithm for strict func checking * forgot to git add new compiler module * new spec is incredibly simple to describe * fixes bigints regression * typos * closes #16305; closes #17387; closes #20863
* render post expr blocks better (#20871)metagn2022-11-221-23/+42
| | | | | | | * render post expr blocks * remove pointless diff * fix PR split mistake
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-1/+6
| | | | | * fixes #20572 * added a test case
* fixes #20524; add forbids pragmas to hideable lists (#20525)ringabout2022-10-091-1/+1
| | | | | * fixes #20524; add forbids pragmas to hideable lists * fixes nimdoc
* DAA and 'out' parameters (#20506)Andreas Rumpf2022-10-061-3/+9
| | | | | | | | | | | * DAA and 'out' parameters * progress * documented strictDefs and out parameters * docs, tests and a bugfix * fixes silly regression
* moderate system cleanup & refactor (#20355)metagn2022-09-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * system refactor, move out 600 lines * compilation, slice, backwardsindex, misc_num moved out of system * some procs/types moved into arithmetics, basic_types * system no longer depends on syncio * some procs moved around to fit with their surroundings * make exceptions an import, old ops to misc_num * move instantiationInfo back * move back nim version, fix windows echo * include compilation * better docs for imported modules, fix unsigned ops also remove ze, ze64, toU8, toU16, toU32 with nimPreviewSlimSystem * fix terminal * workaround IC test & weird csize bug, changelog * move NimMajor etc back to compilation, rebase for CI * try ic fix * form single `indices`, slim out TaintedString, try fix IC * fix CI, update changelog, addQuitProc * fix CI * try fix CI * actually fix CI finally hopefully * Update lib/system/compilation.nim Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * update kochdocs * hopefully fix csize uses for slimsystem * fix tquit Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* move formatfloat out of system (#20195)ringabout2022-08-241-1/+1
| | | | | | | | | | | | | | | * move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
* fix NimNode comment repr() regression [backport: 1.2] (#19726)flywind2022-04-251-0/+2
|
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* fix wrong name (rnimsyn => renderer; pnimsyn => parser; scanner => lexer) ↵flywind2021-09-251-2/+2
| | | | | | | (#18895) * fix wrong module name * rephrase more word
* properly fix #10053 ; `FieldDefect` msg now shows discriminant value + ↵Timothee Cour2021-08-131-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lineinfo, in all backends (c,vm,js) (#11955) * fix #10053 FieldError for vm * fixup * FieldError now also shows runtime value of discriminant * fix field error reporting in vm * also report culprit line info in err msg * fix errors for newruntime 2 * fix for js * fixup * PRTEMP4 * works * works * works perfect * refactor * std/private/repr_impl * suppport --gc:arc * cleanup * refactor * simplify * simplify * simplify * fixup * move out compiler.vmgen.genCustom * fixup * fixup * add tests * revert compiler/debugutils.nim * simplify reprDiscriminant * fixup * lib/std/private/repr_impl.nim -> lib/system/repr_impl.nim * try to fix D20210812T165220 * honor --declaredlocs * control toFileLineCol via --declaredlocs
* nim doc now correctly renders deprecated pragmas for routines and types (#18515)Timothee Cour2021-07-191-2/+2
|
* fixes #15884 (#18230)Andreas Rumpf2021-06-101-0/+2
| | | | | * fixes #15884 * micro optimization
* Remove confusing <//> (#17830)flywind2021-04-261-4/+1
|
* refs #17292 fix `repr`: `(discard)` now does't render as `discard` which ↵Timothee Cour2021-04-161-1/+7
| | | | | | | gave illegal code (#17455) * refs #17292 fix `repr` with (discard) * add tests * add more tests
* make repr handle setters `foo=` (#17683)Timothee Cour2021-04-091-5/+8
|
* ast: add getPIdent (#17684)Timothee Cour2021-04-091-11/+9
| | | | | * ast: add getPIdent * fixup
* fix #14850: `repr` now correctly renders `do` (#17623)Timothee Cour2021-04-031-7/+13
| | | | | | | * fix #14850: `repr` now correctly renders `do` * add tests * fix test
* repr: fix rendering of `'big`, `=destroy` etc (#17624)Timothee Cour2021-04-031-3/+19
|
* docgen: render pragmas by default except for a select list (and fix #9074) ↵Timothee Cour2021-04-011-1/+21
| | | | (#17054)
* unify tuple expressions (#13793)Arne Döring2021-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * unify tuple expressions * fix test * fix test * apply feedback * Handle empty tuples * Fix rendering named unary tuple * Protect static NimNode against stripping * Slightly less hacky * Revert "Slightly less hacky" This reverts commit 170c5aec0addc029f637afbc948700ca006b7942. * Slightly less hacky * Cleanup * Fix test * Fix another test * Add condsym * Rebase fallout * changelog: Move from compiler changes to language changes * Add stricter tests * Add empty tuple example to doc/astspec * Fix test Co-authored-by: Clyybber <darkmine956@gmail.com>
* added nkError to the AST (#17567)Andreas Rumpf2021-03-291-0/+4
| | | | | | | | | | | | | * added nkError to the AST * Update lib/core/macros.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Update compiler/ast.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* custom integer literals (#17489)Andreas Rumpf2021-03-241-4/+14
| | | | | | | * user defined integer literals; refs #17020 * updated renderer.nim * use mlexerutils helper * imported all test cases from https://github.com/nim-lang/Nim/pull/17020 * final grammar updated
* refs #17292 fix `repr` with `do:` (#17449)Timothee Cour2021-03-231-3/+10
| | | | | * refs #17292 fix `repr` with `do:` * address comment
* Fix #14325 (#17308)Clyybber2021-03-111-2/+2
| | | | | * Fix #14325 * Refactor and fix
* fix #13491 #17279 runnableExamples now don't get lost in translation (#17282)Timothee Cour2021-03-091-1/+1
| | | | | * fix #13491 runnableExamples rendering * fix a runnableExamples thanks to this bugfix
* Use nicer escape sequences in renderer.nim (#17239)Clyybber2021-03-021-11/+11
|
* ARC Analysis in one pass v3 (#17068)Clyybber2021-02-171-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut * Cache alias results This improves performance by a lot, since many CFG locations map to a single PNode * Improve performance * Improve performance * Cleanup * Fix #17025 * Grammar * Expand testcase
* Revert "ARC: Analysis in one pass v2 (#17000)" (#17046)Clyybber2021-02-151-9/+9
| | | This reverts commit 216be4060a853b3425501318537d598c4842eefc.
* ARC: Analysis in one pass v2 (#17000)Clyybber2021-02-101-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut * Cache alias results This improves performance by a lot, since many CFG locations map to a single PNode * Improve performance * Improve performance * Cleanup
* Revert "ARC Analysis in one pass (#16849)" (#16984)Clyybber2021-02-091-9/+9
| | | This reverts commit ab740cb5b9bfbacece26956fa2444763a790ccd1.