Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Using (Block/)ScopeAwareRuleWalker with typed programs #2514

Closed
JoshuaKGoldberg opened this issue Apr 6, 2017 · 4 comments
Closed

Using (Block/)ScopeAwareRuleWalker with typed programs #2514

JoshuaKGoldberg opened this issue Apr 6, 2017 · 4 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

I don't see any examples of creating a ScopeAwareRuleWalker with a typed rule. Is this intended to be doable?

There could be TypedScopeAwareRuleWalker + TypedBlockScopeAwareRuleWalker, but it feels wrong to make a cross-matrix of all the potential rule types against each other.

@ajafff
Copy link
Contributor

ajafff commented Apr 6, 2017 via email

@JoshuaKGoldberg
Copy link
Contributor Author

This is true, but then for the first createScope call it won't have access to the type checker. Overriding a constructor also feels dirty.

@andy-hanson
Copy link
Contributor

andy-hanson commented Apr 8, 2017

These classes should really not be used. In every example I have seen (except for no-duplicate-variable) they were just used to maintain some context, and the actual rule had nothing to do with scopes. It's better to just use ts.forEachChild and use local variables to store context.
See #2348, #2354, #2372, #2339, #2341, #2346, which combined would eliminate our uses of these two classes.

@JoshuaKGoldberg
Copy link
Contributor Author

Should they be deprecated then?

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

No branches or pull requests

3 participants