diff options
author | Clyybber <darkmine956@gmail.com> | 2021-04-19 17:19:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 17:19:21 +0200 |
commit | 438afb4db93dd9fcc6e94995a56f616a9e3d7826 (patch) | |
tree | 4d2e6a6883ded94201de2252cf290cfd8befed42 /compiler/semobjconstr.nim | |
parent | 6de5aa1971b17b0869470d7cdc886ef230103832 (diff) | |
download | Nim-438afb4db93dd9fcc6e94995a56f616a9e3d7826.tar.gz |
Introduce localErrorNode (#17785)
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r-- | compiler/semobjconstr.nim | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index dea187ea7..63b4b9a75 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -379,8 +379,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = for child in n: result.add child if t == nil: - localError(c.config, n.info, errGenerated, "object constructor needs an object type") - return errorNode(c, result) + return localErrorNode(c, result, errGenerated, "object constructor needs an object type") t = skipTypes(t, {tyGenericInst, tyAlias, tySink, tyOwned}) if t.kind == tyRef: @@ -391,8 +390,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = # multiple times as long as they don't have closures. result.typ.flags.incl tfHasOwned if t.kind != tyObject: - localError(c.config, n.info, errGenerated, "object constructor needs an object type") - return errorNode(c, result) + return localErrorNode(c, result, errGenerated, "object constructor needs an object type") # Check if the object is fully initialized by recursively testing each # field (if this is a case object, initialized fields in two different |