mirror of
https://github.com/YosysHQ/yosys
synced 2025-05-15 03:34:45 +00:00
ast.h: Move attribute check into set
There are a number of places that check for an existing attribute and delete it before assigning a new node to it. Reduce code duplication by doing it as part of the `set_attribute()` method.
This commit is contained in:
parent
c4af97c1c4
commit
10ea2fa67e
3 changed files with 2 additions and 10 deletions
|
@ -1174,10 +1174,6 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
|
|||
delete ast->attributes.at(ID::lib_whitebox);
|
||||
ast->attributes.erase(ID::lib_whitebox);
|
||||
} else {
|
||||
if (ast->attributes.count(ID::whitebox)) {
|
||||
delete ast->attributes.at(ID::whitebox);
|
||||
ast->attributes.erase(ID::whitebox);
|
||||
}
|
||||
AstNode *n = ast->attributes.at(ID::lib_whitebox);
|
||||
ast->set_attribute(ID::whitebox, n);
|
||||
ast->attributes.erase(ID::lib_whitebox);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue