This repository was archived by the owner on Dec 12, 2024. It is now read-only.
first swath of naming utility refactoring. #837
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Naming of various things in BTfS is spread all over the place. I'm trying to centralize it so it's easier to refactor.
This is step 1 of n - and in this case I've created a new class for creating unique names which also includes the ability to abide by scoping. This code is not used...yet. The general approach for this is to use a stack of hash sets. When you enter a new scope the top-most hashset is used to populate the new scope. Here's the thinking on that: The contents of the hash sets will be relatively small: on the order of 10 items (ie, no fewer than 1 and no more than 100, but typically 6-8). Scopes will typically be exited and entered on function boundaries and I don't anticipate having to create new ones for control structures as these tend to nest very linearly. Checking for existing symbols should be cheaper than it was before and since that is the most common operation, I felt this was better than walking the stack of scopes, but PRs are welcome if you disagree.
The general philosophy here is to use static methods when things are stateless and classes when things require state.
I've also moved
SanitizeIdentifier
and related code fromTypeMapper
andCleanseOperatorName
fromMethodWrapping
and put them intoCSSafeNaming
.