move assertions out of system (#19599)
This commit is contained in:
parent
a8b5ad845c
commit
7f6e800caf
110 changed files with 361 additions and 10 deletions
|
|
@ -10,6 +10,10 @@
|
|||
include "system/inclrtl"
|
||||
import std/private/since
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
|
||||
## This module contains the interface to the compiler's abstract syntax
|
||||
## tree (`AST`:idx:). Macros operate on this tree.
|
||||
##
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ runnableExamples:
|
|||
|
||||
import std/private/since
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
|
||||
type
|
||||
SortOrder* = enum
|
||||
Descending, Ascending
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@ import std/private/since
|
|||
|
||||
import macros
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
|
||||
when defined(nimHasEffectsOf):
|
||||
{.experimental: "strictEffects".}
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
|
|||
|
|
@ -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.`$`
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
import
|
||||
strutils, streams
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
const
|
||||
EndOfFile* = '\0' ## end of file marker
|
||||
NewLines* = {'\c', '\L'}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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]>`_.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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'}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ when defined(windows):
|
|||
import winlean
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/syncio
|
||||
import std/[syncio, assertions]
|
||||
|
||||
type
|
||||
PTerminal = ref object
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
## This module provides various assertion utilities.
|
||||
##
|
||||
## **Note:** This module is reexported by `system` and thus does not need to be
|
||||
## imported directly (with `system/assertions`).
|
||||
#
|
||||
#
|
||||
# Nim's Runtime Library
|
||||
# (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):
|
||||
include "system/fatal"
|
||||
|
|
@ -10,6 +10,10 @@
|
|||
import macros
|
||||
from typetraits import OrdinalEnum, HoleyEnum
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
|
||||
# xxx `genEnumCaseStmt` needs tests and runnableExamples
|
||||
|
||||
macro genEnumCaseStmt*(typ: typedesc, argSym: typed, default: typed,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ import macros
|
|||
from enumutils import symbolName
|
||||
from typetraits import OrdinalEnum
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
when not defined(nimFixedForwardGeneric):
|
||||
# xxx remove pending csources_v1 update >= 1.2.0
|
||||
proc to[T](node: JsonNode, t: typedesc[T]): T =
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@
|
|||
import std/private/since
|
||||
import hashes
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
type
|
||||
BitScalar = uint
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ import os
|
|||
when defined(windows):
|
||||
from strutils import replace
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
|
||||
when defined(nimHasEffectsOf):
|
||||
{.experimental: "strictEffects".}
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ runnableExamples("-r:off"):
|
|||
import strutils
|
||||
from endians import bigEndian32, bigEndian64
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/syncio
|
||||
|
||||
const Sha1DigestSize = 20
|
||||
|
||||
type
|
||||
|
|
|
|||
|
|
@ -1830,8 +1830,11 @@ when not defined(nimscript):
|
|||
when defined(nimV2):
|
||||
include system/arc
|
||||
|
||||
import system/assertions
|
||||
export assertions
|
||||
when not defined(nimPreviewSlimSystem):
|
||||
{.deprecated: """assertions is about to move out of system; use `-d:nimPreviewSlimSystem` and
|
||||
import `std/assertions`.""".}
|
||||
import std/assertions
|
||||
export assertions
|
||||
|
||||
import system/iterators
|
||||
export iterators
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
import std/private/digitsutils
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
const
|
||||
dtoaMinBufferLength*: cint = 64
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
proc c_memcpy(a, b: pointer, size: csize_t): pointer {.importc: "memcpy", header: "<string.h>", discardable.}
|
||||
|
||||
proc addCstringN(result: var string, buf: cstring; buflen: int) =
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
when defined(nimHasLentIterators) and not defined(nimNoLentIterators):
|
||||
template lent2(T): untyped = lent T
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
import std/private/digitsutils
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
|
||||
template sf_Assert(x: untyped): untyped =
|
||||
assert(x)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue