allow enums to be declared at toplevel scope
authorJeff Wang <jjj11x@gmail.com>
Thu, 16 Jan 2020 20:23:03 +0000 (15:23 -0500)
committerJeff Wang <jeffrey.wang@ll.mit.edu>
Thu, 16 Jan 2020 23:13:14 +0000 (18:13 -0500)
frontends/ast/simplify.cc

index 9013ebe66a31c1b47f902be058c98c9441afa930..2e1b1e40411551fb80b5cf18fe77757d37f18b4d 100644 (file)
@@ -428,6 +428,13 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                        if (node->type == AST_PARAMETER || node->type == AST_LOCALPARAM || node->type == AST_WIRE || node->type == AST_AUTOWIRE || node->type == AST_MEMORY || node->type == AST_TYPEDEF)
                                while (node->simplify(true, false, false, 1, -1, false, node->type == AST_PARAMETER || node->type == AST_LOCALPARAM))
                                        did_something = true;
+                       if (node->type == AST_ENUM) {
+                               for (auto enode : node->children){
+                                       log_assert(enode->type==AST_ENUM_ITEM);
+                                       while (node->simplify(true, false, false, 1, -1, false, node->type == AST_ENUM_ITEM))
+                                               did_something = true;
+                               }
+                       }
                }
        }