summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorDaniil Yarancev <TiberiumN@users.noreply.github.com>2017-08-14 18:43:39 +0300
committerAndreas Rumpf <rumpf_a@web.de>2017-08-14 17:43:39 +0200
commit5c7ae1407425d8a595ea8841b669e30e61e29307 (patch)
treee5aed6161f4755369b213d3b83913ef94facd305 /compiler
parentb6360c5d5f19fd1e8c74fda703a465b8e46dbb63 (diff)
downloadNim-5c7ae1407425d8a595ea8841b669e30e61e29307.tar.gz
Fixes #5965 (#6237)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semobjconstr.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim
index f4c225526..b331d05a1 100644
--- a/compiler/semobjconstr.nim
+++ b/compiler/semobjconstr.nim
@@ -44,7 +44,9 @@ proc locateFieldInInitExpr(field: PSym, initExpr: PNode): PNode =
   let fieldId = field.name.id
   for i in 1 .. <initExpr.len:
     let assignment = initExpr[i]
-    internalAssert assignment.kind == nkExprColonExpr
+    if assignment.kind != nkExprColonExpr:
+      localError(initExpr.info, "incorrect object construction syntax")
+      continue
 
     if fieldId == considerQuotedIdent(assignment[0]).id:
       return assignment
@@ -278,6 +280,9 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
   for i in 1.. <result.len:
     let field = result[i]
     if nfSem notin field.flags:
+      if field.kind != nkExprColonExpr:
+        localError(n.info, "incorrect object construction syntax")
+        continue
       let id = considerQuotedIdent(field[0])
       # This node was not processed. There are two possible reasons:
       # 1) It was shadowed by a field with the same name on the left