diff options
-rw-r--r-- | compiler/condsyms.nim | 1 | ||||
-rw-r--r-- | lib/system.nim | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index aecbde66e..297b865b2 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -90,3 +90,4 @@ proc initDefines*() = defineSymbol("nimnode") defineSymbol("nimnomagic64") defineSymbol("nimvarargstyped") + defineSymbol("nimtypedescfixed") diff --git a/lib/system.nim b/lib/system.nim index 78769208c..7dae074f3 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -572,12 +572,14 @@ proc unsafeNew*[T](a: var ref T, size: Natural) {.magic: "New", noSideEffect.} ## purposes when you know what you're doing! proc sizeof*[T](x: T): int {.magic: "SizeOf", noSideEffect.} -proc sizeof*(x: typedesc): int {.magic: "SizeOf", noSideEffect.} ## returns the size of ``x`` in bytes. Since this is a low-level proc, ## its usage is discouraged - using ``new`` for the most cases suffices ## that one never needs to know ``x``'s size. As a special semantic rule, ## ``x`` may also be a type identifier (``sizeof(int)`` is valid). +when defined(nimtypedescfixed): + proc sizeof*(x: typedesc): int {.magic: "SizeOf", noSideEffect.} + proc `<`*[T](x: Ordinal[T]): T {.magic: "UnaryLt", noSideEffect.} ## unary ``<`` that can be used for nice looking excluding ranges: ## |