diff options
| author | Karsten Heimrich <karsten.heimrich@qt.io> | 2022-02-09 12:51:06 +0100 |
|---|---|---|
| committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2022-02-10 06:52:37 +0000 |
| commit | f17daf02e5573077a3da9d2f71a3d5500413e0b1 (patch) | |
| tree | 36bd57065789011f2cd36684c25493d76d4c9101 /QtVsTools.Core/CommandLineParser.cs | |
| parent | 134748d4634c5005fa9e4e97994c921660388b01 (diff) | |
Inline variable declaration
Change-Id: I19a55a53173da4e6e5aeea5f40790b1dea6346ec
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Diffstat (limited to 'QtVsTools.Core/CommandLineParser.cs')
| -rw-r--r-- | QtVsTools.Core/CommandLineParser.cs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/QtVsTools.Core/CommandLineParser.cs b/QtVsTools.Core/CommandLineParser.cs index f66d0ef7..1b969367 100644 --- a/QtVsTools.Core/CommandLineParser.cs +++ b/QtVsTools.Core/CommandLineParser.cs @@ -117,8 +117,7 @@ namespace QtVsTools.Core.CommandLine IEnumerable<string> Aliases(string optionName) { - int optionIndex; - if (!nameHash.TryGetValue(optionName, out optionIndex)) { + if (!nameHash.TryGetValue(optionName, out int optionIndex)) { return new List<string>(); } return commandLineOptionList[optionIndex].Names; @@ -203,8 +202,7 @@ namespace QtVsTools.Core.CommandLine IEnumerator<string> argumentEnumerator, ref bool atEnd) { const char assignChar = '='; - int optionOffset; - if (nameHash.TryGetValue(optionName, out optionOffset)) { + if (nameHash.TryGetValue(optionName, out int optionOffset)) { int assignPos = argument.IndexOf(assignChar); bool withValue = !string.IsNullOrEmpty( commandLineOptionList[optionOffset].ValueName); @@ -355,10 +353,9 @@ namespace QtVsTools.Core.CommandLine if (!RegisterFoundOption(optionName)) { error = true; } else { - int optionOffset; Trace.Assert(nameHash.TryGetValue( optionName, - out optionOffset)); + out int optionOffset)); bool withValue = !string.IsNullOrEmpty( commandLineOptionList[optionOffset].ValueName); if (withValue) { @@ -396,10 +393,9 @@ namespace QtVsTools.Core.CommandLine if (argument.Length > 2) { string possibleShortOptionStyleName = argument.Substring(1, 1); - int shortOptionIdx; if (nameHash.TryGetValue( possibleShortOptionStyleName, - out shortOptionIdx)) { + out int shortOptionIdx)) { var arg = commandLineOptionList[shortOptionIdx]; if ((arg.Flags & Option.Flag.ShortOptionStyle) != 0) { RegisterFoundOption(possibleShortOptionStyleName); @@ -465,8 +461,7 @@ namespace QtVsTools.Core.CommandLine public IEnumerable<string> Values(string optionName) { CheckParsed("Values"); - int optionOffset; - if (nameHash.TryGetValue(optionName, out optionOffset)) { + if (nameHash.TryGetValue(optionName, out int optionOffset)) { var values = optionValuesHash[optionOffset]; return values; } |
