Skip to content

Commit

Permalink
prepare for the enforcement of std prefix (#22873)
Browse files Browse the repository at this point in the history
follow up #22851
  • Loading branch information
ringabout authored Oct 29, 2023
1 parent 0c26d19 commit e17237c
Show file tree
Hide file tree
Showing 88 changed files with 244 additions and 149 deletions.
4 changes: 3 additions & 1 deletion compiler/aliases.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
## Simple alias analysis for the HLO and the code generators.

import
ast, astalgo, types, trees, intsets
ast, astalgo, types, trees

import std/intsets

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
6 changes: 4 additions & 2 deletions compiler/ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
# abstract syntax tree + symbol table

import
lineinfos, hashes, options, ropes, idents, int128, tables, wordrecg
from strutils import toLowerAscii
lineinfos, options, ropes, idents, int128, wordrecg

import std/[tables, hashes]
from std/strutils import toLowerAscii

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
7 changes: 4 additions & 3 deletions compiler/astalgo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
# the data structures here are used in various places of the compiler.

import
ast, hashes, intsets, options, lineinfos, ropes, idents, rodutils,
ast, options, lineinfos, ropes, idents, rodutils,
msgs

import strutils except addf
import std/[hashes, intsets]
import std/strutils except addf

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down Expand Up @@ -408,7 +409,7 @@ proc symToYaml(conf: ConfigRef; n: PSym, indent: int = 0, maxRecDepth: int = - 1
var marker = initIntSet()
result = symToYamlAux(conf, n, marker, indent, maxRecDepth)

import tables
import std/tables

const backrefStyle = "\e[90m"
const enumStyle = "\e[34m"
Expand Down
2 changes: 1 addition & 1 deletion compiler/ccgtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# ------------------------- Name Mangling --------------------------------

import sighashes, modulegraphs, strscans
import sighashes, modulegraphs, std/strscans
import ../dist/checksums/src/checksums/md5

type
Expand Down
4 changes: 3 additions & 1 deletion compiler/ccgutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
# This module declares some helpers for the C code generator.

import
ast, types, hashes, strutils, msgs, wordrecg,
ast, types, msgs, wordrecg,
platform, trees, options, cgendata

import std/[hashes, strutils]

when defined(nimPreviewSlimSystem):
import std/assertions

Expand Down
12 changes: 6 additions & 6 deletions compiler/cgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
## This module implements the C code generator.

import
ast, astalgo, hashes, trees, platform, magicsys, extccomp, options, intsets,
ast, astalgo, trees, platform, magicsys, extccomp, options,
nversion, nimsets, msgs, bitsets, idents, types,
ccgutils, os, ropes, math, wordrecg, treetab, cgmeth,
ccgutils, ropes, wordrecg, treetab, cgmeth,
rodutils, renderer, cgendata, aliases,
lowerings, tables, sets, ndi, lineinfos, pathutils, transf,
lowerings, ndi, lineinfos, pathutils, transf,
injectdestructors, astmsgs, modulepaths, backendpragmas

from expanddefaults import caseObjDefaultBranch
Expand All @@ -27,10 +27,10 @@ when defined(nimPreviewSlimSystem):
when not defined(leanCompiler):
import spawn, semparallel

import strutils except `%`, addf # collides with ropes.`%`
import std/strutils except `%`, addf # collides with ropes.`%`

from ic / ic import ModuleBackendFlag
import dynlib
import std/[dynlib, math, tables, sets, os, intsets, hashes]

when not declared(dynlib.libCandidates):
proc libCandidates(s: string, dest: var seq[string]) =
Expand Down Expand Up @@ -121,7 +121,7 @@ proc getModuleDllPath(m: BModule, module: int): Rope =
proc getModuleDllPath(m: BModule, s: PSym): Rope =
result = getModuleDllPath(m.g.modules[s.itemId.module])

import macros
import std/macros

proc cgFormatValue(result: var string; value: string) =
result.add value
Expand Down
6 changes: 4 additions & 2 deletions compiler/cgendata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
## This module contains the data structures for the C code generation phase.

import
ast, ropes, options, intsets,
tables, ndi, lineinfos, pathutils, modulegraphs, sets
ast, ropes, options,
ndi, lineinfos, pathutils, modulegraphs

import std/[intsets, tables, sets]

type
TLabel* = Rope # for the C generator a label is just a rope
Expand Down
5 changes: 4 additions & 1 deletion compiler/cgmeth.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
## This module implements code generation for methods.

import
intsets, options, ast, msgs, idents, renderer, types, magicsys,
options, ast, msgs, idents, renderer, types, magicsys,
sempass2, modulegraphs, lineinfos


import std/intsets

when defined(nimPreviewSlimSystem):
import std/assertions

Expand Down
4 changes: 3 additions & 1 deletion compiler/closureiters.nim
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@
import
ast, msgs, idents,
renderer, magicsys, lowerings, lambdalifting, modulegraphs, lineinfos,
tables, options
options

import std/tables

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
4 changes: 3 additions & 1 deletion compiler/cmdlinehelper.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

import
options, idents, nimconf, extccomp, commands, msgs,
lineinfos, modulegraphs, condsyms, os, pathutils, parseopt
lineinfos, modulegraphs, condsyms, pathutils

import std/[os, parseopt]

proc prependCurDir*(f: AbsoluteFile): AbsoluteFile =
when defined(unix):
Expand Down
4 changes: 3 additions & 1 deletion compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ bootSwitch(usedNoGC, defined(nogc), "--gc:none")
import std/[setutils, os, strutils, parseutils, parseopt, sequtils, strtabs]
import
msgs, options, nversion, condsyms, extccomp, platform,
wordrecg, nimblecmd, lineinfos, pathutils, pathnorm
wordrecg, nimblecmd, lineinfos, pathutils

import std/pathnorm

from ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect

Expand Down
4 changes: 3 additions & 1 deletion compiler/concepts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
## for details. Note this is a first implementation and only the "Concept matching"
## section has been implemented.

import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types, intsets
import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types

import std/intsets

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
3 changes: 2 additions & 1 deletion compiler/condsyms.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# This module handles the conditional symbols.

import
strtabs
std/strtabs

from options import Feature
from lineinfos import hintMin, hintMax, warnMin, warnMax
Expand Down Expand Up @@ -162,3 +162,4 @@ proc initDefines*(symbols: StringTableRef) =
defineSymbol("nimHasNolineTooLong")

defineSymbol("nimHasCastExtendedVm")
defineSymbol("nimHasWarnStdPrefix")
2 changes: 1 addition & 1 deletion compiler/depends.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import options, ast, ropes, pathutils, msgs, lineinfos
import modulegraphs

import std/[os, parseutils]
import strutils except addf
import std/strutils except addf
import std/private/globs

when defined(nimPreviewSlimSystem):
Expand Down
3 changes: 2 additions & 1 deletion compiler/dfa.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
## "A Graph–Free Approach to Data–Flow Analysis" by Markus Mohnen.
## https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf

import ast, intsets, lineinfos, renderer, aliasanalysis
import ast, lineinfos, renderer, aliasanalysis
import std/private/asciitables
import std/intsets

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
11 changes: 6 additions & 5 deletions compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
## For corresponding users' documentation see [Nim DocGen Tools Guide].

import
ast, strutils, strtabs, algorithm, sequtils, options, msgs, os, idents,
ast, options, msgs, idents,
wordrecg, syntaxes, renderer, lexer,
packages/docutils/[rst, rstidx, rstgen, dochelpers],
json, xmltree, trees, types,
typesrenderer, astalgo, lineinfos, intsets,
pathutils, tables, nimpaths, renderverbatim, osproc, packages
trees, types,
typesrenderer, astalgo, lineinfos,
pathutils, nimpaths, renderverbatim, packages
import packages/docutils/rstast except FileIndex, TLineInfo

from uri import encodeUrl
import std/[os, strutils, strtabs, algorithm, json, osproc, tables, intsets, xmltree, sequtils]
from std/uri import encodeUrl
from nodejs import findNodeJs

when defined(nimPreviewSlimSystem):
Expand Down
3 changes: 2 additions & 1 deletion compiler/errorhandling.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
## This module contains support code for new-styled error
## handling via an `nkError` node kind.

import ast, renderer, options, strutils, types
import ast, renderer, options, types
import std/strutils

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
6 changes: 4 additions & 2 deletions compiler/evalffi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

## This file implements the FFI part of the evaluator for Nim code.

import ast, types, options, tables, dynlib, msgs, lineinfos
from os import getAppFilename
import ast, types, options, msgs, lineinfos
from std/os import getAppFilename
import libffi/libffi

import std/[tables, dynlib]

when defined(windows):
const libcDll = "msvcrt.dll"
elif defined(linux):
Expand Down
4 changes: 2 additions & 2 deletions compiler/evaltempl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

## Template evaluation engine. Now hygienic.

import
strutils, options, ast, astalgo, msgs, renderer, lineinfos, idents, trees
import options, ast, astalgo, msgs, renderer, lineinfos, idents, trees
import std/strutils

type
TemplCtx = object
Expand Down
4 changes: 3 additions & 1 deletion compiler/filter_tmpl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
# This module implements Nim's standard template filter.

import
llstream, strutils, ast, msgs, options,
llstream, ast, msgs, options,
filters, lineinfos, pathutils

import std/strutils

type
TParseState = enum
psDirective, psTempl
Expand Down
4 changes: 3 additions & 1 deletion compiler/filters.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
# This module implements Nim's simple filters and helpers for filters.

import
llstream, idents, strutils, ast, msgs, options,
llstream, idents, ast, msgs, options,
renderer, pathutils

import std/strutils

proc invalidPragma(conf: ConfigRef; n: PNode) =
localError(conf, n.info,
"'$1' not allowed here" % renderTree(n, {renderNoComments}))
Expand Down
5 changes: 3 additions & 2 deletions compiler/gorgeimpl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

## Module that implements ``gorge`` for the compiler.

import msgs, os, osproc, streams, options,
lineinfos, pathutils
import msgs, options, lineinfos, pathutils

import std/[os, osproc, streams]

when defined(nimPreviewSlimSystem):
import std/syncio
Expand Down
2 changes: 1 addition & 1 deletion compiler/guards.nim
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ template isSub(x): untyped = x.getMagic in someSub
template isVal(x): untyped = x.kind in {nkCharLit..nkUInt64Lit}
template isIntVal(x, y): untyped = x.intVal == y

import macros
import std/macros

macro `=~`(x: PNode, pat: untyped): bool =
proc m(x, pat, conds: NimNode) =
Expand Down
3 changes: 2 additions & 1 deletion compiler/ic/bitabs.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## A BiTable is a table that can be seen as an optimized pair
## of `(Table[LitId, Val], Table[Val, LitId])`.

import hashes, rodfiles
import std/hashes
import rodfiles

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/cbackend.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
## also doing cross-module dependency tracking and DCE that we don't need
## anymore. DCE is now done as prepass over the entire packed module graph.

import std/packedsets, algorithm, tables
import std/[packedsets, algorithm, tables]

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
4 changes: 2 additions & 2 deletions compiler/ic/ic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# distribution, for details about the copyright.
#

import hashes, tables, intsets
import std/[hashes, tables, intsets]
import packed_ast, bitabs, rodfiles
import ".." / [ast, idents, lineinfos, msgs, ropes, options,
pathutils, condsyms, packages, modulepaths]
#import ".." / [renderer, astalgo]
from os import removeFile, isAbsolute
from std/os import removeFile, isAbsolute

import ../../dist/checksums/src/checksums/sha1

Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/integrity.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Integrity checking for a set of .rod files.
## The set must cover a complete Nim project.

import sets
import std/sets

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
4 changes: 2 additions & 2 deletions compiler/ic/navigator.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
## IDE-like features. It uses the set of .rod files to accomplish
## its task. The set must cover a complete Nim project.

import sets
import std/sets

from os import nil
from std/os import nil
from std/private/miscdollars import toLocation

when defined(nimPreviewSlimSystem):
Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/packed_ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## use this representation directly in all the transformations,
## it is superior.

import hashes, tables, strtabs
import std/[hashes, tables, strtabs]
import bitabs
import ".." / [ast, options]

Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/replayer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import ".." / [ast, modulegraphs, trees, extccomp, btrees,
msgs, lineinfos, pathutils, options, cgmeth]

import tables
import std/tables

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/rodfiles.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## compiler works and less a storage format, you're probably looking for
## the `ic` or `packed_ast` modules to understand the logical format.

from typetraits import supportsCopyMem
from std/typetraits import supportsCopyMem

when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
Expand Down
Loading

0 comments on commit e17237c

Please sign in to comment.