implements https://github.com/nim-lang/RFCs/issues/407 (#18793)
This commit is contained in:
parent
c2b20516d3
commit
cddf8ec6f6
9 changed files with 103 additions and 20 deletions
|
|
@ -2223,7 +2223,21 @@ proc semPragmaBlock(c: PContext, n: PNode): PNode =
|
|||
checkSonsLen(n, 2, c.config)
|
||||
let pragmaList = n[0]
|
||||
pragma(c, nil, pragmaList, exprPragmas, isStatement = true)
|
||||
|
||||
var inUncheckedAssignSection = 0
|
||||
for p in pragmaList:
|
||||
if whichPragma(p) == wCast:
|
||||
case whichPragma(p[1])
|
||||
of wGcSafe, wNoSideEffect, wTags, wRaises:
|
||||
discard "handled in sempass2"
|
||||
of wUncheckedAssign:
|
||||
inUncheckedAssignSection = 1
|
||||
else:
|
||||
localError(c.config, p.info, "invalid pragma block: " & $p)
|
||||
|
||||
inc c.inUncheckedAssignSection, inUncheckedAssignSection
|
||||
n[1] = semExpr(c, n[1])
|
||||
dec c.inUncheckedAssignSection, inUncheckedAssignSection
|
||||
result = n
|
||||
result.typ = n[1].typ
|
||||
for i in 0..<pragmaList.len:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue