diff options
author | clairexen <claire@symbioticeda.com> | 2020-09-01 17:30:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 17:30:09 +0200 |
commit | 3e1840d0365666e8cae3f61ff0e0364809ce56f3 (patch) | |
tree | dce7c28119a3c68627dbac21c76cc5fbc5ef5f67 /frontends | |
parent | 452442ac2fcdec92a98a5a0896b2b3866db9e5e9 (diff) | |
parent | 6127f227880af506d806179ac622aba44c35fd4b (diff) | |
download | yosys-3e1840d0365666e8cae3f61ff0e0364809ce56f3.tar.gz yosys-3e1840d0365666e8cae3f61ff0e0364809ce56f3.tar.bz2 yosys-3e1840d0365666e8cae3f61ff0e0364809ce56f3.zip |
Merge pull request #2353 from zachjs/top-scope
Module name scope support
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/simplify.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 2a5ad99c8..f4feed347 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1597,6 +1597,13 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, if (type == AST_IDENTIFIER) { if (current_scope.count(str) == 0) { AstNode *current_scope_ast = (current_ast_mod == nullptr) ? current_ast : current_ast_mod; + const std::string& mod_scope = current_scope_ast->str; + if (str[0] == '\\' && str.substr(0, mod_scope.size()) == mod_scope) { + std::string new_str = "\\" + str.substr(mod_scope.size() + 1); + if (current_scope.count(new_str)) { + str = new_str; + } + } for (auto node : current_scope_ast->children) { //log("looking at mod scope child %s\n", type2str(node->type).c_str()); switch (node->type) { |