Introduce localErrorNode (#17785)
This commit is contained in:
parent
6de5aa1971
commit
438afb4db9
7 changed files with 27 additions and 24 deletions
|
|
@ -229,14 +229,12 @@ proc semBindSym(c: PContext, n: PNode): PNode =
|
|||
|
||||
let sl = semConstExpr(c, n[1])
|
||||
if sl.kind notin {nkStrLit, nkRStrLit, nkTripleStrLit}:
|
||||
localError(c.config, n[1].info, errStringLiteralExpected)
|
||||
return errorNode(c, n)
|
||||
return localErrorNode(c, n, n[1].info, errStringLiteralExpected)
|
||||
|
||||
let isMixin = semConstExpr(c, n[2])
|
||||
if isMixin.kind != nkIntLit or isMixin.intVal < 0 or
|
||||
isMixin.intVal > high(TSymChoiceRule).int:
|
||||
localError(c.config, n[2].info, errConstExprExpected)
|
||||
return errorNode(c, n)
|
||||
return localErrorNode(c, n, n[2].info, errConstExprExpected)
|
||||
|
||||
let id = newIdentNode(getIdent(c.cache, sl.strVal), n.info)
|
||||
let s = qualifiedLookUp(c, id, {checkUndeclared})
|
||||
|
|
@ -253,12 +251,10 @@ proc semBindSym(c: PContext, n: PNode): PNode =
|
|||
|
||||
proc opBindSym(c: PContext, scope: PScope, n: PNode, isMixin: int, info: PNode): PNode =
|
||||
if n.kind notin {nkStrLit, nkRStrLit, nkTripleStrLit, nkIdent}:
|
||||
localError(c.config, info.info, errStringOrIdentNodeExpected)
|
||||
return errorNode(c, n)
|
||||
return localErrorNode(c, n, info.info, errStringOrIdentNodeExpected)
|
||||
|
||||
if isMixin < 0 or isMixin > high(TSymChoiceRule).int:
|
||||
localError(c.config, info.info, errConstExprExpected)
|
||||
return errorNode(c, n)
|
||||
return localErrorNode(c, n, info.info, errConstExprExpected)
|
||||
|
||||
let id = if n.kind == nkIdent: n
|
||||
else: newIdentNode(getIdent(c.cache, n.strVal), info.info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue