mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-25 00:35:26 +00:00
fixes #1638
This commit is contained in:
@@ -10,15 +10,15 @@ type
|
||||
events*: Table[string, DoublyLinkedList[proc(e: EventArgs) {.nimcall.}]]
|
||||
|
||||
proc emit*(emitter: EventEmitter, event: string, args: EventArgs) =
|
||||
for func in nodes(emitter.events[event]):
|
||||
func.value(args) #call function with args.
|
||||
for fn in nodes(emitter.events[event]):
|
||||
fn.value(args) #call function with args.
|
||||
|
||||
proc on*(emitter: var EventEmitter, event: string,
|
||||
func: proc(e: EventArgs) {.nimcall.}) =
|
||||
fn: proc(e: EventArgs) {.nimcall.}) =
|
||||
if not hasKey(emitter.events, event):
|
||||
var list: DoublyLinkedList[proc(e: EventArgs) {.nimcall.}]
|
||||
add(emitter.events, event, list) #if not, add it.
|
||||
append(emitter.events.mget(event), func)
|
||||
append(emitter.events.mget(event), fn)
|
||||
|
||||
proc initEmitter(emitter: var EventEmitter) =
|
||||
emitter.events = initTable[string,
|
||||
|
||||
12
tests/misc/tunsigned64mod.nim
Normal file
12
tests/misc/tunsigned64mod.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
# bug #1638
|
||||
|
||||
import unsigned
|
||||
|
||||
let v1 = 7
|
||||
let v2 = 7'u64
|
||||
|
||||
let t1 = v1 mod 2 # works
|
||||
let t2 = 7'u64 mod 2'u64 # works
|
||||
let t3 = v2 mod 2'u64 # Error: invalid type: 'range 0..1(uint64)
|
||||
let t4 = (v2 mod 2'u64).uint64 # works
|
||||
@@ -312,7 +312,7 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
const AdditionalCategories = ["debugger", "examples", "stdlib", "babel-core"]
|
||||
const AdditionalCategories = ["debugger", "examples", "lib", "babel-core"]
|
||||
|
||||
proc `&.?`(a, b: string): string =
|
||||
# candidate for the stdlib?
|
||||
@@ -342,7 +342,7 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
|
||||
threadTests r, cat, options & " --threads:on"
|
||||
of "io":
|
||||
ioTests r, cat, options
|
||||
of "stdlib":
|
||||
of "lib":
|
||||
testStdlib(r, "lib/pure/*.nim", options, cat)
|
||||
testStdlib(r, "lib/packages/docutils/highlite", options, cat)
|
||||
of "examples":
|
||||
|
||||
Reference in New Issue
Block a user