prepare for the enforcement of std prefix (#22873)

follow up https://github.com/nim-lang/Nim/pull/22851
This commit is contained in:
ringabout
2023-10-29 21:48:11 +08:00
committed by GitHub
parent 0c26d19e22
commit e17237ce9d
88 changed files with 244 additions and 149 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
@@ -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"

View File

@@ -11,7 +11,7 @@
# ------------------------- Name Mangling --------------------------------
import sighashes, modulegraphs, strscans
import sighashes, modulegraphs, std/strscans
import ../dist/checksums/src/checksums/md5
type

View File

@@ -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

View File

@@ -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
@@ -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]) =
@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -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

View File

@@ -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
@@ -162,3 +162,4 @@ proc initDefines*(symbols: StringTableRef) =
defineSymbol("nimHasNolineTooLong")
defineSymbol("nimHasCastExtendedVm")
defineSymbol("nimHasWarnStdPrefix")

View File

@@ -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):

View File

@@ -22,8 +22,9 @@
## "A GraphFree Approach to DataFlow 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

View File

@@ -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):

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -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

View File

@@ -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}))

View File

@@ -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

View File

@@ -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) =

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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]

View File

@@ -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

View File

@@ -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]

View File

@@ -11,8 +11,8 @@
# An identifier is a shared immutable string that can be compared by its
# id. This module is essential for the compiler's performance.
import
hashes, wordrecg
import wordrecg
import std/hashes
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -10,11 +10,12 @@
## This module implements the symbol importing mechanism.
import
intsets, ast, astalgo, msgs, options, idents, lookups,
semdata, modulepaths, sigmatch, lineinfos, sets,
modulegraphs, wordrecg, tables
from strutils import `%`
from sequtils import addUnique
ast, astalgo, msgs, options, idents, lookups,
semdata, modulepaths, sigmatch, lineinfos,
modulegraphs, wordrecg
from std/strutils import `%`, startsWith
from std/sequtils import addUnique
import std/[sets, tables, intsets]
when defined(nimPreviewSlimSystem):
import std/assertions
@@ -301,6 +302,10 @@ proc myImportModule(c: PContext, n: var PNode, importStmtResult: PNode): PSym =
var prefix = ""
if realModule.constraint != nil: prefix = realModule.constraint.strVal & "; "
message(c.config, n.info, warnDeprecated, prefix & realModule.name.s & " is deprecated")
let moduleName = getModuleName(c.config, n)
if belongsToStdlib(c.graph, result) and not startsWith(moduleName, stdPrefix) and
not startsWith(moduleName, "system/") and not startsWith(moduleName, "packages/"):
message(c.config, n.info, warnStdPrefix, realModule.name.s)
suggestSym(c.graph, n.info, result, c.graph.usageSym, false)
importStmtResult.add newSymNode(result, n.info)
#newStrNode(toFullPath(c.config, f), n.info)

View File

@@ -14,11 +14,13 @@
## See doc/destructors.rst for a spec of the implemented rewrite rules
import
intsets, strtabs, ast, astalgo, msgs, renderer, magicsys, types, idents,
strutils, options, lowerings, tables, modulegraphs,
ast, astalgo, msgs, renderer, magicsys, types, idents,
options, lowerings, modulegraphs,
lineinfos, parampatterns, sighashes, liftdestructors, optimizer,
varpartitions, aliasanalysis, dfa, wordrecg
import std/[strtabs, tables, strutils, intsets]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -3,7 +3,7 @@
## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This
## type is for that purpose.
from math import trunc
from std/math import trunc
when defined(nimPreviewSlimSystem):
import std/assertions
@@ -358,7 +358,7 @@ proc `*`*(lhs, rhs: Int128): Int128 =
proc `*=`*(a: var Int128, b: Int128) =
a = a * b
import bitops
import std/bitops
proc fastLog2*(a: Int128): int =
result = 0

View File

