switch expressions: finale (#148711)
### fixes #136139 <br> <details open> <summary><b>getting sentimental in the PR description</b> (click to collapse)<br><br></summary> The past 7 months have been quite the journeyâI made some huge blunders and some huge accomplishmentsâa very fun time overall. I really appreciate the people who took the time to perform code review for my refactoring shenanigans: **christopherfujino**, **andrewkolos**, **LongCatIsLooong**, **gspencergoog**, **loic-sharma**, **Piinks**, **bernaferrari**, **bartekpacia**, **bleroux**, **kevmoo**, **rakudrama**, **XilaiZhang**, **QuncCccccc**, **MominRaza**, and **victorsanni**. And a huge shoutout to 2 individuals: - @justinmc, for offering to sponsor me for commit access (words could not describe my excitement) - @goderbauer, for being super duper proactive and consistent with code review <br> </details> This pull request makes 13 "switch statements â switch expressions" PRs in total, reducing the LOC in this repo by **1,974**! From now on, I'll make sure to request a test exemption for each refactoring PR ð
This commit is contained in:
@@ -152,21 +152,13 @@ String getNewPrLink({
|
||||
}) {
|
||||
assert(state.releaseChannel.isNotEmpty);
|
||||
assert(state.releaseVersion.isNotEmpty);
|
||||
late final String candidateBranch;
|
||||
late final String workingBranch;
|
||||
late final String repoLabel;
|
||||
switch (repoName) {
|
||||
case 'flutter':
|
||||
candidateBranch = state.framework.candidateBranch;
|
||||
workingBranch = state.framework.workingBranch;
|
||||
repoLabel = 'Framework';
|
||||
case 'engine':
|
||||
candidateBranch = state.engine.candidateBranch;
|
||||
workingBranch = state.engine.workingBranch;
|
||||
repoLabel = 'Engine';
|
||||
default:
|
||||
throw ConductorException('Expected repoName to be one of flutter or engine but got $repoName.');
|
||||
}
|
||||
final (pb.Repository repository, String repoLabel) = switch (repoName) {
|
||||
'flutter' => (state.framework, 'Framework'),
|
||||
'engine' => (state.engine, 'Engine'),
|
||||
_ => throw ConductorException('Expected repoName to be one of flutter or engine but got $repoName.'),
|
||||
};
|
||||
final String candidateBranch = repository.candidateBranch;
|
||||
final String workingBranch = repository.workingBranch;
|
||||
assert(candidateBranch.isNotEmpty);
|
||||
assert(workingBranch.isNotEmpty);
|
||||
final String title = '[flutter_releases] Flutter ${state.releaseChannel} '
|
||||
|
||||
Reference in New Issue
Block a user