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

filter nodes #3

Open
knsh14 opened this issue Aug 5, 2019 · 2 comments
Open

filter nodes #3

knsh14 opened this issue Aug 5, 2019 · 2 comments

Comments

@knsh14
Copy link
Owner

knsh14 commented Aug 5, 2019

some people want to ignore some node.
I think some refactor step to achieve.

1st step

change tree function.
use switch statement to call specific func to using map to get specific func.
before

switch n.(type) {
  case *ast....
}

after

f := functions[fmt.Sprintf("%T", node)]
f(w, ....)

2nd step

create empty function to pass node.

3rd step

set pass function to map when ignore node is given.

@knsh14
Copy link
Owner Author

knsh14 commented Aug 5, 2019

need to add Ignore option to astree.Tree func. then generate map with option and execute internal tree func.

@knsh14
Copy link
Owner Author

knsh14 commented Aug 9, 2019

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

No branches or pull requests

1 participant