@@ -11,7 +11,9 @@
## https://github.com/nim-lang/RFCs/issues/244 for more details.
import
ast, types, renderer, intsets
ast, types, renderer
import std/intsets
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -37,8 +37,8 @@ import
import pipelineutils
import json, sets, math, tables, intsets
import strutils except addf
import std/[json, sets, math, tables, intsets]
import std/strutils except addf
when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]

View File

@@ -10,10 +10,12 @@
# This file implements lambda lifting for the transformator.
import
intsets, strutils, options, ast, astalgo, msgs,
idents, renderer, types, magicsys, lowerings, tables, modulegraphs, lineinfos,
options, ast, astalgo, msgs,
idents, renderer, types, magicsys, lowerings, modulegraphs, lineinfos,
transf, liftdestructors, typeallowed
import std/[strutils, tables, intsets]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -16,8 +16,10 @@
# DOS or Macintosh text files, even when it is not the native format.
import
hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream,
wordrecg, lineinfos, pathutils, parseutils
options, msgs, platform, idents, nimlexbase, llstream,
wordrecg, lineinfos, pathutils
import std/[hashes, parseutils, strutils]
when defined(nimPreviewSlimSystem):
import std/[assertions, formatfloat]

View File

@@ -11,8 +11,9 @@
## (`=sink`, `=copy`, `=destroy`, `=deepCopy`, `=wasMoved`, `=dup`).
import modulegraphs, lineinfos, idents, ast, renderer, semdata,
sighashes, lowerings, options, types, msgs, magicsys, tables, ccgutils
sighashes, lowerings, options, types, msgs, magicsys, ccgutils
import std/tables
from trees import isCaseObj
when defined(nimPreviewSlimSystem):

View File

@@ -10,9 +10,11 @@
## This module implements the '.liftLocals' pragma.
import
strutils, options, ast, msgs,
options, ast, msgs,
idents, renderer, types, lowerings, lineinfos
import std/strutils
from pragmas import getPragmaVal
from wordrecg import wLiftLocals

View File

@@ -10,7 +10,8 @@
## This module contains the `TMsgKind` enum as well as the
## `TLineInfo` object.
import ropes, tables, pathutils, hashes
import ropes, pathutils
import std/[hashes, tables]
const
explanationsBaseUrl* = "https://nim-lang.github.io/Nim"
@@ -91,6 +92,7 @@ type
warnStmtListLambda = "StmtListLambda",
warnBareExcept = "BareExcept",
warnImplicitDefaultValue = "ImplicitDefaultValue",
warnStdPrefix = "StdPrefix"
warnUser = "User",
# hints
hintSuccess = "Success", hintSuccessX = "SuccessX",
@@ -194,6 +196,7 @@ const
warnStmtListLambda: "statement list expression assumed to be anonymous proc; this is deprecated, use `do (): ...` or `proc () = ...` instead",
warnBareExcept: "$1",
warnImplicitDefaultValue: "$1",
warnStdPrefix: "$1 needs the 'std' prefix",
warnUser: "$1",
hintSuccess: "operation successful: $#",
# keep in sync with `testament.isSuccess`
@@ -249,7 +252,7 @@ type
proc computeNotesVerbosity(): array[0..3, TNoteKinds] =
result = default(array[0..3, TNoteKinds])
result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept}
result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept, warnStdPrefix}
result[2] = result[3] - {hintStackTrace, hintExtendedContext, hintDeclaredLoc, hintProcessingStmt}
result[1] = result[2] - {warnProveField, warnProveIndex,
warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd,

View File

@@ -14,8 +14,10 @@ when defined(nimPreviewSlimSystem):
import std/assertions
import
intsets, ast, astalgo, idents, semdata, types, msgs, options,
renderer, lineinfos, modulegraphs, astmsgs, sets, wordrecg
ast, astalgo, idents, semdata, types, msgs, options,
renderer, lineinfos, modulegraphs, astmsgs, wordrecg
import std/[intsets, sets]
proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope)
@@ -464,7 +466,7 @@ proc mergeShadowScope*(c: PContext) =
c.addInterfaceDecl(sym)
import std/editdistance, heapqueue
import std/[editdistance, heapqueue]
type SpellCandidate = object
dist: int

