aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorJeff Wang <jjj11x@gmail.com>2020-04-07 02:30:11 -0400
committerJeff Wang <jeffrey.wang@ll.mit.edu>2020-04-07 02:30:11 -0400
commitdbfd6b75305f6006a0c1e1d150c291875e5451d5 (patch)
tree4c19bfd66a9c175031ad1a17a713394878b5d52d /frontends/ast
parentebf23cd62e7617ef2510a5bdc7e66ac5f82b7991 (diff)
downloadyosys-dbfd6b75305f6006a0c1e1d150c291875e5451d5.tar.gz
yosys-dbfd6b75305f6006a0c1e1d150c291875e5451d5.tar.bz2
yosys-dbfd6b75305f6006a0c1e1d150c291875e5451d5.zip
duplicated enum item names should result in an error
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/simplify.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index b87af0f8c..3fde26fab 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -420,9 +420,10 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
current_scope[node->str] = node;
for (auto enode : node->children) {
log_assert(enode->type==AST_ENUM_ITEM);
- if (current_scope.count(enode->str) == 0) {
+ if (current_scope.count(enode->str) == 0)
current_scope[enode->str] = enode;
- }
+ else
+ log_file_error(filename, location.first_line, "enum item %s already exists\n", enode->str.c_str());
}
}
}