26 Commits

Author SHA1 Message Date
Andreas Rumpf
dd7cecdbd4 make mangled module names shorter (#24976) 2025-06-05 08:34:52 +02:00
ringabout
4eaa3b028c fixes #23167; take nkOpenSymChoice into consideration caused by templates [backport] (#23168)
fixes #23167
2024-01-05 08:17:08 +01:00
ringabout
c7d742e484 fixes #23148; restricts infix path concatenation to what starts with / (#23150)
fixes #23148
2024-01-02 07:49:16 +01:00
ringabout
e17237ce9d prepare for the enforcement of std prefix (#22873)
follow up https://github.com/nim-lang/Nim/pull/22851
2023-10-29 14:48:11 +01:00
quantimnot
d30c6419a0 Refactor and doc package handling, module name mangling (#19821)
* Refactor and doc package handling, module name mangling

* Consolidate, de-duplicate and extend package handling
* Alter how duplicate module names of a package are handled
* Alter how module names are mangled
* Fix crash when another package is named 'stdlib' (test case added)
* Doc what defines a package in the manual

Modules with duplicate names within a package used to be given 'fake'
packages to resolve conflicts. That prevented the ability to discern if
a module belonged to the current project package or a foreign package.
They now have the proper package owner and the names are mangled in a
consistent manner to prevent codegen clashes.

All module names are now mangled the same. Stdlib was treated special
before, but now it is same as any other package. This fixes a crash
when a foreign package is named 'stdlib'.

Module mangling is altered for both file paths and symbols used by the
backends.

Removed an unused module name to package mapping that may have been
intended for IC. The mapping was removed because it wasn't being used
and was complicating the issue of package modules with duplicate names
not having the proper package owner assigned.

* Fix some tests

* Refactor `packagehandling`

* Remove `packagehandling.withPackageName` and its uses
* Move module path mangling from `packagehandling` to `modulepaths`
* Move `options.toRodFile` to `ic` to break import cycle

* Changed import style to match preferred style

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-05-30 18:52:19 +02:00
Ivan Bobev
5e6680406f Add changes required by Nimble lock file support (#12104)
Implemented support for Nimble local cache with package directories with
a checksum of the package at the end of their names. Now the compiler
supports package paths in the form:

 * /path_to_nimble_cache_dir/pkgs/package_name-1.2.3-
FEBADEAEA2345E777F0F6F8433F7F0A52EDD5D1B

 * /path_to_nimble_cache_dir/pkgs/package_name-#head-
042D4BE2B90ED0672E717D71850ABDB0A2D19CD2

 * /path_to_nimble_cache_dir/pkgs/package_name-#branch-name-
DBC1F902CB79946E990E38AF51F0BAD36ACFABD9

Related to nim-lang/nimble#127
2021-07-15 22:13:01 +02:00
Clyybber
13e659cfec Big compiler Cleanup (#14777) 2020-08-28 22:18:09 +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
Araq
07d465ca42 [refactoring] remove unused imports in the compiler and in some stdlib modules 2019-07-18 00:36:03 +02:00
Araq
c94647aeca styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error 2019-07-10 12:42:41 +02:00
Miran
fa058773db fixes #10042 (allow spaces in import) (#10504)
This allows spaces in imports, by using the following syntax:
* `import "directory with spaces" / subdir / file`, or
* `import "directory with spaces/subdir/file"`
2019-01-31 08:20:00 +01:00
Neelesh Chandola
9faad7591e Deprecate gc v2 (#10151)
* Deprecate gc v2

* warnDeprecated now has custom messages
2019-01-01 13:50:48 +01:00
Andreas Rumpf
86556ebfdb compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
Oscar Nihlgård
d6d3f092a3 Fix for module alias inside brackets (#8726) 2018-08-23 10:23:02 +02:00
Oscar Nihlgård
5491f1f53b Deprecate the dot style for import paths (#8474) 2018-07-30 09:24:16 -04:00
Oscar Nihlgård
97ea18746b Fix path resolution of submodules in the std namespace (#8453) 2018-07-30 09:07:11 +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
Andreas Rumpf
669a564492 remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
Andreas Rumpf
bf6c2c5ccf preparations of making compiler/msgs.nim free of global variables 2018-05-17 15:21:22 +02:00
Andreas Rumpf
3c4ceea427 move more global variables into ConfigRef 2018-05-11 15:28:26 +02:00
Andreas Rumpf
5bf31fcabe big refactoring: mores stuff compiles 2018-05-10 13:39:23 +02:00
Andreas Rumpf
33b69f0ed0 refactoring: make FileIndex a distinct type; make line information an uint16; fixes #7654 2018-04-21 08:13:37 +02:00
Andreas Rumpf
cddc389784 disable the undocumented 'import ' feature; allow import std / strutils; fixes #2819; refs #6700 2018-02-12 16:40:27 +01:00
Andreas Rumpf
eee43e4f8f fixes the new to be documented imports 2017-11-05 16:33:26 +01:00
Andreas Rumpf
29c075299d made nimresolve part of the compiler 2017-10-29 15:40:50 +01:00
BigEpsilon
e2af486434 Add sections (type, var, let, const, using) support for reorder pragma (#6326) 2017-10-28 11:33:35 +02:00