stricter symbol lookup in generics
This commit is contained in:
parent
75abf72503
commit
c934db86ad
6 changed files with 19 additions and 20 deletions
|
|
@ -48,7 +48,7 @@ var
|
|||
totalCalls = 0
|
||||
|
||||
var
|
||||
interval: TNanos = 1_000_000 - tickCountCorrection # 5ms
|
||||
interval: TNanos = 5_000_000 - tickCountCorrection # 5ms
|
||||
|
||||
proc setSamplingFrequency*(intervalInUs: int) =
|
||||
## set this to change the sampling frequency. Default value is 5ms.
|
||||
|
|
|
|||
|
|
@ -168,9 +168,6 @@ proc `..`*[T](b: T): TSlice[T] {.noSideEffect, inline.} =
|
|||
## `slice`:idx: operator that constructs an interval ``[default(T), b]``
|
||||
result.b = b
|
||||
|
||||
proc contains*[T](s: TSlice[T], value: T): bool {.noSideEffect, inline.} =
|
||||
result = value >= s.a and value <= s.b
|
||||
|
||||
when not defined(niminheritable):
|
||||
{.pragma: inheritable.}
|
||||
|
||||
|
|
@ -672,6 +669,9 @@ proc contains*[T](x: set[T], y: T): bool {.magic: "InSet", noSideEffect.}
|
|||
## is achieved by reversing the parameters for ``contains``; ``in`` then
|
||||
## passes its arguments in reverse order.
|
||||
|
||||
proc contains*[T](s: TSlice[T], value: T): bool {.noSideEffect, inline.} =
|
||||
result = s.a <= value and value <= s.b
|
||||
|
||||
template `in` * (x, y: expr): expr {.immediate.} = contains(y, x)
|
||||
template `not_in` * (x, y: expr): expr {.immediate.} = not contains(y, x)
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,8 @@ proc objectInit(dest: Pointer, typ: PNimType) =
|
|||
|
||||
# ---------------------- assign zero -----------------------------------------
|
||||
|
||||
# dummy declaration; XXX we need 'mixin' here
|
||||
proc destroy(x: int) = nil
|
||||
proc nimDestroyRange*[T](r: T) =
|
||||
# internal proc used for destroying sequences and arrays
|
||||
for i in countup(0, r.len - 1): destroy(r[i])
|
||||
|
|
|
|||
|
|
@ -11,10 +11,7 @@
|
|||
# code generator. The idea is to inject the instruction stream
|
||||
# with 'nimProfile()' calls. These calls are injected at every loop end
|
||||
# (except perhaps loops that have no side-effects). At every Nth call a
|
||||
# stack trace is taken. A stack tace is a list of cstrings. We have a count
|
||||
# table of those.
|
||||
#
|
||||
# The nice thing about this profiler is that it's completely time independent!
|
||||
# stack trace is taken. A stack tace is a list of cstrings.
|
||||
|
||||
{.push profiler: off.}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue