You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All fields of SymbolTable are pub. Because of this, we can't make refactors without breaking our API and possibly even downstream code. Note that members of ScopeTree and Semantic are not externally visible.
Many mutable methods are pub. The transformer and oxc_traverse need some of these, but I doubt they need all of them
Proposed Solutions
For point one, we should make all fields of SymbolTablepub(crate). This will require a refactor in oxc_transform and oxc_traverse to use existing read methods. It is also a breaking change in the semver-major sense.
For point two, I see two possible approaches. The hiccup is that traverse/transform need mutable access to symbols and scopes.
1. Make mut methods not used in traverse/transform pub(crate)
Simple API reduction. This is likely the easiest, and wouldn't require changes to other crates in the monorepo. It also provides the least benefit.
2. Move oxc_traverse into oxc_semantic
Moving traversal code into oxc_semantic would let us make all &mut methods on semantic objects pub(crate). Our consumer-facing/external API for mutating these objects could then only be impls on Traverse. This is, however, a much larger refactor and may not be worth it.
Thoughts?
The text was updated successfully, but these errors were encountered:
Don and I discussed on a call yesterday. I absolutely agree that SymbolTable's fields should not be pub. We need the ability to change the underlying implementation of Semantic without it being a breaking change to public APIs.
However, we agreed that we should do a wider revamp of Semantic along the lines of #6077 rather than piecemeal changes, to reduce churn for external consumers.
@DonIsaac If #6077 is a fair representation of our discussion yesterday, would it make sense to close this issue in favour of that one?
Problems
SymbolTable
arepub
. Because of this, we can't make refactors without breaking our API and possibly even downstream code. Note that members ofScopeTree
andSemantic
are not externally visible.pub
. The transformer andoxc_traverse
need some of these, but I doubt they need all of themProposed Solutions
For point one, we should make all fields of
SymbolTable
pub(crate)
. This will require a refactor inoxc_transform
andoxc_traverse
to use existing read methods. It is also a breaking change in the semver-major sense.For point two, I see two possible approaches. The hiccup is that traverse/transform need mutable access to symbols and scopes.
1. Make
mut
methods not used in traverse/transformpub(crate)
Simple API reduction. This is likely the easiest, and wouldn't require changes to other crates in the monorepo. It also provides the least benefit.
2. Move
oxc_traverse
intooxc_semantic
Moving traversal code into
oxc_semantic
would let us make all&mut
methods on semantic objectspub(crate)
. Our consumer-facing/external API for mutating these objects could then only be impls onTraverse
. This is, however, a much larger refactor and may not be worth it.Thoughts?
The text was updated successfully, but these errors were encountered: