Commit Graph

32 Commits

Author SHA1 Message Date
ringabout
66e2352bf9 fixes #24339; underscores used with fields and fieldPairs (#24341)
fixes #24339

(cherry picked from commit 7ecb35115b)
2025-03-03 14:10:49 +01:00
metagn
9a6230ee5a wrap fields iterations in if true scope [backport] (#24343)
fixes #24338

When unrolling each iteration of a `fields` iterator, the compiler only
opens a new scope for semchecking, but doesn't generate a node that
signals to the codegen that a new scope should be created. This causes
issues for reused template instantiations that reuse variable symbols
between each iteration, which causes the codegen to generate multiple
declarations for them in the same scope (regardless of `inject` or
`gensym`). To fix this, we wrap the unrolled iterations in an `if true:
body` node, which both opens a new scope and doesn't interfere with
`break`.

(cherry picked from commit ca5df9ab25)
2025-01-14 07:48:01 +01:00
ringabout
cca5684a17 fixes yet another strictdefs bug (#23069) 2023-12-15 08:13:25 +01:00
Andreas Rumpf
db603237c6 Types: Refactorings; step 1 (#23055) 2023-12-12 16:54:50 +01:00
Andreas Rumpf
20b011de19 refactoring in preparation for better, simpler name mangling that wor… (#21667)
* refactoring in preparation for better, simpler name mangling that works with IC flawlessly

* use new disamb field

* see if this makes tests green

* make tests green again
2023-04-24 06:52:37 +02:00
ringabout
ef29987781 An unnamed break in a block now gives an UnnamedBreak warning (#20901)
* unnamed break in the block now gives an error

* bootstrap

* fixes

* more fixes

* break with label

* label again

* one moee

* Delete test5.txt

* it now gives a UnnamedBreak warning

* change the URL of bump back to the original one
2022-11-24 07:31:47 +01:00
Andreas Rumpf
796498525a IC: next steps (#16550)
* 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
2021-01-07 20:26:40 +01:00
Andreas Rumpf
73a8b950cb big steps torwards an efficient, simple IC implementation (#16543)
* 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>
2021-01-02 07:30:39 +01:00
Timothee Cour
f344a70412 fix #16150 improve type mismatch errors (#16152)
* fix #16150 improve type mismatch errors

* allow -d:nimLegacyTypeMismatch

* address comment
2020-12-09 16:19:39 +01:00
Andreas Rumpf
226595515c explicit ID generation for easier IC (#15559)
* 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)
2020-10-25 08:50:47 +01:00
Andreas Rumpf
2a8bf470af fixes #15101 [backport] (#15171) 2020-08-08 23:08:34 +02: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
Clyybber
ed1d41c51e Small ast.nim cleanup (#12156)
* Remove sonsLen
* Use Indexable
2019-09-09 11:54:15 +02:00
Clyybber
f18b3af9d4 Replace countup(x, y-1) with x ..< y 2019-05-07 12:32:05 +02:00
Neelesh Chandola
d998cb58dd void object fields are now ignored by codegen and fields/fieldPairs iterator (#10144)
* Codegen now ignores object fields of type void
* Fix `$` bug for objects/tuples where it does not add a comma
* fields/fieldPairs iterators now ignore void types
* Use `isEmptyType` instead of checking for `tyVoid` directly
2019-01-10 12:49:35 +01:00
Andreas Rumpf
84d122b5c8 extended system.type/typeof to support an upcoming 'collect' macro that works much better than sugar.lc 2018-09-11 19:02:05 +02:00
Andreas Rumpf
40ec7be45c refactoring: remove idents.legacy global variable and pass the IdentCache around explicitly 2018-05-27 22:09:15 +02:00
Araq
2a7fc84c86 remove ast.emptyNode global; cleanup configuration.nim 2018-05-16 03:06:07 +02:00
Andreas Rumpf
dd35111ff2 semstmts compiles again 2018-05-12 19:45:19 +02:00
Andreas Rumpf
ce859d8c16 more modules compile again 2018-05-12 16:35:59 +02:00
Andreas Rumpf
70ea45cdba deprecated unary '<' 2017-10-29 08:37:13 +01:00
Zahary Karadjov
fb3ff64450 fix #5642 2017-04-07 19:28:52 +03:00
Araq
2589d69ed2 fixes #5430 2017-02-26 00:32:07 +01:00
Andreas Rumpf
46efaf294b big compiler refactoring; avoid globals for multi method dispatcher generation 2017-02-22 16:27:52 +01:00
Andreas Rumpf
3a13706d7d fixes #4673 2016-09-01 13:02:53 +02:00
Adam Strzelecki
d681812465 compiler: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:03:22 +02:00
Araq
77406dd59c fixes #2134 2015-02-20 20:01:25 +01:00
Araq
aef7be2e79 fixes #1902 2015-02-20 20:01:24 +01:00
Araq
fe30ec83e2 nimsuggest improvements 2015-01-30 03:04:45 +01:00
Guillaume Gelin
3119fe087d Happy new year! 2015-01-06 15:26:33 +01:00
Araq
bebac34f87 fixes #1352 2014-12-14 11:49:32 +01:00
Araq
6e6c3d2f1e extracted the fields iterator magic to its own file 2014-12-12 18:25:52 +01:00