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

@ -501,18 +501,14 @@ proc errorNode*(c: PContext, n: PNode): PNode =
result = newNodeI(nkEmpty, n.info)
result.typ = errorType(c)
proc localErrorNode*(c: PContext, n: PNode, info: TLineInfo, msg: TMsgKind, arg: string): PNode =
localError(c.config, info, msg, arg)
result = errorNode(c, n)
template localErrorNode*(c: PContext, n: PNode, arg: string, info: TLineInfo, kind: TMsgKind = errGenerated): PNode =
liMessage(c.config, info, kind, arg, doNothing, instLoc())
errorNode(c, n)
proc localErrorNode*(c: PContext, n: PNode, info: TLineInfo, arg: string): PNode =
localErrorNode(c, n, info, errGenerated, arg)
proc localErrorNode*(c: PContext, n: PNode, msg: TMsgKind, arg: string): PNode =
localErrorNode(c, n, n.info, msg, arg)
proc localErrorNode*(c: PContext, n: PNode, arg: string): PNode =
localErrorNode(c, n, n.info, errGenerated, arg)
template localErrorNode*(c: PContext, n: PNode, arg: string, kind: TMsgKind = errGenerated): PNode =
let n2 = n
liMessage(c.config, n2.info, kind, arg, doNothing, instLoc())
errorNode(c, n2)
proc fillTypeS*(dest: PType, kind: TTypeKind, c: PContext) =
dest.kind = kind