We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I assume nimlsp (0.4.0) crashes because of nimsuggest (1.6.6) (or so i am told) If you comment the "OFFENDING LINE" it should stop crashing 1:
var out:
2:
jobs[] = init[int, pointer]()
3:
{.experimental: "caseStmtMacros".} let capts = (page: "",) case capts: of (page: ""): discard else: discard
4:
import httpcore, fusion/matching, guildenstern/[ctxheader, ctxbody] {.experimental: "caseStmtMacros".} template handleSearch(relpath: string, ctx: HttpCtx) = var headers: array[1, string] ctx.parseHeaders(["abc"], headers) # OFFENDING LINE proc handleGet(ctx: HttpCtx) {.gcsafe, raises: [].} = doassert ctx.parseRequestLine var relpath = ctx.getUri() page: string try: let capts = (page: "") case capts: of (page: "s"): handleSearch(relpath, ctx) else: discard except: try: let msg = getCurrentExceptionMsg() except: ctx.reply(Http501) discard discard when isMainModule: var server = new GuildenServer server.initHeaderCtx(handleGet, 5050, false) echo "GuildenStern HTTP server serving at 5050" server.serve(loglevel = INFO)
5:
import tables, locks export tables, locks proc put*[T, K, V](t: T, k: K, v: V): V = (t[k] = v; v) type PathLock* = Table[string, Lock] var locksBuffer*: seq[ref Lock] proc get*(b: var seq[ref Lock]): ref Lock = try: return b.pop() except: discard proc acquireOrWait*(pl: PathLock, k: string): bool = try: withLock(pl[k][]): discard result = false except KeyError: pl.put(k, locksBuffer.get)[].acquire() # OFFENDING LINE result = true
6:
import macros, locks template lockedStore*(name: untyped): untyped {.dirty.} = type `Lock name Obj`[K, V] = object lock: Lock storage {.guard: lock.}: name[K, V] `Lock name`*[K, V] = ptr `Lock name Obj`[K, V] proc `lock name Impl`*[K, V](store: name[K, V]): `Lock name`[K, V] = result = createShared(`Lock name Obj`[K, V]) initLock(result.lock) withLock(result.lock): result.storage = store template `init Lock name`*[K, V](args: varargs[untyped]): `Lock name`[K, V] = var store: name[K, V] store = when compiles(`init name`): when varargsLen(args) > 0: `init name`[K, V](args) else: `init name`[K, V]() elif compiles(`new name`): when varargsLen(args) > 0: `new name`[K, V](args) else: `new name`[K, V]() else: `name`[K, V]() `lock name Impl`[K, V](store) proc `[]=`*[K, V](tbl: `Lock name`[K, V], k: K, v: V) = withLock(tbl.lock): tbl.storage[k] = v when isMainModule: import tables lockedStore(Table) let x = initLockTable[string, string](100) x["a"] = "123" # OFFENDING LINE
7:
when is echo s
8:
template abc[T](s, keys: string): auto = var r: # OFFENDING LINE (also `var r = `) abc[T](s, r)
9:
import httpcore, tables, guildenstern/[ctxheader, ctxbody], uri var pageCache = initTable[string, string]() proc fetch(): string = "abc" template lgetOrPut*[T, K](c: T, k: K, v: untyped): untyped = ## Lazy `mgetOrPut` try: c.get(k) except KeyError: c.put(k, v) template handlePath(relpath: string, ctx: HttpCtx) = page = pageCache.lgetOrPut(reqFile): fetch.c # OFFENDING LINE, if it doesn't crash, delete and type ".c" again proc handleGet(ctx: HttpCtx) {.gcsafe, raises: [].} = doassert ctx.parseRequestLine var relpath = ctx.getUri() page: string headers: seq[string]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I assume nimlsp (0.4.0) crashes because of nimsuggest (1.6.6) (or so i am told)
If you comment the "OFFENDING LINE" it should stop crashing
1:
2:
3:
4:
5:
6:
7:
8:
9:
The text was updated successfully, but these errors were encountered: