Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added is present check to traversals #1401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

npochhi
Copy link
Contributor

@npochhi npochhi commented Feb 15, 2018

Relevant: #1386 cc @isuruf

@isuruf
Copy link
Member

isuruf commented Feb 15, 2018

This can't be done generally. FreeSymbolsVisitor is the only one that can ignore the subtree. For example SubsVisitor you need to store the value for the subtree, so a uset_basic is not enough

@npochhi
Copy link
Contributor Author

npochhi commented Feb 15, 2018

Okay, understood. So, I'll have to use unordered_set<pair<RCP<Basic> (node), RCP<basic> (result of subtree)> > during preorder and postorder traversals.

@npochhi
Copy link
Contributor Author

npochhi commented Feb 16, 2018

@isuruf Will the above mentioned data structure be sufficient for this purpose?

@isuruf
Copy link
Member

isuruf commented Feb 16, 2018

It will be for SubsVisitor, but not for other visitors.

@npochhi
Copy link
Contributor Author

npochhi commented Feb 16, 2018

Can you please suggest me an approach regarding other Visitors?

@isuruf
Copy link
Member

isuruf commented Feb 16, 2018

It depends on the visitor. You'll need to fix them one by one.

@@ -88,7 +98,7 @@ class FreeSymbolsVisitor : public BaseVisitor<FreeSymbolsVisitor>
}
s.insert(set_.begin(), set_.end());
for (const auto &p : x.get_point()) {
auto iter = v.insert(p->rcp_from_this());
auto iter = has_visited.insert(p->rcp_from_this());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't it should be v.has_visited.insert(p->rcp_from_this());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants