diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2019-01-07 20:32:47 +0530 |
---|---|---|
committer | Arne Döring <arne.doering@gmx.net> | 2019-01-07 16:02:47 +0100 |
commit | 387831d657bcbd130b7e739e4d58f7ccc29adae9 (patch) | |
tree | 654251e82b0cfd371783915cb8eafe9fe3e64651 /compiler | |
parent | 044cef152f6006927a905d69dc527cada8206b0f (diff) | |
download | Nim-387831d657bcbd130b7e739e4d58f7ccc29adae9.tar.gz |
Show error when trying to export individual enum field (#10109)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index f03af3db9..8852cb653 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2335,7 +2335,6 @@ proc semExportExcept(c: PContext, n: PNode): PNode = proc semExport(c: PContext, n: PNode): PNode = result = newNodeI(nkExportStmt, n.info) - for i in 0..<n.len: let a = n.sons[i] var o: TOverloadIter @@ -2354,6 +2353,9 @@ proc semExport(c: PContext, n: PNode): PNode = it = nextIter(ti, s.tab) else: while s != nil: + if s.kind == skEnumField: + localError(c.config, a.info, errGenerated, "cannot export: " & renderTree(a) & + "; enum field cannot be exported individually") if s.kind in ExportableSymKinds+{skModule}: result.add(newSymNode(s, a.info)) strTableAdd(c.module.tab, s) |