View File

@@ -11,7 +11,7 @@
## represents a complete Nim project. Single modules can either be kept in RAM
## or stored in a rod-file.
import intsets, tables, hashes
import std/[intsets, tables, hashes]
import ../dist/checksums/src/checksums/md5
import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils, packages
import ic / [packed_ast, ic]

View File

@@ -7,9 +7,11 @@
# distribution, for details about the copyright.
#
import ast, renderer, strutils, msgs, options, idents, os, lineinfos,
import ast, renderer, msgs, options, idents, lineinfos,
pathutils
import std/[strutils, os]
proc getModuleName*(conf: ConfigRef; n: PNode): string =
# This returns a short relative module name without the nim extension
# e.g. like "system", "importer" or "somepath/module"

View File

@@ -7,8 +7,8 @@
# distribution, for details about the copyright.
#
import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes
import sequtils, strutils, sets
import ast, renderer, msgs, options, lineinfos, idents, treetab
import std/[intsets, tables, sequtils, strutils, sets, strformat, hashes]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -41,6 +41,7 @@ define:useStdoutAsStdmsg
@end
@if nimHasWarnBareExcept:
warning[BareExcept]:on
warningAserror[BareExcept]:on
@end
@@ -51,3 +52,7 @@ define:useStdoutAsStdmsg
warningAsError[ProveInit]:on
@end
@if nimHasWarnStdPrefix:
warning[StdPrefix]:on
warningAsError[StdPrefix]:on
@end

View File

@@ -28,7 +28,7 @@ import
commands, options, msgs, extccomp, main, idents, lineinfos, cmdlinehelper,
pathutils, modulegraphs
from browsers import openDefaultBrowser
from std/browsers import openDefaultBrowser
from nodejs import findNodeJs
when hasTinyCBackend:

View File

@@ -9,8 +9,9 @@
## Implements some helper procs for Nimble (Nim's package manager) support.
import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils,
tables
import options, msgs, lineinfos, pathutils
import std/[parseutils, strutils, os, tables, sequtils]
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]

View File

@@ -10,8 +10,10 @@
# This module handles the reading of the config file.
import
llstream, commands, os, strutils, msgs, lexer, ast,
options, idents, wordrecg, strtabs, lineinfos, pathutils, scriptconfig
llstream, commands, msgs, lexer, ast,
options, idents, wordrecg, lineinfos, pathutils, scriptconfig
import std/[os, strutils, strtabs]
when defined(nimPreviewSlimSystem):
import std/syncio

View File

@@ -12,8 +12,9 @@
# handling that exists! Only at line endings checks are necessary
# if the buffer needs refilling.
import
llstream, strutils
import llstream
import std/strutils
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -17,7 +17,7 @@ interpolation variables:
Unstable API
]##
import os, strutils
import std/[os, strutils]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -10,7 +10,7 @@
## Nim Intermediate Representation, designed to capture all of Nim's semantics without losing too much
## precious information. Can easily be translated into C. And to JavaScript, hopefully.
from os import addFileExt, `/`, createDir
from std/os import addFileExt, `/`, createDir
import std / assertions
import ".." / [ast, modulegraphs, renderer, transf, options, msgs, lineinfos]

View File

@@ -49,7 +49,7 @@ afterCase: ...
# Every string of length > position for which s[position] <= char is in one
# set else it is in the other set.
from sequtils import addUnique
from std/sequtils import addUnique
type
Key = (LitId, LabelId)

View File

@@ -1,4 +1,4 @@
import os
import std/os
proc findNodeJs*(): string {.inline.} =
## Find NodeJS executable and return it as a string.

