make proc names consistent (#18626)

* rename `endswith` to `endsWith`

* rename
This commit is contained in:
flywind 2021-08-01 19:52:24 +08:00 • committed by GitHub
commit 2bc07554cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 13 deletions

View file

@ -1700,14 +1700,14 @@ proc semStaticType(c: PContext, childNode: PNode, prev: PType): PType =
result.rawAddSon(base) result.rawAddSon(base)
result.flags.incl tfHasStatic result.flags.incl tfHasStatic
proc semTypeof(c: PContext; n: PNode; prev: PType): PType = proc semTypeOf(c: PContext; n: PNode; prev: PType): PType =
openScope(c) openScope(c)
let t = semExprWithType(c, n, {efInTypeof}) let t = semExprWithType(c, n, {efInTypeof})
closeScope(c) closeScope(c)
fixupTypeOf(c, prev, t) fixupTypeOf(c, prev, t)
result = t.typ result = t.typ
proc semTypeof2(c: PContext; n: PNode; prev: PType): PType = proc semTypeOf2(c: PContext; n: PNode; prev: PType): PType =
openScope(c) openScope(c)
var m = BiggestInt 1 # typeOfIter var m = BiggestInt 1 # typeOfIter
if n.len == 3: if n.len == 3:
@ -1731,7 +1731,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
of nkTypeOfExpr: of nkTypeOfExpr:
# for ``typeof(countup(1,3))``, see ``tests/ttoseq``. # for ``typeof(countup(1,3))``, see ``tests/ttoseq``.
checkSonsLen(n, 1, c.config) checkSonsLen(n, 1, c.config)
result = semTypeof(c, n[0], prev) result = semTypeOf(c, n[0], prev)
if result.kind == tyTypeDesc: result.flags.incl tfExplicit if result.kind == tyTypeDesc: result.flags.incl tfExplicit
of nkPar: of nkPar:
if n.len == 1: result = semTypeNode(c, n[0], prev) if n.len == 1: result = semTypeNode(c, n[0], prev)
@ -1833,9 +1833,9 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
result = semAnyRef(c, n, tyRef, prev) result = semAnyRef(c, n, tyRef, prev)
elif op.id == ord(wType): elif op.id == ord(wType):
checkSonsLen(n, 2, c.config) checkSonsLen(n, 2, c.config)
result = semTypeof(c, n[1], prev) result = semTypeOf(c, n[1], prev)
elif op.s == "typeof" and n[0].kind == nkSym and n[0].sym.magic == mTypeOf: elif op.s == "typeof" and n[0].kind == nkSym and n[0].sym.magic == mTypeOf:
result = semTypeof2(c, n, prev) result = semTypeOf2(c, n, prev)
elif op.s == "owned" and optOwnedRefs notin c.config.globalOptions and n.len == 2: elif op.s == "owned" and optOwnedRefs notin c.config.globalOptions and n.len == 2:
result = semTypeExpr(c, n[1], prev) result = semTypeExpr(c, n[1], prev)
else: else:

View file

@ -40,7 +40,7 @@ proc readMessages(client: AsyncFD) {.async.} =
clientCount.inc clientCount.inc
break break
else: else:
if line.startswith("Message "): if line.startsWith("Message "):
msgCount.inc msgCount.inc
else: else:
doAssert false doAssert false

View file

@ -34,7 +34,7 @@ proc readMessages(client: AsyncFD) {.async.} =
clientCount.inc clientCount.inc
break break
else: else:
if line.startswith("Message "): if line.startsWith("Message "):
msgCount.inc msgCount.inc
else: else:
doAssert false doAssert false

View file

@ -59,7 +59,7 @@ proc readMessages(server: AsyncSocket) {.async.} =
while i < maxResponses: while i < maxResponses:
let (data, fromIp, fromPort) = await recvFrom(server, 16384) let (data, fromIp, fromPort) = await recvFrom(server, 16384)
if data.startswith("Message ") and fromIp == "127.0.0.1": if data.startsWith("Message ") and fromIp == "127.0.0.1":
await sendTo(server, fromIp, fromPort, data) await sendTo(server, fromIp, fromPort, data)
inc(msgCount) inc(msgCount)

View file

@ -36,7 +36,7 @@ when defined(ssl):
inc(clientCount) inc(clientCount)
break break
else: else:
if line.startswith("Message "): if line.startsWith("Message "):
inc(msgCount) inc(msgCount)
else: else:
doAssert false doAssert false

View file

@ -81,7 +81,7 @@ proc readMessages(server: AsyncFD) {.async.} =
addr(slen)) addr(slen))
size = 0 size = 0
var grammString = $cstring(addr buffer) var grammString = $cstring(addr buffer)
if grammString.startswith("Message ") and if grammString.startsWith("Message ") and
saddr.sin_addr.s_addr == nativesockets.ntohl(INADDR_LOOPBACK.uint32): saddr.sin_addr.s_addr == nativesockets.ntohl(INADDR_LOOPBACK.uint32):
await sendTo(server, addr grammString[0], len(grammString), await sendTo(server, addr grammString[0], len(grammString),
cast[ptr SockAddr](addr saddr), slen) cast[ptr SockAddr](addr saddr), slen)

View file

@ -220,7 +220,7 @@ when defined(windows):
clientCount.inc clientCount.inc
break break
else: else:
if line.startswith("Message "): if line.startsWith("Message "):
msgCount.inc msgCount.inc
else: else:
doAssert false doAssert false

View file

@ -17,7 +17,7 @@ proc cloneUrl*(url, dest: string; cloneUsingHttps: bool): string =
# github + https + trailing url slash causes a # github + https + trailing url slash causes a
# checkout/ls-remote to fail with Repository not found # checkout/ls-remote to fail with Repository not found
var isGithub = false var isGithub = false
if modUrl.contains("github.com") and modUrl.endswith("/"): if modUrl.contains("github.com") and modUrl.endsWith("/"):
modUrl = modUrl[0 .. ^2] modUrl = modUrl[0 .. ^2]
isGithub = true isGithub = true

View file

@ -31,7 +31,7 @@ proc processIncludes(dir: string, whitelist: StringTableRef) =
if ('.' notin name and "include" in path) or ("c++" in path): if ('.' notin name and "include" in path) or ("c++" in path):
let n = whitelist.getOrDefault(name) let n = whitelist.getOrDefault(name)
if n != "processed": whitelist[name] = "found" if n != "processed": whitelist[name] = "found"
if name.endswith(".h"): if name.endsWith(".h"):
let n = whitelist.getOrDefault(name) let n = whitelist.getOrDefault(name)
if n == "found": includes(path, name, whitelist) if n == "found": includes(path, name, whitelist)
of pcDir: processIncludes(path, whitelist) of pcDir: processIncludes(path, whitelist)