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

minor walk tweak #1261

Closed
wants to merge 2 commits into from
Closed

minor walk tweak #1261

wants to merge 2 commits into from

Conversation

VanillaMaster
Copy link
Contributor

core idea was to makevisitors keep their this context, so code below could work

class Crawler {
    importNodes = [];
    ImportDeclaration(node) {
        this.importNodes.push(node);
    }
    
}

const crawler = new Crawler();
walk.simple(ast, crawler);
const { importNodes } = crawler;

alos made base a class instance, so overriding its method is easier

@VanillaMaster VanillaMaster marked this pull request as ready for review November 11, 2023 00:26
@marijnh
Copy link
Member

marijnh commented Nov 11, 2023

I'm okay with the calling style / this part.

We have a non-class-based system for building up walkers in place already, so I don't want to merge the other changes, though.

@marijnh marijnh closed this in 5906be3 Nov 11, 2023
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

2 participants