refactoring: removed empty withBracketExpr template (#18152)

This commit is contained in:
Andreas Rumpf 2021-06-02 13:14:10 +02:00 • committed by GitHub
commit 6768f507fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 14 deletions

View file

@ -303,7 +303,6 @@ proc semGenericStmt(c: PContext, n: PNode,
result = newNodeI(nkCall, n.info) result = newNodeI(nkCall, n.info)
result.add newIdentNode(getIdent(c.cache, "[]"), n.info) result.add newIdentNode(getIdent(c.cache, "[]"), n.info)
for i in 0..<n.len: result.add(n[i]) for i in 0..<n.len: result.add(n[i])
withBracketExpr ctx, n[0]:
result = semGenericStmt(c, result, flags, ctx) result = semGenericStmt(c, result, flags, ctx)
of nkAsgn, nkFastAsgn: of nkAsgn, nkFastAsgn:
checkSonsLen(n, 2, c.config) checkSonsLen(n, 2, c.config)
@ -323,7 +322,6 @@ proc semGenericStmt(c: PContext, n: PNode,
result.add newIdentNode(getIdent(c.cache, "[]="), n.info) result.add newIdentNode(getIdent(c.cache, "[]="), n.info)
for i in 0..<a.len: result.add(a[i]) for i in 0..<a.len: result.add(a[i])
result.add(b) result.add(b)
withBracketExpr ctx, a[0]:
result = semGenericStmt(c, result, flags, ctx) result = semGenericStmt(c, result, flags, ctx)
else: else:
for i in 0..<n.len: for i in 0..<n.len:

View file

@ -131,9 +131,6 @@ type
noGenSym: int noGenSym: int
inTemplateHeader: int inTemplateHeader: int
template withBracketExpr(ctx, x, body: untyped) =
body
proc getIdentNode(c: var TemplCtx, n: PNode): PNode = proc getIdentNode(c: var TemplCtx, n: PNode): PNode =
case n.kind case n.kind
of nkPostfix: result = getIdentNode(c, n[1]) of nkPostfix: result = getIdentNode(c, n[1])
@ -491,8 +488,6 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
result = newNodeI(nkCall, n.info) result = newNodeI(nkCall, n.info)
result.add newIdentNode(getIdent(c.c.cache, "[]"), n.info) result.add newIdentNode(getIdent(c.c.cache, "[]"), n.info)
for i in 0..<n.len: result.add(n[i]) for i in 0..<n.len: result.add(n[i])
let n0 = semTemplBody(c, n[0])
withBracketExpr c, n0:
result = semTemplBodySons(c, result) result = semTemplBodySons(c, result)
of nkCurlyExpr: of nkCurlyExpr:
result = newNodeI(nkCall, n.info) result = newNodeI(nkCall, n.info)
@ -512,7 +507,6 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
for i in 0..<a.len: result.add(a[i]) for i in 0..<a.len: result.add(a[i])
result.add(b) result.add(b)
let a0 = semTemplBody(c, a[0]) let a0 = semTemplBody(c, a[0])
withBracketExpr c, a0:
result = semTemplBodySons(c, result) result = semTemplBodySons(c, result)
of nkCurlyExpr: of nkCurlyExpr:
result = newNodeI(nkCall, n.info) result = newNodeI(nkCall, n.info)