View File

@@ -12,11 +12,11 @@
## - recognize "all paths lead to 'wasMoved(x)'"
import
ast, renderer, idents, intsets
ast, renderer, idents
from trees import exprStructuralEquivalent
import std/strutils
import std/[strutils, intsets]
const
nfMarkForDeletion = nfNone # faster than a lookup table

View File

@@ -8,11 +8,12 @@
#
import
os, strutils, strtabs, sets, lineinfos, platform,
prefixmatches, pathutils, nimpaths, tables
lineinfos, platform,
prefixmatches, pathutils, nimpaths
from terminal import isatty
from times import utc, fromUnix, local, getTime, format, DateTime
import std/[tables, os, strutils, strtabs, sets]
from std/terminal import isatty
from std/times import utc, fromUnix, local, getTime, format, DateTime
from std/private/globs import nativeToUnixPath
when defined(nimPreviewSlimSystem):
@@ -890,7 +891,7 @@ const stdlibDirs* = [
const
pkgPrefix = "pkg/"
stdPrefix = "std/"
stdPrefix* = "std/"
proc getRelativePathFromConfigPath*(conf: ConfigRef; f: AbsoluteFile, isTitle = false): RelativeFile =
result = RelativeFile("")

View File

@@ -10,9 +10,11 @@
## This module implements the pattern matching features for term rewriting
## macro support.
import strutils, ast, types, msgs, idents, renderer, wordrecg, trees,
import ast, types, msgs, idents, renderer, wordrecg, trees,
options
import std/strutils
# we precompile the pattern here for efficiency into some internal
# stack based VM :-) Why? Because it's fun; I did no benchmarks to see if that
# actually improves performance.

View File

@@ -49,9 +49,11 @@ when isMainModule or defined(nimTestGrammar):
checkGrammarFile()
import
llstream, lexer, idents, strutils, ast, msgs, options, lineinfos,
llstream, lexer, idents, ast, msgs, options, lineinfos,
pathutils
import std/strutils
when defined(nimpretty):
import layouter

View File

@@ -10,7 +10,7 @@
## Path handling utilities for Nim. Strictly typed code in order
## to avoid the never ending time sink in getting path handling right.
import os, pathnorm, strutils
import std/[os, pathnorm, strutils]
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]

View File

@@ -14,7 +14,7 @@
# Feel free to test for your excentric platform!
import
strutils
std/strutils
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -10,10 +10,12 @@
# This module implements semantic checking for pragmas
import
os, condsyms, ast, astalgo, idents, semdata, msgs, renderer,
wordrecg, ropes, options, strutils, extccomp, math, magicsys, trees,
condsyms, ast, astalgo, idents, semdata, msgs, renderer,
wordrecg, ropes, options, extccomp, magicsys, trees,
types, lookups, lineinfos, pathutils, linter, modulepaths
import std/[os, math, strutils]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#
from strutils import toLowerAscii
from std/strutils import toLowerAscii
type
PrefixMatch* {.pure.} = enum

View File

@@ -11,7 +11,9 @@
# This is needed for proper handling of forward declarations.
import
ast, astalgo, msgs, semdata, types, trees, strutils, lookups
ast, astalgo, msgs, semdata, types, trees, lookups
import std/strutils
proc equalGenericParams(procA, procB: PNode): bool =
if procA.len != procB.len: return false

View File

@@ -14,7 +14,9 @@
{.used.}
import
lexer, options, idents, strutils, ast, msgs, lineinfos, wordrecg
lexer, options, idents, ast, msgs, lineinfos, wordrecg
import std/[strutils]
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions, formatfloat]

View File

@@ -1,4 +1,4 @@
import strutils
import std/strutils
import ast, options, msgs

View File

