summary refs log tree commit diff stats
path: root/compiler/semtempl.nim
Commit message (Collapse)AuthorAgeFilesLines
* New/better macro pragmas, mark some as experimental (#19406)metagn2022-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * New/better macro pragmas, make some experimental fix #15920, close #18212, close #14781, close #6696, close https://github.com/nim-lang/RFCs/issues/220 Variable macro pragmas have been changed to only take a unary section node. They can now also be applied in sections with multiple variables, as well as `const` sections. They also accept arguments. Templates now support macro pragmas, mirroring other routine types. Type and variable macro pragmas have been made experimental. Symbols without parentheses instatiating nullary macros or templates has also been documented in the experimental manual. A check for a redefinition error based on the left hand side of variable definitions when using variable macro pragmas was disabled. This nerfs `byaddr` specifically, however this has been documented as a consequence of the experimental features `byaddr` uses. Given how simple these changes are I'm worried if I'm missing something. * accomodate compiler boot * allow weird pragmas * add test for #10994 * remove some control flow, try remove some logic
* fix stylecheck error with asyncdispatch (#19350)flywind2022-01-101-1/+2
| | | | | | | | | | | | | | | | | | | | | * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since #12842 * add tests * don't use echo in tests
* fixes a regression caused by overloadable enums even though they're opt-in ↵Andreas Rumpf2021-10-071-3/+7
| | | | (#18970)
* fixes a 'mixin' statement handling regression [backport:1.2] (#18968)Andreas Rumpf2021-10-071-1/+6
|
* fixes #18863 [backport] (#18871)Andreas Rumpf2021-09-201-3/+4
|
* fix: `var a{.foo.} = expr` inside templates (refs #15920) (except when `foo` ↵Timothee Cour2021-08-111-3/+12
| | | | | | | | | | | is overloaded) (#13869) * fix: `var a{.foo.} = expr` inside templates * add test * improve tdecls test * improve tests * add failing test * PRTEMP * fixup
* Fixed template const tuple unpacking (#18562)Jason Beetham2021-07-231-22/+18
|
* refactoring: removed empty withBracketExpr template (#18152)Andreas Rumpf2021-06-021-10/+4
|
* fix #18113 (#18124)Saem Ghani2021-05-311-2/+6
|
* semTemplateDef and t17433 clean-ups (#17448)Saem Ghani2021-03-221-19/+19
| | | | | - use `doAssert` in t17433 - use setGenericParamsMisc in semTemplateDef akin to semProcAux - pragma handling in semTemplateDef inline with semProcAux
* Fixes #17433; gensym callDef return in templ body (#17445)Saem Ghani2021-03-221-1/+1
|
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * simplified proc-like name ident to symbol code * wip - reworking generic param sem * wip - closer to removing nkEmpty generic params * it's hacky but tests pass * slowly tweaking semProcAux to take on semLambda * fix pragma superset check proto vs current * Set the symbol owner earlier * partial progress reworking proto found bug where default values between forward and impl lead to overload resolution issues. * simplified pragma handling and callConv checks Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> * partially working * cgexprs issue * It works! * comment clean-up * clean-up asserts, comments, and other bits * add isGenericParams, inline isGeneric queries * seeing if this is sufficiently consistent * can use this approach or continue it in a further PR * commentary about nullary generics and clean-ups * fixed a mistake in PNode isGenericRoutine * Some small cleanups * Small cleanup * for func lambdas ensure we use lambda pragmas * add some basic compileTime func tests * [ci skip] remove comments Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
* fixes #11225; generic sandwich problems; [backport:1.2] (#17255)Andreas Rumpf2021-03-091-3/+7
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* Fix #12595 (#16874)konsumlamm2021-01-311-0/+4
|
* IC: next steps (#16550)Andreas Rumpf2021-01-071-1/+1
| | | | | | | | | | | | | | | | | | * 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
* big steps torwards an efficient, simple IC implementation (#16543)Andreas Rumpf2021-01-021-1/+1
| | | | | | | | | | | | | | | | | | | * reworked ID handling * the packed AST now has its own ID mechanism * basic serialization code works * extract rodfiles to its own module * rodfiles: store and compare configs * rodfiles: store dependencies * store config at the end * precise dependency tracking * dependency tracking for rodfiles * completed loading of PSym, PType, etc * removed dead code * bugfix: do not realloc seqs when taking addr into an element * make IC opt-in for now * makes tcompilerapi green again * final cleanups Co-authored-by: Andy Davidoff <github@andy.disruptek.com>
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-3/+3
| | | | | | | | | | | | | | | | | * 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)
* views: yet another bugfix (#15447)Andreas Rumpf2020-10-011-5/+0
| | | | | | | * views: yet another bugfix * views: extended the spec * views: take into account potential hidden mutations via proc calls
* Fix forward declarations in shadow scope contexts (#15386)Clyybber2020-09-221-2/+2
| | | | | | | | | | | | | | | * Fix forward declarations in shadow scope contexts * Add testcase for #15385 * Less empty lines * Fix tests * Inline isShadowScope * Add original testcase (with reduced amount of iterations) * Add testcase without forward decl
* Big compiler Cleanup (#14777)Clyybber2020-08-281-1/+0
|
* Fix forward declaration issues in template/macro context (#15091)Clyybber2020-07-291-22/+5
| | | | | | | | | | | | | | | | | | | | | | | * Fix forward declaration issues in template/macro context * Correct forward declaration resolving for overloads * Remove old dead code * WIP consistent gensym ids * Minimize diff * Remove obsoleted hack * Add templInstCounter to give unique IDs to template instantiations * Remove obsoleted code * Eh, init in myOpen, not myProcess... * Remove optNimV019 * Add testcase for #13484
* fix codegen bug due to changing existing symbol declaration in template (#14666)jcosborn2020-06-151-1/+1
|
* fixes #12885 [backport] (#12895)Andreas Rumpf2019-12-131-0/+4
|
* Fixes #12832 (#12842) [backport]Neelesh Chandola2019-12-081-0/+5
| | | | | | * Fix #12832 * nimVm -> nimvm in json.nim * Use suggestSym() instead of markUsed(); Also use styleCheckUse() for finding style violations
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-159/+155
| | | | | | | | | | | | | | | | | | * 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
* fixes #12193 (#12199)Andreas Rumpf2019-09-161-2/+1
|
* Small ast.nim cleanup (#12156)Clyybber2019-09-091-20/+20
| | | | | * Remove sonsLen * Use Indexable
* fixes yet another gensym regression (#12145)Andreas Rumpf2019-09-061-3/+3
|
* fixes #12121 (#12126)Andreas Rumpf2019-09-051-9/+24
|
* improvement for 'unused import' warningsAraq2019-09-021-0/+1
|
* new gensym handling (#11985)Andreas Rumpf2019-08-231-19/+43
| | | | | | | | | | | * new .gensym implementation * make astspec test green again * introduce a --useVersion switch to group compatibility switches * fixes #10180 * fixes #11494 * fixes #11483 * object constructor fields and named parameters are also not gensym'ed * disabled broken package
* [refactoring] compiler: simplified markUsedAndreas Rumpf2019-08-081-1/+1
|
* [feature] detect unused importsAraq2019-07-171-1/+1
|
* Allow void macro result (#11286)Arne Döring2019-05-211-5/+0
| | | | | * allow void macro result * add test for void macro result type
* Fixes #9365 : let with exportC pragma in template. (#11235)Aditya Siram2019-05-141-0/+6
| | | | | | * Fixes #9365 : let with exportC pragma in template. * Fix according to comments.
* rename tyExpr/tyStmt to tyUntyped/tyTyped (#11227)Arne Döring2019-05-111-5/+5
|
* Replace countup(x, y) with x .. yClyybber2019-05-071-4/+4
|
* Replace countup(x, y-1) with x ..< yClyybber2019-05-071-14/+14
|
* Fix loop tuple unpacking in templates (#11174)nc-x2019-05-051-1/+5
| | | | | | * Fix loop tuple unpacking in templates * Add test
* callsite lineinfe for stackTrace template (#10785)Arne Döring2019-04-181-3/+5
|
* more destructor based changes (#10885)Andreas Rumpf2019-03-231-1/+1
| | | | | | | | | | | * 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
* it's spelt callsiteAndreas Rumpf2019-02-221-2/+3
|
* 32 bit fixes (#10608)Arne Döring2019-02-131-0/+4
|
* compiler/sem*: improve lineinfo for qualified and generic procs (#10427)alaviss2019-01-231-6/+7
| | | | | | | | | | | | | | | | Previously the compiler will believe these are where `newSeq` symbol starts: newSeq[int]() ^ system.newSeq[int]() ^ This commit moves them back to: newSeq[int]() ^ system.newSeq[int]() ^
* nimfind: improvementsAndreas Rumpf2018-11-151-0/+2
|
* added first version of a nimfind tool for the poor souls that don't have a ↵Andreas Rumpf2018-11-141-8/+12
| | | | good nimsuggest integretation
* fixes regressionsAraq2018-10-301-10/+8
|
* fixes unexpected transforming of runnableExamples (#9158)Steve Kellock2018-10-091-1/+3
|
* fixes #8052Araq2018-08-311-1/+1
|
* code cleanup: remove newScopeForIf switchAndreas Rumpf2018-07-041-2/+1
|