change system.nim to adhere to the style guide

This commit is contained in:
Araq 2018-10-30 14:59:19 +01:00
commit 05964b95e4
2 changed files with 12 additions and 12 deletions

View file

@ -546,7 +546,7 @@ proc getRecordDesc(m: BModule, typ: PType, name: Rope,
appcg(m, result, "virtual void raise() {throw *this;}$n") # required for polymorphic exceptions appcg(m, result, "virtual void raise() {throw *this;}$n") # required for polymorphic exceptions
if typ.sym.magic == mException: if typ.sym.magic == mException:
# Add cleanup destructor to Exception base class # Add cleanup destructor to Exception base class
appcg(m, result, "~$1() {if(this->raise_id) popCurrentExceptionEx(this->raise_id);}$n", [name]) appcg(m, result, "~$1() {if(this->raiseId) popCurrentExceptionEx(this->raiseId);}$n", [name])
# hack: forward declare popCurrentExceptionEx() on top of type description, # hack: forward declare popCurrentExceptionEx() on top of type description,
# proper request to generate popCurrentExceptionEx not possible for 2 reasons: # proper request to generate popCurrentExceptionEx not possible for 2 reasons:
# generated function will be below declared Exception type and circular dependency # generated function will be below declared Exception type and circular dependency

View file

@ -555,7 +555,7 @@ type
trace: string trace: string
else: else:
trace: seq[StackTraceEntry] trace: seq[StackTraceEntry]
raise_id: uint # set when exception is raised raiseId: uint # set when exception is raised
up: ref Exception # used for stacking exceptions. Not exported! up: ref Exception # used for stacking exceptions. Not exported!
Defect* = object of Exception ## \ Defect* = object of Exception ## \
@ -1318,16 +1318,16 @@ proc new*[T](a: var ref T) {.magic: "New", noSideEffect.}
## creates a new object of type ``T`` and returns a safe (traced) ## creates a new object of type ``T`` and returns a safe (traced)
## reference to it in ``a``. ## reference to it in ``a``.
proc new*(T: typedesc): auto = proc new*(t: typedesc): auto =
## creates a new object of type ``T`` and returns a safe (traced) ## creates a new object of type ``T`` and returns a safe (traced)
## reference to it as result value. ## reference to it as result value.
## ##
## When ``T`` is a ref type then the resulting type will be ``T``, ## When ``T`` is a ref type then the resulting type will be ``T``,
## otherwise it will be ``ref T``. ## otherwise it will be ``ref T``.
when (T is ref): when (t is ref):
var r: T var r: t
else: else:
var r: ref T var r: ref t
new(r) new(r)
return r return r
@ -1813,14 +1813,14 @@ proc toBiggestInt*(f: BiggestFloat): BiggestInt {.
## rounds `f` if it does not contain an integer value. If the conversion ## rounds `f` if it does not contain an integer value. If the conversion
## fails (because `f` is infinite for example), `ValueError` is raised. ## fails (because `f` is infinite for example), `ValueError` is raised.
proc addQuitProc*(QuitProc: proc() {.noconv.}) {. proc addQuitProc*(quitProc: proc() {.noconv.}) {.
importc: "atexit", header: "<stdlib.h>".} importc: "atexit", header: "<stdlib.h>".}
## Adds/registers a quit procedure. ## Adds/registers a quit procedure.
## ##
## Each call to ``addQuitProc`` registers another quit procedure. Up to 30 ## Each call to ``addQuitProc`` registers another quit procedure. Up to 30
## procedures can be registered. They are executed on a last-in, first-out ## procedures can be registered. They are executed on a last-in, first-out
## basis (that is, the last function registered is the first to be executed). ## basis (that is, the last function registered is the first to be executed).
## ``addQuitProc`` raises an EOutOfIndex exception if ``QuitProc`` cannot be ## ``addQuitProc`` raises an EOutOfIndex exception if ``quitProc`` cannot be
## registered. ## registered.
# Support for addQuitProc() is done by Ansi C's facilities here. # Support for addQuitProc() is done by Ansi C's facilities here.
@ -3004,8 +3004,8 @@ else:
{.pop.} {.pop.}
when not defined(JS): when not defined(JS):
proc likely_proc(val: bool): bool {.importc: "likely", nodecl, nosideeffect.} proc likelyProc(val: bool): bool {.importc: "likely", nodecl, nosideeffect.}
proc unlikely_proc(val: bool): bool {.importc: "unlikely", nodecl, nosideeffect.} proc unlikelyProc(val: bool): bool {.importc: "unlikely", nodecl, nosideeffect.}
template likely*(val: bool): bool = template likely*(val: bool): bool =
## Hints the optimizer that `val` is likely going to be true. ## Hints the optimizer that `val` is likely going to be true.
@ -3029,7 +3029,7 @@ template likely*(val: bool): bool =
when defined(JS): when defined(JS):
val val
else: else:
likely_proc(val) likelyProc(val)
template unlikely*(val: bool): bool = template unlikely*(val: bool): bool =
## Hints the optimizer that `val` is likely going to be false. ## Hints the optimizer that `val` is likely going to be false.
@ -3053,7 +3053,7 @@ template unlikely*(val: bool): bool =
when defined(JS): when defined(JS):
val val
else: else:
unlikely_proc(val) unlikelyProc(val)
type type
FileSeekPos* = enum ## Position relative to which seek should happen FileSeekPos* = enum ## Position relative to which seek should happen