@@ -1,9 +1,11 @@
import
intsets, ast, idents, algorithm, renderer, strutils,
ast, idents, renderer,
msgs, modulegraphs, syntaxes, options, modulepaths,
lineinfos
import std/[algorithm, strutils, intsets]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -8,7 +8,7 @@
#
## Serialization utilities for the compiler.
import strutils, math
import std/[strutils, math]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -13,14 +13,16 @@
import
ast, modules, idents, condsyms,
options, llstream, vm, vmdef, commands,
os, times, osproc, wordrecg, strtabs, modulegraphs,
wordrecg, modulegraphs,
pathutils, pipelines
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
import std/[strtabs, os, times, osproc]
# we support 'cmpIgnoreStyle' natively for efficiency:
from strutils import cmpIgnoreStyle, contains
from std/strutils import cmpIgnoreStyle, contains
proc listDirs(a: VmArgs, filter: set[PathComponent]) =
let dir = getString(a, 0)

View File

@@ -9,19 +9,18 @@
# This module implements the semantic checking pass.
import tables
import
ast, strutils, options, astalgo, trees,
wordrecg, ropes, msgs, idents, renderer, types, platform, math,
ast, options, astalgo, trees,
wordrecg, ropes, msgs, idents, renderer, types, platform,
magicsys, nversion, nimsets, semfold, modulepaths, importer,
procfind, lookups, pragmas, semdata, semtypinst, sigmatch,
intsets, transf, vmdef, vm, aliases, cgmeth, lambdalifting,
transf, vmdef, vm, aliases, cgmeth, lambdalifting,
evaltempl, patterns, parampatterns, sempass2, linter, semmacrosanity,
lowerings, plugins/active, lineinfos, strtabs, int128,
lowerings, plugins/active, lineinfos, int128,
isolation_check, typeallowed, modulegraphs, enumtostr, concepts, astmsgs,
extccomp
import std/[strtabs, math, tables, intsets, strutils]
when not defined(leanCompiler):
import spawn

View File

@@ -9,14 +9,14 @@
## This module contains the data structures for the semantic checking phase.
import tables
import std/[tables, intsets, sets]
when defined(nimPreviewSlimSystem):
import std/assertions
import
intsets, options, ast, astalgo, msgs, idents, renderer,
magicsys, vmdef, modulegraphs, lineinfos, sets, pathutils
options, ast, astalgo, msgs, idents, renderer,
magicsys, vmdef, modulegraphs, lineinfos, pathutils
import ic / ic

View File

@@ -11,10 +11,11 @@
# and evaluation phase
import
strutils, options, ast, trees, nimsets,
platform, math, msgs, idents, renderer, types,
commands, magicsys, modulegraphs, strtabs, lineinfos, wordrecg
options, ast, trees, nimsets,
platform, msgs, idents, renderer, types,
commands, magicsys, modulegraphs, lineinfos, wordrecg
import std/[strutils, math, strtabs]
from system/memory import nimCStrLen
when defined(nimPreviewSlimSystem):

View File

@@ -11,7 +11,7 @@
# included from sem.nim
from sugar import dup
from std/sugar import dup
type
ObjConstrContext = object

View File

