From 6a8a409f1b8694e380e27afddff3cd9c29452b8c Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 31 Jul 2011 00:21:32 +0200 Subject: preparation for new 'is' operator; breaks bootstrapping again, sorry (use generated C code) --- lib/system.nim | 3 +++ lib/system/excpt.nim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/system.nim b/lib/system.nim index 363d31578..33e350d7e 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -43,6 +43,7 @@ type stmt* {.magic: Stmt.} ## meta type to denote a statement (for templates) typeDesc* {.magic: TypeDesc.} ## meta type to denote ## a type description (for templates) + void* {.magic: "VoidType".} ## meta type to denote the absense of any type proc defined*[T](x: T): bool {.magic: "Defined", noSideEffect.} ## Special compile-time procedure that checks whether `x` is @@ -649,6 +650,8 @@ template `not_in` * (x, y: expr): expr = not contains(y, x) proc `is` *[T, S](x: T, y: S): bool {.magic: "Is", noSideEffect.} template `is_not` *(x, y: expr): expr = not (x is y) +proc `of` *[T, S](x: T, y: S): bool {.magic: "Of", noSideEffect.} + proc cmp*[T](x, y: T): int {.procvar.} = ## Generic compare proc. Returns a value < 0 iff x < y, a value > 0 iff x > y ## and 0 iff x == y. This is useful for writing generic algorithms without diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 9095c168b..2da768810 100755 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -199,7 +199,7 @@ proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = if excHandler != nil: pushCurrentException(e) c_longjmp(excHandler.context, 1) - elif e[] is EOutOfMemory: + elif e[] of EOutOfMemory: writeToStdErr(ename) quitOrDebug() else: -- cgit 1.4.1-2-gfad0