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

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

View file

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

View file

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

View file

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

View file

@ -67,6 +67,10 @@ runnableExamples:
import std/private/since
when defined(nimPreviewSlimSystem):
import std/assertions
type
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`

View file

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

View file

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

View file

@ -60,6 +60,10 @@ import std/private/since
import bitops, fenv
when defined(nimPreviewSlimSystem):
import std/assertions
when defined(c) or defined(cpp):
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.

View file

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

View file

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

View file

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

View file

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

View file

@ -13,6 +13,10 @@
import deques, streams
when defined(nimPreviewSlimSystem):
import std/assertions
type
PipeOutStream*[T] = ref object of T
# 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 strutils except format
when defined(nimPreviewSlimSystem):
import std/assertions
proc mkDigit(v: int, typ: char): string {.inline.} =
assert(v < 26)
if v < 10:

View file

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

View file

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

View file

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

View file

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

View file

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