mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
Revert localErrorNode param order changes (#17809)
* Revert localErrorNode param order changes * Remove unused globalError overload * heh
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
@@ -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) =
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user