@@ -26,7 +26,7 @@ import
renderer, types, modulegraphs, options, spawn, lineinfos
from trees import getMagic, getRoot
from strutils import `%`
from std/strutils import `%`
discard """

View File

@@ -8,11 +8,13 @@
#
import
intsets, ast, astalgo, msgs, renderer, magicsys, types, idents, trees,
wordrecg, strutils, options, guards, lineinfos, semfold, semdata,
modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling, tables,
ast, astalgo, msgs, renderer, magicsys, types, idents, trees,
wordrecg, options, guards, lineinfos, semfold, semdata,
modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling,
semstrictfuncs
import std/[tables, intsets, strutils]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -9,8 +9,9 @@
## Computes hash values for routine (proc, method etc) signatures.
import ast, tables, ropes, modulegraphs, options, msgs, pathutils
from hashes import Hash
import ast, ropes, modulegraphs, options, msgs, pathutils
from std/hashes import Hash
import std/tables
import types
import ../dist/checksums/src/checksums/md5

View File

@@ -11,10 +11,12 @@
## the call to overloaded procs, generic procs and operators.
import
intsets, ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst,
magicsys, idents, lexer, options, parampatterns, strutils, trees,
ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst,
magicsys, idents, lexer, options, parampatterns, trees,
linter, lineinfos, lowerings, modulegraphs, concepts
import std/[intsets, strutils]
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -32,11 +32,13 @@
# included from sigmatch.nim
import algorithm, sets, prefixmatches, parseutils, tables
import prefixmatches
from wordrecg import wDeprecated, wError, wAddr, wYield
import std/[algorithm, sets, parseutils, tables]
when defined(nimsuggest):
import tables, pathutils # importer
import std/tables, pathutils # importer
const
sep = '\t'

View File

@@ -10,9 +10,10 @@
## Implements the dispatcher for the different parsers.
import
strutils, llstream, ast, idents, lexer, options, msgs, parser,
llstream, ast, idents, lexer, options, msgs, parser,
filters, filter_tmpl, renderer, lineinfos, pathutils
import std/strutils
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]

View File

@@ -9,8 +9,9 @@
# Implements a table from trees to trees. Does structural equivalence checking.
import
hashes, ast, astalgo, types
import ast, astalgo, types
import std/hashes
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -10,8 +10,8 @@
## This module contains 'typeAllowed' and friends which check
## for invalid types like `openArray[var int]`.
import
intsets, ast, renderer, options, semdata, types
import ast, renderer, options, semdata, types
import std/intsets
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -10,9 +10,11 @@
# this module contains routines for accessing and iterating over types
import
intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options,
ast, astalgo, trees, msgs, platform, renderer, options,
lineinfos, int128, modulegraphs, astmsgs
import std/[intsets, strutils]
when defined(nimPreviewSlimSystem):
import std/[assertions, formatfloat]

View File

@@ -7,7 +7,8 @@
# distribution, for details about the copyright.
#
import renderer, strutils, ast, types
import renderer, ast, types
import std/strutils
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -7,9 +7,11 @@
# distribution, for details about the copyright.
#
import ast, types, msgs, os, options, idents, lineinfos
import ast, types, msgs, options, idents, lineinfos
from pathutils import AbsoluteFile
import std/os
when defined(nimPreviewSlimSystem):
import std/syncio

View File

@@ -26,14 +26,14 @@
# solves the opcLdConst vs opcAsgnConst issue. Of course whether we need
# this copy depends on the involved types.
import tables
import std/[tables, intsets, strutils]
when defined(nimPreviewSlimSystem):
import std/assertions
import
strutils, ast, types, msgs, renderer, vmdef, trees,
intsets, magicsys, options, lowerings, lineinfos, transf, astmsgs
ast, types, msgs, renderer, vmdef, trees,
magicsys, options, lowerings, lineinfos, transf, astmsgs
from modulegraphs import getBody

View File

@@ -9,9 +9,11 @@
## Implements marshaling for the VM.
import streams, json, intsets, tables, ast, astalgo, idents, types, msgs,
import ast, astalgo, idents, types, msgs,
options, lineinfos
import std/[streams, json, intsets, tables]
when defined(nimPreviewSlimSystem):
import std/[assertions, formatfloat]

View File

@@ -1,7 +1,7 @@
import
options, vmdef, times, lineinfos, strutils, tables,
msgs
import options, vmdef, lineinfos, msgs
import std/[times, strutils, tables]
proc enter*(prof: var Profiler, c: PCtx, tos: PStackFrame) {.inline.} =
if optProfileVM in c.config.globalOptions:

View File

@@ -145,6 +145,6 @@ const
from std/enumutils import genEnumCaseStmt
from strutils import normalize
from std/strutils import normalize
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize)