Revert localErrorNode param order changes (#17809)

* Revert localErrorNode param order changes

* Remove unused globalError overload

* heh
This commit is contained in:
Clyybber
2021-04-21 16:03:30 +02:00
committed by GitHub
parent 7c64e49d45
commit 80389b8053
5 changed files with 20 additions and 13 deletions

View File

@@ -585,9 +585,6 @@ template globalError*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg = "")
template globalError*(conf: ConfigRef; info: TLineInfo, arg: string) =
liMessage(conf, info, errGenerated, arg, doRaise, instLoc())
template globalError*(conf: ConfigRef; format: string, params: openArray[string]) =
liMessage(conf, unknownLineInfo, errGenerated, format % params, doRaise, instLoc())
template localError*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg = "") =
liMessage(conf, info, msg, arg, doNothing, instLoc())

View File

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

View File

@@ -2620,7 +2620,7 @@ proc semTupleConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
# check if either everything or nothing is tyTypeDesc
for i in 1..<tupexp.len:
if isTupleType != (tupexp[i].typ.kind == tyTypeDesc):
return localErrorNode(c, n, "Mixing types and values in tuples is not allowed.", tupexp[i].info)
return localErrorNode(c, n, tupexp[i].info, "Mixing types and values in tuples is not allowed.")
if isTupleType: # expressions as ``(int, string)`` are reinterpret as type expressions
result = n
var typ = semTypeNode(c, n, nil).skipTypes({tyTypeDesc})

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, errStringLiteralExpected, n[1].info)
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:
return localErrorNode(c, n, errConstExprExpected, n[2].info)
return localErrorNode(c, n, n[2].info, errConstExprExpected)
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, errStringOrIdentNodeExpected, info.info)
return localErrorNode(c, n, info.info, errStringOrIdentNodeExpected)
if isMixin < 0 or isMixin > high(TSymChoiceRule).int:
return localErrorNode(c, n, errConstExprExpected, info.info)
return localErrorNode(c, n, info.info, errConstExprExpected)
let id = if n.kind == nkIdent: n
else: newIdentNode(getIdent(c.cache, n.strVal), info.info)

View File

@@ -725,7 +725,7 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode =
if n.len == 3:
if n[0].kind == nkVarTuple:
if n[0].len-1 != iterAfterVarLent.len:
return localErrorNode(c, n, errWrongNumberOfVariables, n[0].info)
return localErrorNode(c, n, n[0].info, errWrongNumberOfVariables)
for i in 0..<n[0].len-1:
var v = symForVar(c, n[0][i])