Skip to content

Commit 9206640

Browse files
Fixes after rebase
1 parent 1059fd4 commit 9206640

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

src/System.CommandLine.Tests/ParserTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void Option_short_forms_can_be_bundled()
141141

142142
result.CommandResult
143143
.ValueResults
144-
.Select(o => ((OptionResult)o).Option.Name)
144+
.Select(o => ((CliValueResult)o).ValueSymbol.Name)
145145
.Should()
146146
.BeEquivalentTo("-x", "-y", "-z");
147147
}
@@ -1714,7 +1714,7 @@ public void CommandResult_contains_argument_ValueResults()
17141714
commandResult.ValueResults.Should().HaveCount(2);
17151715
var result1 = commandResult.ValueResults[0];
17161716
result1.GetValue<string>().Should().Be("Kirk");
1717-
var result2 = commandValueResult.ValueResults[1];
1717+
var result2 = commandResult.ValueResults[1];
17181718
result2.GetValue<string>().Should().Be("Spock");
17191719
}
17201720

src/System.CommandLine/ParseResult.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal ParseResult(
3232
// TODO: Remove RootCommandResult - it is the root of the CommandValueResult ancestors (fix that)
3333
CliCommandResultInternal rootCommandResult,
3434
// TODO: Replace with CommandValueResult and remove CommandResult
35-
CliCommandResultInternal commandResult,
35+
CliCommandResultInternal commandResultInternal,
3636
IReadOnlyDictionary<CliSymbol, CliValueResult> valueResultDictionary,
3737
/*
3838
List<CliToken> tokens,
@@ -52,8 +52,8 @@ internal ParseResult(
5252
Configuration = configuration;
5353
_rootCommandResult = rootCommandResult;
5454
// TODO: Why do we need this?
55-
CommandResultInternal = commandResult;
56-
CommandResult = commandResult.CommandValueResult;
55+
CommandResultInternal = commandResultInternal;
56+
CommandResult = commandResultInternal.CommandResult;
5757
this.valueResultDictionary = valueResultDictionary;
5858
// TODO: invocation
5959
/*

src/System.CommandLine/Parsing/CliArgumentResultInternal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public CliValueResult ValueResult
3333
// TODO: Make sure errors are added
3434
var conversionValue = GetArgumentConversionResult().Value;
3535
var locations = Tokens.Select(token => token.Location).ToArray();
36-
_valueResult = new ValueResult(Argument, conversionValue, locations, ArgumentResult.GetValueResultOutcome(GetArgumentConversionResult()?.Result)); // null is temporary here
36+
_valueResult = new CliValueResult(Argument, conversionValue, locations, CliArgumentResultInternal.GetValueResultOutcome(GetArgumentConversionResult()?.Result)); // null is temporary here
3737
}
3838
return _valueResult;
3939
}

src/System.CommandLine/Parsing/CliCommandResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal CliCommandResult(
3232
/// <summary>
3333
/// The ValueResult instances for user entered data. This is a sparse list.
3434
/// </summary>
35-
public IEnumerable<CliValueResult> ValueResults { get; } = [];
35+
public IReadOnlyList<CliValueResult> ValueResults { get; internal set; } = [];
3636

3737
/// <summary>
3838
/// The CliCommand that the result is for.

src/System.CommandLine/Parsing/CliCommandResultInternal.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ public CliCommandResult CommandResult
4747
if (commandResult is null)
4848
{
4949
var parent = Parent is CliCommandResultInternal commandResultInternal
50-
? commandResultInternal.CommandValueResult
50+
? commandResultInternal.CommandResult
5151
: null;
52-
commandResult = new CliCommandResult(Command, parent);
52+
// TODO: Resolve the NRT warning for locations
53+
commandResult = new CliCommandResult(Command, parent?.Locations, parent);
5354
}
5455
// Reset unless we put tests in place to ensure it is not called in error handling before SymbolTree processing is complete
5556
commandResult.ValueResults = Children.Select(GetValueResult).OfType<CliValueResult>().ToList();

src/System.CommandLine/System.CommandLine.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<Compile Include="AliasSet.cs" />
2828
<Compile Include="ArgumentArity.cs" />
2929
<Compile Include="Binding\ArgumentConversionResult.cs" />
30+
<Compile Include="CliValueSymbol.cs" />
3031
<Compile Include="Parsing\CliCommandResult.cs" />
3132
<Compile Include="Parsing\CliSymbolResult.cs" />
3233
<Compile Include="Parsing\SymbolLookupByName.cs" />

0 commit comments

Comments
 (0)