Introduce localErrorNode (#17785)

This commit is contained in:
Clyybber 2021-04-19 17:19:21 +02:00 • committed by GitHub
commit 438afb4db9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 24 deletions

View file

@ -1044,8 +1044,7 @@ proc buildEchoStmt(c: PContext, n: PNode): PNode =
if e != nil:
result.add(newSymNode(e))
else:
localError(c.config, n.info, "system needs: echo")
result.add(errorNode(c, n))
result.add localErrorNode(c, n, "system needs: echo")
result.add(n)
result = semExpr(c, result)
@ -2621,8 +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):
localError(c.config, tupexp[i].info, "Mixing types and values in tuples is not allowed.")
return(errorNode(c,n))
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})