Repository navigation
refactor(semantics,solve,migrate): call source.StringValue and source.StringText directly - #1494
Merged
Merged
Conversation
….StringText directly Remove the private one-line aliases unquote (solve, semantics, symbolfacts) and stringLiteral (migrate), and fold simpleSymbolName into the exported SimpleSymbolName it forwarded to. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What and why
Four private one-line aliases of the
sourcepackage's string-literal helpers went by the same or similar names in unrelated packages, so a grep forunquotefound three different functions that all did the same thing, and the migrator called the same operation under two names:internal/exec/solve/translate.go:unquote→source.StringValue(one caller)internal/semantic/semantics/filter.go:unquote→source.StringValue(two callers, one inannotations.go)internal/frontend/symbolfacts/attributes.go:unquote→source.StringValue(one caller)internal/translate/migrate/opaque.go:stringLiteral→source.StringText(32 callers beside 6 directsource.StringTextcalls)Every call site now calls
source.StringValue/source.StringTextdirectly and the wrappers are deleted. Infilter.gothe exportedSimpleSymbolNameonly forwarded to an unexportedsimpleSymbolNamewith an identical doc comment; the body now lives inSimpleSymbolNameand the in-package callers (filter.go,annotations.go,reflective_memberships.go) use it. No public interface, error path or output changes; the diff is 52 insertions against 73 deletions, the insertions being thesourceimport in sixmigratefiles.How it was verified
Pure refactor with no behaviour change, so the existing suites are the pin:
Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (no gate count moved)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/55171498f59546278b9d2753fa87c725
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/55171498f59546278b9d2753fa87c725?variant=devin
Requested by: @HuiJun