refactoring: removed empty withBracketExpr template (#18152)
This commit is contained in:
parent
f10eef29b5
commit
6768f507fb
2 changed files with 6 additions and 14 deletions
|
|
@ -303,8 +303,7 @@ proc semGenericStmt(c: PContext, n: PNode,
|
|||
result = newNodeI(nkCall, n.info)
|
||||
result.add newIdentNode(getIdent(c.cache, "[]"), n.info)
|
||||
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:
|
||||
checkSonsLen(n, 2, c.config)
|
||||
let a = n[0]
|
||||
|
|
@ -323,8 +322,7 @@ proc semGenericStmt(c: PContext, n: PNode,
|
|||
result.add newIdentNode(getIdent(c.cache, "[]="), n.info)
|
||||
for i in 0..<a.len: result.add(a[i])
|
||||
result.add(b)
|
||||
withBracketExpr ctx, a[0]:
|
||||
result = semGenericStmt(c, result, flags, ctx)
|
||||
result = semGenericStmt(c, result, flags, ctx)
|
||||
else:
|
||||
for i in 0..<n.len:
|
||||
result[i] = semGenericStmt(c, n[i], flags, ctx)
|
||||
|
|
|
|||
|
|
@ -131,9 +131,6 @@ type
|
|||
noGenSym: int
|
||||
inTemplateHeader: int
|
||||
|
||||
template withBracketExpr(ctx, x, body: untyped) =
|
||||
body
|
||||
|
||||
proc getIdentNode(c: var TemplCtx, n: PNode): PNode =
|
||||
case n.kind
|
||||
of nkPostfix: result = getIdentNode(c, n[1])
|
||||
|
|
@ -491,9 +488,7 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
|
|||
result = newNodeI(nkCall, n.info)
|
||||
result.add newIdentNode(getIdent(c.c.cache, "[]"), n.info)
|
||||
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:
|
||||
result = newNodeI(nkCall, n.info)
|
||||
result.add newIdentNode(getIdent(c.c.cache, "{}"), n.info)
|
||||
|
|
@ -512,8 +507,7 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
|
|||
for i in 0..<a.len: result.add(a[i])
|
||||
result.add(b)
|
||||
let a0 = semTemplBody(c, a[0])
|
||||
withBracketExpr c, a0:
|
||||
result = semTemplBodySons(c, result)
|
||||
result = semTemplBodySons(c, result)
|
||||
of nkCurlyExpr:
|
||||
result = newNodeI(nkCall, n.info)
|
||||
result.add newIdentNode(getIdent(c.c.cache, "{}="), n.info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue