diff options
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 3d2ba2568..d236687c3 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1907,12 +1907,11 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = var ids = initIntSet() for i in 1.. <n.len: let it = n.sons[i] - if it.kind != nkExprColonExpr or it.sons[0].kind notin {nkSym, nkIdent}: + if it.kind != nkExprColonExpr: localError(n.info, errNamedExprExpected) break - var id: PIdent - if it.sons[0].kind == nkIdent: id = it.sons[0].ident - else: id = it.sons[0].sym.name + let id = considerQuotedIdent(it.sons[0]) + if containsOrIncl(ids, id.id): localError(it.info, errFieldInitTwice, id.s) var e = semExprWithType(c, it.sons[1], flags*{efAllowDestructor}) |