move assertions out of system (#19599)

This commit is contained in:
flywind 2022-03-24 03:34:53 +08:00 • committed by GitHub
commit 7f6e800caf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 361 additions and 10 deletions

View file

@ -12,6 +12,9 @@
import import
ast, astalgo, types, trees, intsets ast, astalgo, types, trees, intsets
when defined(nimPreviewSlimSystem):
import std/assertions
type type
TAnalysisResult* = enum TAnalysisResult* = enum
arNo, arMaybe, arYes arNo, arMaybe, arYes

View file

@ -13,6 +13,9 @@ import
lineinfos, hashes, options, ropes, idents, int128, tables lineinfos, hashes, options, ropes, idents, int128, tables
from strutils import toLowerAscii from strutils import toLowerAscii
when defined(nimPreviewSlimSystem):
import std/assertions
export int128 export int128
type type

View file

@ -15,6 +15,9 @@ import
ast, hashes, intsets, strutils, options, lineinfos, ropes, idents, rodutils, ast, hashes, intsets, strutils, options, lineinfos, ropes, idents, rodutils,
msgs msgs
when defined(nimPreviewSlimSystem):
import std/assertions
proc hashNode*(p: RootRef): Hash proc hashNode*(p: RootRef): Hash
proc treeToYaml*(conf: ConfigRef; n: PNode, indent: int = 0, maxRecDepth: int = - 1): Rope proc treeToYaml*(conf: ConfigRef; n: PNode, indent: int = 0, maxRecDepth: int = - 1): Rope
# Convert a tree into its YAML representation; this is used by the # Convert a tree into its YAML representation; this is used by the

View file

@ -10,6 +10,9 @@
# this unit handles Nim sets; it implements bit sets # this unit handles Nim sets; it implements bit sets
# the code here should be reused in the Nim standard library # the code here should be reused in the Nim standard library
when defined(nimPreviewSlimSystem):
import std/assertions
type type
ElemType = byte ElemType = byte
TBitSet* = seq[ElemType] # we use byte here to avoid issues with TBitSet* = seq[ElemType] # we use byte here to avoid issues with

View file

@ -10,6 +10,9 @@
## BTree implementation with few features, but good enough for the ## BTree implementation with few features, but good enough for the
## Nim compiler's needs. ## Nim compiler's needs.
when defined(nimPreviewSlimSystem):
import std/assertions
const const
M = 512 # max children per B-tree node = M-1 M = 512 # max children per B-tree node = M-1
# (must be even and greater than 2) # (must be even and greater than 2)

View file

@ -13,6 +13,9 @@ import
ast, types, hashes, strutils, msgs, wordrecg, ast, types, hashes, strutils, msgs, wordrecg,
platform, trees, options, cgendata platform, trees, options, cgendata
when defined(nimPreviewSlimSystem):
import std/assertions
proc getPragmaStmt*(n: PNode, w: TSpecialWord): PNode = proc getPragmaStmt*(n: PNode, w: TSpecialWord): PNode =
case n.kind case n.kind
of nkStmtList: of nkStmtList:

View file

@ -17,6 +17,10 @@ import
lowerings, tables, sets, ndi, lineinfos, pathutils, transf, lowerings, tables, sets, ndi, lineinfos, pathutils, transf,
injectdestructors, astmsgs injectdestructors, astmsgs
when defined(nimPreviewSlimSystem):
import std/assertions
when not defined(leanCompiler): when not defined(leanCompiler):
import spawn, semparallel import spawn, semparallel

View file

@ -13,6 +13,10 @@ import
intsets, options, ast, msgs, idents, renderer, types, magicsys, intsets, options, ast, msgs, idents, renderer, types, magicsys,
sempass2, strutils, modulegraphs, lineinfos sempass2, strutils, modulegraphs, lineinfos
when defined(nimPreviewSlimSystem):
import std/assertions
proc genConv(n: PNode, d: PType, downcast: bool; conf: ConfigRef): PNode = proc genConv(n: PNode, d: PType, downcast: bool; conf: ConfigRef): PNode =
var dest = skipTypes(d, abstractPtrs) var dest = skipTypes(d, abstractPtrs)
var source = skipTypes(n.typ, abstractPtrs) var source = skipTypes(n.typ, abstractPtrs)

View file

@ -133,6 +133,9 @@ import
renderer, magicsys, lowerings, lambdalifting, modulegraphs, lineinfos, renderer, magicsys, lowerings, lambdalifting, modulegraphs, lineinfos,
tables, options tables, options
when defined(nimPreviewSlimSystem):
import std/assertions
type type
Ctx = object Ctx = object
g: ModuleGraph g: ModuleGraph

View file

@ -31,6 +31,9 @@ import
from ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect from ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect
when defined(nimPreviewSlimSystem):
import std/assertions
# but some have deps to imported modules. Yay. # but some have deps to imported modules. Yay.
bootSwitch(usedTinyC, hasTinyCBackend, "-d:tinyc") bootSwitch(usedTinyC, hasTinyCBackend, "-d:tinyc")
bootSwitch(usedFFI, hasFFI, "-d:nimHasLibFFI") bootSwitch(usedFFI, hasFFI, "-d:nimHasLibFFI")

View file

@ -15,6 +15,9 @@ import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types,
from magicsys import addSonSkipIntLit from magicsys import addSonSkipIntLit
when defined(nimPreviewSlimSystem):
import std/assertions
const const
logBindings = false logBindings = false

View file

@ -32,6 +32,9 @@
import ast, intsets, lineinfos, renderer import ast, intsets, lineinfos, renderer
import std/private/asciitables import std/private/asciitables
when defined(nimPreviewSlimSystem):
import std/assertions
type type
InstrKind* = enum InstrKind* = enum
goto, fork, def, use goto, fork, def, use

View file

@ -1,6 +1,10 @@
import ast, idents, lineinfos, modulegraphs, magicsys import ast, idents, lineinfos, modulegraphs, magicsys
when defined(nimPreviewSlimSystem):
import std/assertions
proc genEnumToStrProc*(t: PType; info: TLineInfo; g: ModuleGraph; idgen: IdGenerator): PSym = proc genEnumToStrProc*(t: PType; info: TLineInfo; g: ModuleGraph; idgen: IdGenerator): PSym =
result = newSym(skProc, getIdent(g.cache, "$"), nextSymId idgen, t.owner, info) result = newSym(skProc, getIdent(g.cache, "$"), nextSymId idgen, t.owner, info)

View file

@ -12,6 +12,9 @@
import ast, renderer, options, strutils, types import ast, renderer, options, strutils, types
when defined(nimPreviewSlimSystem):
import std/assertions
type type
ErrorKind* = enum ## expand as you need. ErrorKind* = enum ## expand as you need.
RawTypeMismatchError RawTypeMismatchError

View file

@ -16,6 +16,9 @@ import ropes, platform, condsyms, options, msgs, lineinfos, pathutils
import std/[os, strutils, osproc, sha1, streams, sequtils, times, strtabs, json, jsonutils, sugar] import std/[os, strutils, osproc, sha1, streams, sequtils, times, strtabs, json, jsonutils, sugar]
when defined(nimPreviewSlimSystem):
import std/syncio
type type
TInfoCCProp* = enum # properties of the C compiler: TInfoCCProp* = enum # properties of the C compiler:
hasSwitchRange, # CC allows ranges in switch statements (GNU C) hasSwitchRange, # CC allows ranges in switch statements (GNU C)

View file

@ -12,6 +12,9 @@
import msgs, std / sha1, os, osproc, streams, options, import msgs, std / sha1, os, osproc, streams, options,
lineinfos, pathutils lineinfos, pathutils
when defined(nimPreviewSlimSystem):
import std/syncio
proc readOutput(p: Process): (string, int) = proc readOutput(p: Process): (string, int) =
result[0] = "" result[0] = ""
var output = p.outputStream var output = p.outputStream

View file

@ -12,6 +12,9 @@
import ast, astalgo, msgs, magicsys, nimsets, trees, types, renderer, idents, import ast, astalgo, msgs, magicsys, nimsets, trees, types, renderer, idents,
saturate, modulegraphs, options, lineinfos, int128 saturate, modulegraphs, options, lineinfos, int128
when defined(nimPreviewSlimSystem):
import std/assertions
const const
someEq = {mEqI, mEqF64, mEqEnum, mEqCh, mEqB, mEqRef, mEqProc, someEq = {mEqI, mEqF64, mEqEnum, mEqCh, mEqB, mEqRef, mEqProc,
mEqStr, mEqSet, mEqCString} mEqStr, mEqSet, mEqCString}

View file

@ -9,6 +9,9 @@
# This include implements the high level optimization pass. # This include implements the high level optimization pass.
when defined(nimPreviewSlimSystem):
import std/assertions
proc hlo(c: PContext, n: PNode): PNode proc hlo(c: PContext, n: PNode): PNode
proc evalPattern(c: PContext, n, orig: PNode): PNode = proc evalPattern(c: PContext, n, orig: PNode): PNode =

View file

@ -3,6 +3,9 @@
import hashes, rodfiles import hashes, rodfiles
when defined(nimPreviewSlimSystem):
import std/assertions
type type
LitId* = distinct uint32 LitId* = distinct uint32

View file

@ -20,6 +20,9 @@
import std/packedsets, algorithm, tables import std/packedsets, algorithm, tables
when defined(nimPreviewSlimSystem):
import std/assertions
import ".."/[ast, options, lineinfos, modulegraphs, cgendata, cgen, import ".."/[ast, options, lineinfos, modulegraphs, cgendata, cgen,
pathutils, extccomp, msgs] pathutils, extccomp, msgs]

View file

@ -10,6 +10,10 @@
## Dead code elimination (=DCE) for IC. ## Dead code elimination (=DCE) for IC.
import std/[intsets, tables] import std/[intsets, tables]
when defined(nimPreviewSlimSystem):
import std/assertions
import ".." / [ast, options, lineinfos, types] import ".." / [ast, options, lineinfos, types]
import packed_ast, ic, bitabs import packed_ast, ic, bitabs

View file

@ -14,6 +14,9 @@ import ".." / [ast, idents, lineinfos, msgs, ropes, options,
#import ".." / [renderer, astalgo] #import ".." / [renderer, astalgo]
from os import removeFile, isAbsolute from os import removeFile, isAbsolute
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
type type
PackedConfig* = object PackedConfig* = object
backend: TBackend backend: TBackend

View file

@ -11,6 +11,10 @@
## The set must cover a complete Nim project. ## The set must cover a complete Nim project.
import sets import sets
when defined(nimPreviewSlimSystem):
import std/assertions
import ".." / [ast, modulegraphs] import ".." / [ast, modulegraphs]
import packed_ast, bitabs, ic import packed_ast, bitabs, ic

View file

@ -16,6 +16,9 @@ import sets
from os import nil from os import nil
from std/private/miscdollars import toLocation from std/private/miscdollars import toLocation
when defined(nimPreviewSlimSystem):
import std/assertions
import ".." / [ast, modulegraphs, msgs, options] import ".." / [ast, modulegraphs, msgs, options]
import packed_ast, bitabs, ic import packed_ast, bitabs, ic

View file

@ -16,6 +16,9 @@ import hashes, tables, strtabs
import bitabs import bitabs
import ".." / [ast, options] import ".." / [ast, options]
when defined(nimPreviewSlimSystem):
import std/assertions
type type
SymId* = distinct int32 SymId* = distinct int32
ModuleId* = distinct int32 ModuleId* = distinct int32

View file

@ -16,6 +16,9 @@ import ".." / [ast, modulegraphs, trees, extccomp, btrees,
import tables import tables
when defined(nimPreviewSlimSystem):
import std/assertions
import packed_ast, ic, bitabs import packed_ast, ic, bitabs
proc replayStateChanges*(module: PSym; g: ModuleGraph) = proc replayStateChanges*(module: PSym; g: ModuleGraph) =

View file

@ -16,6 +16,9 @@
from typetraits import supportsCopyMem from typetraits import supportsCopyMem
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
## Overview ## Overview
## ======== ## ========
## `RodFile` represents a Rod File (versioned binary format), and the ## `RodFile` represents a Rod File (versioned binary format), and the

View file

@ -14,6 +14,9 @@
import import
hashes, wordrecg hashes, wordrecg
when defined(nimPreviewSlimSystem):
import std/assertions
type type
PIdent* = ref TIdent PIdent* = ref TIdent
TIdent*{.acyclic.} = object TIdent*{.acyclic.} = object

View file

@ -15,6 +15,9 @@ import
modulegraphs, wordrecg, tables modulegraphs, wordrecg, tables
from strutils import `%` from strutils import `%`
when defined(nimPreviewSlimSystem):
import std/assertions
proc readExceptSet*(c: PContext, n: PNode): IntSet = proc readExceptSet*(c: PContext, n: PNode): IntSet =
assert n.kind in {nkImportExceptStmt, nkExportExceptStmt} assert n.kind in {nkImportExceptStmt, nkExportExceptStmt}
result = initIntSet() result = initIntSet()

View file

@ -19,6 +19,9 @@ import
lineinfos, parampatterns, sighashes, liftdestructors, optimizer, lineinfos, parampatterns, sighashes, liftdestructors, optimizer,
varpartitions varpartitions
when defined(nimPreviewSlimSystem):
import std/assertions
from trees import exprStructuralEquivalent, getRoot from trees import exprStructuralEquivalent, getRoot
type type

View file

@ -5,6 +5,9 @@
from math import trunc from math import trunc
when defined(nimPreviewSlimSystem):
import std/assertions
type type
Int128* = object Int128* = object
udata: array[4, uint32] udata: array[4, uint32]

View file

@ -13,6 +13,9 @@
import import
ast, types, renderer, intsets ast, types, renderer, intsets
when defined(nimPreviewSlimSystem):
import std/assertions
proc canAlias(arg, ret: PType; marker: var IntSet): bool proc canAlias(arg, ret: PType; marker: var IntSet): bool
proc canAliasN(arg: PType; n: PNode; marker: var IntSet): bool = proc canAliasN(arg: PType; n: PNode; marker: var IntSet): bool =

View file

@ -14,6 +14,9 @@ import
idents, renderer, types, magicsys, lowerings, tables, modulegraphs, lineinfos, idents, renderer, types, magicsys, lowerings, tables, modulegraphs, lineinfos,
transf, liftdestructors, typeallowed transf, liftdestructors, typeallowed
when defined(nimPreviewSlimSystem):
import std/assertions
discard """ discard """
The basic approach is that captured vars need to be put on the heap and The basic approach is that captured vars need to be put on the heap and
that the calling chain needs to be explicitly modelled. Things to consider: that the calling chain needs to be explicitly modelled. Things to consider:

View file

@ -19,6 +19,9 @@ import
hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream, hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream,
wordrecg, lineinfos, pathutils, parseutils wordrecg, lineinfos, pathutils, parseutils
when defined(nimPreviewSlimSystem):
import std/assertions
const const
MaxLineLength* = 80 # lines longer than this lead to a warning MaxLineLength* = 80 # lines longer than this lead to a warning
numChars*: set[char] = {'0'..'9', 'a'..'z', 'A'..'Z'} numChars*: set[char] = {'0'..'9', 'a'..'z', 'A'..'Z'}

View file

@ -15,6 +15,9 @@ import modulegraphs, lineinfos, idents, ast, renderer, semdata,
from trees import isCaseObj from trees import isCaseObj
when defined(nimPreviewSlimSystem):
import std/assertions
type type
TLiftCtx = object TLiftCtx = object
g: ModuleGraph g: ModuleGraph

View file

@ -12,6 +12,9 @@
import import
pathutils pathutils
when defined(nimPreviewSlimSystem):
import std/syncio
# support `useGnuReadline`, `useLinenoise` for backwards compatibility # support `useGnuReadline`, `useLinenoise` for backwards compatibility
const hasRstdin = (defined(nimUseLinenoise) or defined(useLinenoise) or defined(useGnuReadline)) and const hasRstdin = (defined(nimUseLinenoise) or defined(useLinenoise) or defined(useGnuReadline)) and
not defined(windows) not defined(windows)

View file

@ -9,6 +9,10 @@
# This module implements lookup helpers. # This module implements lookup helpers.
import std/[algorithm, strutils] import std/[algorithm, strutils]
when defined(nimPreviewSlimSystem):
import std/assertions
import import
intsets, ast, astalgo, idents, semdata, types, msgs, options, intsets, ast, astalgo, idents, semdata, types, msgs, options,
renderer, nimfix/prettybase, lineinfos, modulegraphs, astmsgs renderer, nimfix/prettybase, lineinfos, modulegraphs, astmsgs

View file

@ -15,6 +15,9 @@ const
import ast, astalgo, types, idents, magicsys, msgs, options, modulegraphs, import ast, astalgo, types, idents, magicsys, msgs, options, modulegraphs,
lineinfos lineinfos
when defined(nimPreviewSlimSystem):
import std/assertions
proc newDeref*(n: PNode): PNode {.inline.} = proc newDeref*(n: PNode): PNode {.inline.} =
result = newNodeIT(nkHiddenDeref, n.info, n.typ[0]) result = newNodeIT(nkHiddenDeref, n.info, n.typ[0])
result.add n result.add n

View file

@ -22,6 +22,10 @@ import
modules, modules,
modulegraphs, lineinfos, pathutils, vmprofiler modulegraphs, lineinfos, pathutils, vmprofiler
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
import ic / [cbackend, integrity, navigator] import ic / [cbackend, integrity, navigator]
from ic / ic import rodViewer from ic / ic import rodViewer

View file

@ -15,6 +15,9 @@ import intsets, tables, hashes, md5_old
import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils
import ic / [packed_ast, ic] import ic / [packed_ast, ic]
when defined(nimPreviewSlimSystem):
import std/assertions
type type
SigHash* = distinct MD5Digest SigHash* = distinct MD5Digest

View file

@ -14,6 +14,9 @@ import
idents, lexer, passes, syntaxes, llstream, modulegraphs, idents, lexer, passes, syntaxes, llstream, modulegraphs,
lineinfos, pathutils, tables lineinfos, pathutils, tables
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
import ic / replayer import ic / replayer
proc resetSystemArtifacts*(g: ModuleGraph) = proc resetSystemArtifacts*(g: ModuleGraph) =

View file

@ -12,6 +12,10 @@ import
std/private/miscdollars, std/private/miscdollars,
options, ropes, lineinfos, pathutils, strutils2 options, ropes, lineinfos, pathutils, strutils2
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
type InstantiationInfo* = typeof(instantiationInfo()) type InstantiationInfo* = typeof(instantiationInfo())
template instLoc*(): InstantiationInfo = instantiationInfo(-2, fullPaths = true) template instLoc*(): InstantiationInfo = instantiationInfo(-2, fullPaths = true)

View file

@ -12,6 +12,9 @@
import ast, msgs, ropes, options, pathutils import ast, msgs, ropes, options, pathutils
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
type type
NdiFile* = object NdiFile* = object
enabled: bool enabled: bool

View file

@ -10,6 +10,9 @@
import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes
import sequtils, strutils, sets import sequtils, strutils, sets
when defined(nimPreviewSlimSystem):
import std/assertions
# IMPORTANT: notes not up to date, i'll update this comment again # IMPORTANT: notes not up to date, i'll update this comment again
# #
# notes: # notes:

View file

@ -8,6 +8,10 @@
# #
import std/[os, strutils, parseopt] import std/[os, strutils, parseopt]
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(windows) and not defined(nimKochBootstrap): when defined(windows) and not defined(nimKochBootstrap):
# remove workaround pending bootstrap >= 1.5.1 # remove workaround pending bootstrap >= 1.5.1
# refs https://github.com/nim-lang/Nim/issues/18334#issuecomment-867114536 # refs https://github.com/nim-lang/Nim/issues/18334#issuecomment-867114536

View file

@ -12,6 +12,9 @@
import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils, import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils,
std/sha1, tables std/sha1, tables
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
proc addPath*(conf: ConfigRef; path: AbsoluteDir, info: TLineInfo) = proc addPath*(conf: ConfigRef; path: AbsoluteDir, info: TLineInfo) =
if not conf.searchPaths.contains(path): if not conf.searchPaths.contains(path):
conf.searchPaths.insert(path, 0) conf.searchPaths.insert(path, 0)

View file

@ -13,6 +13,9 @@ import
llstream, commands, os, strutils, msgs, lexer, ast, llstream, commands, os, strutils, msgs, lexer, ast,
options, idents, wordrecg, strtabs, lineinfos, pathutils, scriptconfig options, idents, wordrecg, strtabs, lineinfos, pathutils, scriptconfig
when defined(nimPreviewSlimSystem):
import std/syncio
# ---------------- configuration file parser ----------------------------- # ---------------- configuration file parser -----------------------------
# we use Nim's lexer here to save space and work # we use Nim's lexer here to save space and work

View file

@ -15,6 +15,9 @@
import import
llstream, strutils llstream, strutils
when defined(nimPreviewSlimSystem):
import std/assertions
const const
Lrz* = ' ' Lrz* = ' '
Apo* = '\'' Apo* = '\''

View file

@ -19,6 +19,10 @@ Unstable API
import os, strutils import os, strutils
when defined(nimPreviewSlimSystem):
import std/assertions
const const
docCss* = "$nimr/doc/nimdoc.css" docCss* = "$nimr/doc/nimdoc.css"
docHackNim* = "$nimr/tools/dochack/dochack.nim" docHackNim* = "$nimr/tools/dochack/dochack.nim"

View file

@ -12,6 +12,9 @@
import import
ast, astalgo, lineinfos, bitsets, types, options ast, astalgo, lineinfos, bitsets, types, options
when defined(nimPreviewSlimSystem):
import std/assertions
proc inSet*(s: PNode, elem: PNode): bool = proc inSet*(s: PNode, elem: PNode): bool =
assert s.kind == nkCurly assert s.kind == nkCurly
if s.kind != nkCurly: if s.kind != nkCurly:

View file

@ -14,6 +14,11 @@ import
from terminal import isatty from terminal import isatty
from times import utc, fromUnix, local, getTime, format, DateTime from times import utc, fromUnix, local, getTime, format, DateTime
from std/private/globs import nativeToUnixPath from std/private/globs import nativeToUnixPath
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
const const
hasTinyCBackend* = defined(tinyc) hasTinyCBackend* = defined(tinyc)
useEffectSystem* = true useEffectSystem* = true

View file

@ -36,6 +36,9 @@ import
when defined(nimpretty): when defined(nimpretty):
import layouter import layouter
when defined(nimPreviewSlimSystem):
import std/assertions
type type
Parser* = object # A Parser object represents a file that Parser* = object # A Parser object represents a file that
# is being parsed # is being parsed

View file

@ -16,6 +16,9 @@ import
syntaxes, modulegraphs, reorder, syntaxes, modulegraphs, reorder,
lineinfos, pathutils lineinfos, pathutils
when defined(nimPreviewSlimSystem):
import std/syncio
type type
TPassData* = tuple[input: PNode, closeOutput: PNode] TPassData* = tuple[input: PNode, closeOutput: PNode]

View file

@ -13,7 +13,7 @@
import os, pathnorm import os, pathnorm
when defined(nimPreviewSlimSystem): when defined(nimPreviewSlimSystem):
import std/syncio import std/[syncio, assertions]
type type
AbsoluteFile* = distinct string AbsoluteFile* = distinct string

View file

@ -13,6 +13,9 @@
import import
ast, types, semdata, sigmatch, idents, aliases, parampatterns, trees ast, types, semdata, sigmatch, idents, aliases, parampatterns, trees
when defined(nimPreviewSlimSystem):
import std/assertions
type type
TPatternContext = object TPatternContext = object
owner: PSym owner: PSym

View file

@ -16,6 +16,10 @@
import import
strutils strutils
when defined(nimPreviewSlimSystem):
import std/assertions
type type
TSystemOS* = enum # Also add OS in initialization section and alias TSystemOS* = enum # Also add OS in initialization section and alias
# conditionals to condsyms (end of module). # conditionals to condsyms (end of module).

View file

@ -14,6 +14,9 @@ import
wordrecg, ropes, options, strutils, extccomp, math, magicsys, trees, wordrecg, ropes, options, strutils, extccomp, math, magicsys, trees,
types, lookups, lineinfos, pathutils, linter types, lookups, lineinfos, pathutils, linter
when defined(nimPreviewSlimSystem):
import std/assertions
from ic / ic import addCompilerProc from ic / ic import addCompilerProc
const const

View file

@ -17,6 +17,9 @@ when defined(nimHasUsed):
import import
lexer, options, idents, strutils, ast, msgs, lineinfos lexer, options, idents, strutils, ast, msgs, lineinfos
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
type type
TRenderFlag* = enum TRenderFlag* = enum
renderNone, renderNoBody, renderNoComments, renderDocComments, renderNone, renderNoBody, renderNoComments, renderDocComments,

View file

@ -4,6 +4,9 @@ import
msgs, modulegraphs, syntaxes, options, modulepaths, msgs, modulegraphs, syntaxes, options, modulepaths,
lineinfos lineinfos
when defined(nimPreviewSlimSystem):
import std/assertions
type type
DepN = ref object DepN = ref object
pnode: PNode pnode: PNode

View file

@ -10,6 +10,9 @@
## Serialization utilities for the compiler. ## Serialization utilities for the compiler.
import strutils, math import strutils, math
when defined(nimPreviewSlimSystem):
import std/assertions
# bcc on windows doesn't have C99 functions # bcc on windows doesn't have C99 functions
when defined(windows) and defined(bcc): when defined(windows) and defined(bcc):
{.emit: """#if defined(_MSC_VER) && _MSC_VER < 1900 {.emit: """#if defined(_MSC_VER) && _MSC_VER < 1900

View file

@ -60,6 +60,10 @@ import
from pathutils import AbsoluteFile from pathutils import AbsoluteFile
when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]
type type
FormatStr* = string # later we may change it to CString for better FormatStr* = string # later we may change it to CString for better
# performance of the code generator (assignments # performance of the code generator (assignments

View file

@ -16,6 +16,9 @@ import
os, times, osproc, wordrecg, strtabs, modulegraphs, os, times, osproc, wordrecg, strtabs, modulegraphs,
pathutils pathutils
when defined(nimPreviewSlimSystem):
import std/syncio
# we support 'cmpIgnoreStyle' natively for efficiency: # we support 'cmpIgnoreStyle' natively for efficiency:
from strutils import cmpIgnoreStyle, contains from strutils import cmpIgnoreStyle, contains

View file

@ -11,6 +11,9 @@
import tables import tables
when defined(nimPreviewSlimSystem):
import std/assertions
import import
intsets, options, ast, astalgo, msgs, idents, renderer, intsets, options, ast, astalgo, msgs, idents, renderer,
magicsys, vmdef, modulegraphs, lineinfos, sets, pathutils magicsys, vmdef, modulegraphs, lineinfos, sets, pathutils

View file

@ -17,6 +17,9 @@ import
from system/memory import nimCStrLen from system/memory import nimCStrLen
when defined(nimPreviewSlimSystem):
import std/assertions
proc errorType*(g: ModuleGraph): PType = proc errorType*(g: ModuleGraph): PType =
## creates a type representing an error state ## creates a type representing an error state
result = newType(tyError, nextTypeId(g.idgen), g.owners[^1]) result = newType(tyError, nextTypeId(g.idgen), g.owners[^1])

View file

@ -12,6 +12,9 @@ import
wordrecg, strutils, options, guards, lineinfos, semfold, semdata, wordrecg, strutils, options, guards, lineinfos, semfold, semdata,
modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling, tables modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling, tables
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(useDfa): when defined(useDfa):
import dfa import dfa

View file

@ -14,6 +14,9 @@ import ast, astalgo, msgs, types, magicsys, semdata, renderer, options,
from concepts import makeTypeDesc from concepts import makeTypeDesc
when defined(nimPreviewSlimSystem):
import std/assertions
const tfInstClearedFlags = {tfHasMeta, tfUnresolved} const tfInstClearedFlags = {tfHasMeta, tfUnresolved}
proc checkPartialConstructedType(conf: ConfigRef; info: TLineInfo, t: PType) = proc checkPartialConstructedType(conf: ConfigRef; info: TLineInfo, t: PType) =

View file

@ -13,6 +13,10 @@ import ast, tables, ropes, md5_old, modulegraphs
from hashes import Hash from hashes import Hash
import types import types
when defined(nimPreviewSlimSystem):
import std/assertions
proc `&=`(c: var MD5Context, s: string) = md5Update(c, s, s.len) proc `&=`(c: var MD5Context, s: string) = md5Update(c, s, s.len)
proc `&=`(c: var MD5Context, ch: char) = proc `&=`(c: var MD5Context, ch: char) =
# XXX suspicious code here; relies on ch being zero terminated? # XXX suspicious code here; relies on ch being zero terminated?

View file

@ -15,6 +15,9 @@ import
magicsys, idents, lexer, options, parampatterns, strutils, trees, magicsys, idents, lexer, options, parampatterns, strutils, trees,
linter, lineinfos, lowerings, modulegraphs, concepts linter, lineinfos, lowerings, modulegraphs, concepts
when defined(nimPreviewSlimSystem):
import std/assertions
type type
MismatchKind* = enum MismatchKind* = enum
kUnknown, kAlreadyGiven, kUnknownNamedParam, kTypeMismatch, kVarNeeded, kUnknown, kAlreadyGiven, kUnknownNamedParam, kTypeMismatch, kVarNeeded,

View file

@ -13,6 +13,9 @@ import
strutils, llstream, ast, idents, lexer, options, msgs, parser, strutils, llstream, ast, idents, lexer, options, msgs, parser,
filters, filter_tmpl, renderer, lineinfos, pathutils filters, filter_tmpl, renderer, lineinfos, pathutils
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
export Parser, parseAll, parseTopLevelStmt, closeParser export Parser, parseAll, parseTopLevelStmt, closeParser
type type

View file

@ -24,6 +24,9 @@ import
lowerings, liftlocals, lowerings, liftlocals,
modulegraphs, lineinfos modulegraphs, lineinfos
when defined(nimPreviewSlimSystem):
import std/assertions
proc transformBody*(g: ModuleGraph; idgen: IdGenerator, prc: PSym, cache: bool): PNode proc transformBody*(g: ModuleGraph; idgen: IdGenerator, prc: PSym, cache: bool): PNode
import closureiters, lambdalifting import closureiters, lambdalifting

View file

@ -12,6 +12,9 @@
import import
hashes, ast, astalgo, types hashes, ast, astalgo, types
when defined(nimPreviewSlimSystem):
import std/assertions
proc hashTree*(n: PNode): Hash = proc hashTree*(n: PNode): Hash =
if n.isNil: if n.isNil:
return return

View file

@ -13,6 +13,9 @@
import import
intsets, ast, renderer, options, semdata, types intsets, ast, renderer, options, semdata, types
when defined(nimPreviewSlimSystem):
import std/assertions
type type
TTypeAllowedFlag* = enum TTypeAllowedFlag* = enum
taField, taField,

View file

@ -13,6 +13,9 @@ import
intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options, intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options,
lineinfos, int128, modulegraphs, astmsgs lineinfos, int128, modulegraphs, astmsgs
when defined(nimPreviewSlimSystem):
import std/assertions
type type
TPreferedDesc* = enum TPreferedDesc* = enum
preferName, # default preferName, # default

View file

@ -32,6 +32,9 @@ import ast, types, lineinfos, options, msgs, renderer, typeallowed, modulegraphs
from trees import getMagic, isNoSideEffectPragma, stupidStmtListExpr from trees import getMagic, isNoSideEffectPragma, stupidStmtListExpr
from isolation_check import canAlias from isolation_check import canAlias
when defined(nimPreviewSlimSystem):
import std/assertions
type type
AbstractTime = distinct int AbstractTime = distinct int

View file

@ -10,6 +10,9 @@
import ast, types, msgs, os, options, idents, lineinfos import ast, types, msgs, os, options, idents, lineinfos
from pathutils import AbsoluteFile from pathutils import AbsoluteFile
when defined(nimPreviewSlimSystem):
import std/syncio
proc opSlurp*(file: string, info: TLineInfo, module: PSym; conf: ConfigRef): string = proc opSlurp*(file: string, info: TLineInfo, module: PSym; conf: ConfigRef): string =
try: try:
var filename = parentDir(toFullPath(conf, info)) / file var filename = parentDir(toFullPath(conf, info)) / file

View file

@ -29,6 +29,9 @@
import tables import tables
when defined(nimPreviewSlimSystem):
import std/assertions
import import
strutils, ast, types, msgs, renderer, vmdef, strutils, ast, types, msgs, renderer, vmdef,
intsets, magicsys, options, lowerings, lineinfos, transf, astmsgs intsets, magicsys, options, lowerings, lineinfos, transf, astmsgs

View file

@ -9,6 +9,9 @@
import pathutils import pathutils
when defined(nimPreviewSlimSystem):
import std/assertions
template setX(k, field) {.dirty.} = template setX(k, field) {.dirty.} =
a.slots[a.ra].ensureKind(k) a.slots[a.ra].ensureKind(k)
a.slots[a.ra].field = v a.slots[a.ra].field = v

View file

@ -12,6 +12,9 @@
import streams, json, intsets, tables, ast, astalgo, idents, types, msgs, import streams, json, intsets, tables, ast, astalgo, idents, types, msgs,
options, lineinfos options, lineinfos
when defined(nimPreviewSlimSystem):
import std/assertions
proc ptrToInt(x: PNode): int {.inline.} = proc ptrToInt(x: PNode): int {.inline.} =
result = cast[int](x) # don't skip alignment result = cast[int](x) # don't skip alignment

View file

@ -31,6 +31,10 @@ from std/osproc import nil
from system/formatfloat import addFloatRoundtrip, addFloatSprintf from system/formatfloat import addFloatRoundtrip, addFloatSprintf
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
# There are some useful procs in vmconv. # There are some useful procs in vmconv.
import vmconv, vmmarshal import vmconv, vmmarshal

View file

@ -10,6 +10,10 @@
include "system/inclrtl" include "system/inclrtl"
import std/private/since import std/private/since
when defined(nimPreviewSlimSystem):
import std/assertions
## This module contains the interface to the compiler's abstract syntax ## This module contains the interface to the compiler's abstract syntax
## tree (`AST`:idx:). Macros operate on this tree. ## tree (`AST`:idx:). Macros operate on this tree.
## ##

View file

@ -44,6 +44,10 @@ runnableExamples:
import std/private/since import std/private/since
when defined(nimPreviewSlimSystem):
import std/assertions
type type
SortOrder* = enum SortOrder* = enum
Descending, Ascending Descending, Ascending

View file

@ -16,6 +16,9 @@ import std/private/since
import strutils import strutils
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(windows): when defined(windows):
import winlean import winlean
from os import absolutePath from os import absolutePath

View file

@ -10,6 +10,10 @@
# An `include` file which contains common code for # An `include` file which contains common code for
# hash sets and tables. # hash sets and tables.
when defined(nimPreviewSlimSystem):
import std/assertions
const const
growthFactor = 2 growthFactor = 2

View file

@ -84,6 +84,10 @@ import std/private/since
import macros import macros
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(nimHasEffectsOf): when defined(nimHasEffectsOf):
{.experimental: "strictEffects".} {.experimental: "strictEffects".}
else: else:

View file

@ -67,6 +67,10 @@ runnableExamples:
import std/private/since import std/private/since
when defined(nimPreviewSlimSystem):
import std/assertions
type type
Hash* = int ## A hash value. Hash tables using these values should Hash* = int ## A hash value. Hash tables using these values should
## always have a size of a power of two so they can use the `and` ## always have a size of a power of two so they can use the `and`

View file

@ -165,7 +165,7 @@ import options # xxx remove this dependency using same approach as https://githu
import std/private/since import std/private/since
when defined(nimPreviewSlimSystem): when defined(nimPreviewSlimSystem):
import std/syncio import std/[syncio, assertions]
export export
tables.`$` tables.`$`

View file

@ -14,6 +14,9 @@
import import
strutils, streams strutils, streams
when defined(nimPreviewSlimSystem):
import std/assertions
const const
EndOfFile* = '\0' ## end of file marker EndOfFile* = '\0' ## end of file marker
NewLines* = {'\c', '\L'} NewLines* = {'\c', '\L'}

View file

@ -60,6 +60,10 @@ import std/private/since
import bitops, fenv import bitops, fenv
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(c) or defined(cpp): when defined(c) or defined(cpp):
proc c_isnan(x: float): bool {.importc: "isnan", header: "<math.h>".} proc c_isnan(x: float): bool {.importc: "isnan", header: "<math.h>".}
# a generic like `x: SomeFloat` might work too if this is implemented via a C macro. # a generic like `x: SomeFloat` might work too if this is implemented via a C macro.

View file

@ -71,6 +71,10 @@ supports pattern matching on `Option`s, with the `Some(<pattern>)` and
import typetraits import typetraits
when defined(nimPreviewSlimSystem):
import std/assertions
when (NimMajor, NimMinor) >= (1, 1): when (NimMajor, NimMinor) >= (1, 1):
type type
SomePointer = ref | ptr | pointer | proc SomePointer = ref | ptr | pointer | proc

View file

@ -35,7 +35,7 @@ import std/private/since
import strutils, pathnorm import strutils, pathnorm
when defined(nimPreviewSlimSystem): when defined(nimPreviewSlimSystem):
import std/syncio import std/[syncio, assertions]
const weirdTarget = defined(nimscript) or defined(js) const weirdTarget = defined(nimscript) or defined(js)

View file

@ -31,6 +31,10 @@ else:
when defined(linux) and defined(useClone): when defined(linux) and defined(useClone):
import linux import linux
when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
type type
ProcessOption* = enum ## Options that can be passed to `startProcess proc ProcessOption* = enum ## Options that can be passed to `startProcess proc
## <#startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]>`_. ## <#startProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]>`_.

View file

@ -14,6 +14,9 @@
import strutils, lexbase, streams, unicode import strutils, lexbase, streams, unicode
import std/private/decode_helpers import std/private/decode_helpers
when defined(nimPreviewSlimSystem):
import std/assertions
type type
JsonEventKind* = enum ## enumeration of all events that may occur when parsing JsonEventKind* = enum ## enumeration of all events that may occur when parsing
jsonError, ## an error occurred during parsing jsonError, ## an error occurred during parsing

View file

@ -13,6 +13,10 @@
import deques, streams import deques, streams
when defined(nimPreviewSlimSystem):
import std/assertions
type type
PipeOutStream*[T] = ref object of T PipeOutStream*[T] = ref object of T
# When stream peek operation is called, it reads from base stream # When stream peek operation is called, it reads from base stream

View file

@ -316,6 +316,10 @@ single letter DSLs.
import macros, parseutils, unicode import macros, parseutils, unicode
import strutils except format import strutils except format
when defined(nimPreviewSlimSystem):
import std/assertions
proc mkDigit(v: int, typ: char): string {.inline.} = proc mkDigit(v: int, typ: char): string {.inline.} =
assert(v < 26) assert(v < 26)
if v < 10: if v < 10:

View file

@ -53,6 +53,10 @@ import std/private/since
import import
hashes, strutils hashes, strutils
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(js) or defined(nimscript) or defined(Standalone): when defined(js) or defined(nimscript) or defined(Standalone):
{.pragma: rtlFunc.} {.pragma: rtlFunc.}
else: else:

View file

@ -82,6 +82,9 @@ include "system/inclrtl"
import std/private/since import std/private/since
from std/private/strimpl import cmpIgnoreStyleImpl, cmpIgnoreCaseImpl, startsWithImpl, endsWithImpl from std/private/strimpl import cmpIgnoreStyleImpl, cmpIgnoreCaseImpl, startsWithImpl, endsWithImpl
when defined(nimPreviewSlimSystem):
import std/assertions
const const
Whitespace* = {' ', '\t', '\v', '\r', '\l', '\f'} Whitespace* = {' ', '\t', '\v', '\r', '\l', '\f'}

View file

@ -67,7 +67,7 @@ when defined(windows):
import winlean import winlean
when defined(nimPreviewSlimSystem): when defined(nimPreviewSlimSystem):
import std/syncio import std/[syncio, assertions]
type type
PTerminal = ref object PTerminal = ref object

View file

@ -201,6 +201,10 @@ import strutils, math, options
import std/private/since import std/private/since
include "system/inclrtl" include "system/inclrtl"
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(js): when defined(js):
import jscore import jscore

View file

@ -15,6 +15,10 @@
import std/private/since import std/private/since
export system.`$` # for backward compatibility export system.`$` # for backward compatibility
when defined(nimPreviewSlimSystem):
import std/assertions
type HoleyEnum* = (not Ordinal) and enum ## Enum with holes. type HoleyEnum* = (not Ordinal) and enum ## Enum with holes.
type OrdinalEnum* = Ordinal and enum ## Enum without holes. type OrdinalEnum* = Ordinal and enum ## Enum without holes.

View file

@ -1,7 +1,13 @@
## This module provides various assertion utilities. #
## #
## **Note:** This module is reexported by `system` and thus does not need to be # Nim's Runtime Library
## imported directly (with `system/assertions`). # (c) Copyright 2022 Nim contributors
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## This module implements assertion handling.
when not declared(sysFatal): when not declared(sysFatal):
include "system/fatal" include "system/fatal"

Some files were not shown because too many files have changed in this diff Show more