fix hintMsgOrigin regression + simplify msgs code (#17805)

This commit is contained in:
Timothee Cour 2021-04-20 22:00:45 -07:00 • committed by GitHub
commit 8de053d870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 32 deletions

View file

@ -229,12 +229,12 @@ proc semBindSym(c: PContext, n: PNode): PNode =
let sl = semConstExpr(c, n[1])
if sl.kind notin {nkStrLit, nkRStrLit, nkTripleStrLit}:
return localErrorNode(c, n, n[1].info, errStringLiteralExpected)
return localErrorNode(c, n, errStringLiteralExpected, n[1].info)
let isMixin = semConstExpr(c, n[2])
if isMixin.kind != nkIntLit or isMixin.intVal < 0 or
isMixin.intVal > high(TSymChoiceRule).int:
return localErrorNode(c, n, n[2].info, errConstExprExpected)
return localErrorNode(c, n, errConstExprExpected, n[2].info)
let id = newIdentNode(getIdent(c.cache, sl.strVal), n.info)
let s = qualifiedLookUp(c, id, {checkUndeclared})
@ -251,10 +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}:
return localErrorNode(c, n, info.info, errStringOrIdentNodeExpected)
return localErrorNode(c, n, errStringOrIdentNodeExpected, info.info)
if isMixin < 0 or isMixin > high(TSymChoiceRule).int:
return localErrorNode(c, n, info.info, errConstExprExpected)
return localErrorNode(c, n, errConstExprExpected, info.info)
let id = if n.kind == nkIdent: n
else: newIdentNode(getIdent(c.cache, n.strVal), info.info)