diff options
author | Araq <rumpf_a@web.de> | 2012-09-17 17:01:34 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-17 17:01:34 +0200 |
commit | c934db86adec7437e1a9b5db93864f5ff5287eed (patch) | |
tree | 192da723255f51b151a3e1bc6423e5271df0469b /lib | |
parent | 75abf7250325d90a74189ea7e4852d36c3fdd67c (diff) | |
download | Nim-c934db86adec7437e1a9b5db93864f5ff5287eed.tar.gz |
stricter symbol lookup in generics
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/nimprof.nim | 2 | ||||
-rwxr-xr-x | lib/system.nim | 6 | ||||
-rwxr-xr-x | lib/system/assign.nim | 2 | ||||
-rwxr-xr-x | lib/system/profiler.nim | 5 |
4 files changed, 7 insertions, 8 deletions
diff --git a/lib/pure/nimprof.nim b/lib/pure/nimprof.nim index 8cf6ba683..7a907d2ca 100644 --- a/lib/pure/nimprof.nim +++ b/lib/pure/nimprof.nim @@ -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. diff --git a/lib/system.nim b/lib/system.nim index e56a7916e..a60433e57 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -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) diff --git a/lib/system/assign.nim b/lib/system/assign.nim index a6c274250..895a7f9fd 100755 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -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]) diff --git a/lib/system/profiler.nim b/lib/system/profiler.nim index 28edeff7a..eafa010ef 100755 --- a/lib/system/profiler.nim +++ b/lib/system/profiler.nim @@ -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.} |