mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Merge pull request #1880 from jjj11x/duplicate_enum
duplicated enum item names should result in an error
This commit is contained in:
		
						commit
						0e1beb6f30
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -420,9 +420,10 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 | 
				
			||||||
				current_scope[node->str] = node;
 | 
									current_scope[node->str] = node;
 | 
				
			||||||
				for (auto enode : node->children) {
 | 
									for (auto enode : node->children) {
 | 
				
			||||||
					log_assert(enode->type==AST_ENUM_ITEM);
 | 
										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;
 | 
											current_scope[enode->str] = enode;
 | 
				
			||||||
					}
 | 
										else
 | 
				
			||||||
 | 
											log_file_error(filename, location.first_line, "enum item %s already exists\n", enode->str.c_str());
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue