message: Refactor getTargetArchitecture to remove guards
diff: @@ -101,12 +101,15 @@ export class CoreClrDebugUtil {
  const MINIMUM_SUPPORTED_OSX_ARM64_DOTNET_CLI: string = '6.0.0';
  -export function getTargetArchitecture(platformInfo: PlatformInformation, launchJsonTargetArchitecture: string, dotnetInfo: DotnetInfo): string {
  - let targetArchitecture = "";
  +export function getTargetArchitecture(platformInfo: PlatformInformation, launchJsonTargetArchitecture: string | undefined, dotnetInfo: DotnetInfo): string {
  + if (!platformInfo.isMacOS())
  + {
  + // Nothing to do here.
  + return '';
  + }
  // On Apple M1 Machines, we need to determine if we need to use the 'x86_64' or 'arm64' debugger.
  - if (platformInfo.isMacOS())
  - {
  +
  // 'targetArchitecture' is specified in launch.json configuration, use that.
  if (launchJsonTargetArchitecture)
  {
  @@ -114,39 +117,24 @@ export function getTargetArchitecture(platformInfo: PlatformInformation, launchJ
  {
  throw new Error(`The value '${launchJsonTargetArchitecture}' for 'targetArchitecture' in launch configuraiton is invalid. Expected 'x86_64' or 'arm64'.`);
  }
  - targetArchitecture = launchJsonTargetArchitecture;
  + return launchJsonTargetArchitecture;
  }
  - else if (dotnetInfo)
  - {
  - // Find which targetArchitecture to use based on SDK Version or RID.
  - // If we are lower than .NET 6, use 'x86_64' since 'arm64' was not supported until .NET 6
  - if (dotnetInfo.Version && semver.lt(dotnetInfo.Version, MINIMUM_SUPPORTED_OSX_ARM64_DOTNET_CLI))
  + // If we are lower than .NET 6, use 'x86_64' since 'arm64' was not supported until .NET 6.
  + if (semver.lt(dotnetInfo.Version, MINIMUM_SUPPORTED_OSX_ARM64_DOTNET_CLI))
  {
  - targetArchitecture = 'x86_64';
  + return 'x86_64';
  }
  - else if (dotnetInfo.RuntimeId)
  - {
  +
  + // Otherwise, look at the runtime ID.
  if (dotnetInfo.RuntimeId.includes('arm64'))
  {
  - targetArchitecture = 'arm64';
  + return 'arm64';
  }
  else if (dotnetInfo.RuntimeId.includes('x64'))
  {
  - targetArchitecture = 'x86_64';
  - }
  - else
  - {
  - throw new Error(`Unexpected RuntimeId '${dotnetInfo.RuntimeId}'.`);
  - }
  - }
  + return 'x86_64';
  }
  - if (!targetArchitecture) {
  - // Unable to retrieve any targetArchitecture, go with platformInfo.
  - targetArchitecture = platformInfo.architecture;
  - }
  - }
  -
  - return targetArchitecture;
  + throw new Error(`Unexpected RuntimeId '${dotnetInfo.RuntimeId}'.`);
  }
  