summary refs log tree commit diff stats
path: root/compiler/jsgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* Fix global destructor injection for JS backend (#19797)quantimnot2022-05-231-5/+25
| | | | | | | | | | | | | | * Fix global destructor injection for JS backend * Moved global destructors injection before the final call to transform and generate JS code. It had previously been after and thus not no JS was generated for them. * Added some internal documentation of `jsgen`. * Enable a current destructor test to cover the JS backend as well. * Fixes the JS aspect of #17237. * Fixed global destructor injection order for JS backend Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* remove tmpFramePtr when optStackTrace is absent (#19649)flywind2022-03-261-4/+0
|
* remove unnecessary framePtr code (#19645)flywind2022-03-251-3/+6
|
* Fix #18662 (#19534)Evan Typanski2022-02-281-1/+3
|
* Optimize lent in JS [backport:1.6] (#19393)hlaaftana2022-01-171-15/+36
| | | | | | | * Optimize lent in JS [backport:1.6] * addr on lent doesn't work anymore, don't use it * use unsafeAddr in test again for older versions
* Fixed generic distinct conversions for 'var' (#18837)Jason Beetham2021-10-261-62/+76
| | | | | | | | | | | | | | | * SameTypeAux now properly traverses generic distincts * Smarter traversal of distincts * Removed redundant check * Fixed nkConv for jsgen * Added test for non distinct nkConv * using skiptypes for distinct now * Fixed genaddr for nkconv
* correct effect tracking for .borrowed procs [backport] (#18882)Andreas Rumpf2021-09-231-1/+1
| | | | | | | | | | | * correct effect tracking for .borrowed procs [backport] * progress * fix error message in a test * correctly fix it Co-authored-by: narimiran <narimiran@disroot.org>
* fix for js strict mode (#18799)Sven Keller2021-09-041-1/+1
| | | | | | | | * Assignments, which would accidentally create global variables, instead throw an error in strict mode * Assignment to a getter-only property Co-authored-by: Sven Keller <s.keller@cortona.de>
* allow building 1.4.0 from devel (#18708)Timothee Cour2021-08-181-0/+1
| | | | | * allow building 1.4.0 from devel * changelog
* properly fix #10053 ; `FieldDefect` msg now shows discriminant value + ↵Timothee Cour2021-08-131-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove unused imports, and deprecated function usage (#18663)Kyle Brown2021-08-111-1/+1
| | | | | | | * clean up imports and slice to remove delete * revert buggy code * Replace "delete" with setlen to remove depreciation warning
* fixes #18469 (#18544)Andreas Rumpf2021-07-201-10/+0
| | | | | * fixes #18469 * Update compiler/injectdestructors.nim
* make -d:nimFpRoundtrips work consistently in vm vs rt, fix #18400, etc (#18531)Timothee Cour2021-07-201-6/+1
| | | | | | * compiler/vmhooks: add getVar to allow vmops with var params * addFloat vmops with var param * cgen now renders float32 literals in c backend using roundtrip float to string
* ORC: support for custom =trace procs (#18459)Andreas Rumpf2021-07-091-1/+1
| | | | | | | | | | | * ORC: support custom =trace procs (WIP) * Update tests/arc/tcustomtrace.nim Co-authored-by: Clyybber <darkmine956@gmail.com> * =trace is now documented and seems to work * make test green Co-authored-by: Clyybber <darkmine956@gmail.com>
* fixes #18319 (#18375)Andreas Rumpf2021-06-281-2/+12
|
* followup #18362: make `UnusedImport` work robustly (#18366)Timothee Cour2021-06-271-2/+0
| | | | * warnDuplicateModuleImport => hintDuplicateModuleImport * improve DuplicateModuleImport msg, add test
* jsgen improve spacing (#18048)Juan Carlos2021-05-201-30/+30
| | | | * Fix inconsistent spacings in generated JS of jsgen
* js generates spurious >>> on shr (#17767)Sivchari2021-04-211-2/+1
| | | | | * js generates spurious >>> on shr * Add shr arithmetic test * fix variables from const to let during testing
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-211-1/+1
| | | | | | | | * CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-10/+10
| | | | cstring, not cString (#17744)
* iterable[T] (#17196)Timothee Cour2021-04-111-1/+1
| | | | | | | | * fix failing test toSeq in manual which now works * changelog * reject proc fn(a: iterable) * add iterable to spec * remove MCS/UFCS limitation that now works
* fixes #11225; generic sandwich problems; [backport:1.2] (#17255)Andreas Rumpf2021-03-091-1/+2
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* fix #17264 [backport:1.4] (#17266)flywind2021-03-051-2/+2
| | | | | * fix #17264 * fix vm * fix js and add tests
* new-style concepts implementation, WIP (#15251)Andreas Rumpf2021-02-241-1/+1
| | | | | | | | | | | | | * fixes #15210 [backport:1.2] * make tests green * make ordinal work * makes Swapable test compile * make Indexable example work * concepts: 'self' is now 'Self' * concepts: make Dictionary example compile * document the new concept implementation * concepts: make typeDesc work properly * concepts: allow documentation comments (d'oh)
* fix #17076 (#17081)flywind2021-02-181-1/+5
|
* JS: fix div uint64 no truncation (#16899)flywind2021-02-151-1/+4
|
* array literals uses typed arrays; fix a jsgen bug (#16850)flywind2021-02-151-16/+39
| | | | | | | * array litterals uses typed arrays * Update compiler/jsgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* [backport:1.4] JS cstring null fixes (#16979)hlaaftana2021-02-111-3/+19
| | | | | * [backport:1.4] JS cstring null fixes * fix JS move string * make it look cleaner
* [JS] Ref #15952 make toOpenArray works better (#17001)flywind2021-02-101-10/+19
| | | | | * ref 15952 toOpenArray works in JS * fix
* fix #16822 (#16884)flywind2021-02-011-2/+2
| | | | | | | | | * see whether it breaks * fix #16884 * correct * fix #14574
* fix negative nan (#16628)flywind2021-01-111-1/+4
|
* IC: next steps (#16550)Andreas Rumpf2021-01-071-3/+3
| | | | | | | | | | | | | | | | | | * cleanups * ast.nim: cleanups * IC: no more sym.tab field, stored externally in the module graph * nimble compiles again * rodfiles: store bitwidth of integers and the endianness in the cookie because we serialize 'int' directly * rodfiles: added compilerproc and export sections * rodfiles: added all the missing sections * rodfiles: track the missing information * IC: architecture for lazy loading of proc bodies * make tests green again * completed the lazy loading of proc bodies * symbol lookup integration, part 1 * symbol lookup integration, part 2 * symbol lookup integration, part 3 * make tcompilerapi work again * rodfiles: fixed config change handling
* [backport 1.0] add backend support for js bigint (#16606)Timothee Cour2021-01-061-1/+4
| | | | | | | | | | | | | * add backend support for js bigint * cleanup * add tests * add -d:nimHasJsBigIntBackend * cleanup * more tests
* ref #16054 remove typed array (#16077)flywind2020-11-241-8/+0
|
* fix #12303 (#15964)flywind2020-11-141-2/+7
|
* Fix #8404 JS backend doesn't handle float->int type conversion (#15950) ↵Bung2020-11-131-3/+9
| | | | | | | | | | | [backport] * Fix #8404 JS backend doesn't handle float->int type conversion * handle conv to uint as cast, discard other cases * limit to int32, times use int64 * toInt including tyInt64 break times timezones lib, ignore for now * also affect to vm * move to tests/misc/t8404.nim
* fix #14157 (#15877)flywind2020-11-121-0/+4
| | | | | | | | | | | | | * fix #14157 * Update compiler/jsgen.nim * add changelog * Update compiler/jsgen.nim * Update tests/js/tmodify_cstring.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Fix 14127 js from int to int casting (#15918)Bung2020-11-111-2/+1
| | | | | | | | | * fix #14127 from int to int casting * add test for #14127 * use template for test, also test uint2int * move to tests/types/t14127_cast_number.nim targets:c cpp js
* follow #15818 and close #7109 (#15823)flywind2020-11-021-2/+5
| | | | | | | | | * follow #15818 and close #7109 * Update compiler/jsgen.nim Co-authored-by: Juan Carlos <juancarlospaco@gmail.com> Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
* fix #8821 (#15809)flywind2020-11-021-0/+5
|
* fix #15651 (#15800)flywind2020-10-311-0/+1
| | | | | * fix * minor
* [closes #11625 and closes #2488]add global and threadvar(with ↵flywind2020-10-301-1/+6
| | | | | | | | | | | | | | | `--threads:off` mode ) pragmas supports for JS backend (#15772) * add global pragma support for js backend * globalThis * add support for threadvar * more tests * Update compiler/jsgen.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #15638 (#15789)flywind2020-10-301-0/+1
|
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-8/+10
| | | | | | | | | | | | | | | | | * refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
* avoid #8231, bitwise move to mul,div (#15070)Bung2020-08-251-2/+10
| | | | | | | | | * avoid #8231, bitwise move to mul,div * add test for #8231 * fix bitwise move when div result is float * bitwise move depends on typ.size
* fix #11354 jsgen not carefully handle genAddr with nkHiddenAddr,nkStm… ↵Bung2020-07-271-1/+10
| | | | | | | | | | | | | | | | | | | (#15078) * fix #11354 jsgen not carefully handle genAddr with nkHiddenAddr,nkStmtListExpr; genAsgn with lvalue tyVar and rvalue tyPtr * correct logic * add test for #11354 * handle nkHiddenAddr when n.len == 1 * Update compiler/jsgen.nim * Update compiler/jsgen.nim * Apply suggestions from code review Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #14534 (#15060) [backport]Bung2020-07-251-1/+1
|
* 'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)Andreas Rumpf2020-07-201-1/+1
|
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-1/+1
| | | | | | | | | | | * 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
* remove tyOpt, mOpt (#14636)Timothee Cour2020-06-121-4/+5
| | | | | * remove tyOpt, mOpt * fixup