internal DeconstructionPatternSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode parent, int position)
: base(green, parent, position)
{
}
public TypeSyntax Type
{
get
{
return this.GetRedAtZero(ref this.type);
}
}
public SyntaxToken OpenParenToken
{
get { return new SyntaxToken(this, ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.DeconstructionPatternSyntax)this.Green).openParenToken, this.GetChildPosition(1), this.GetChildIndex(1)); }
}
public SeparatedSyntaxList<SubpatternElementSyntax> SubPatterns
{
get
{
var red = this.GetRed(ref this.subPatterns, 2);
if (red != null)
return new SeparatedSyntaxList<SubpatternElementSyntax>(red, this.GetChildIndex(2));
get { return new SyntaxToken(this, ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.DeconstructionPatternSyntax)this.Green).closeParenToken, this.GetChildPosition(3), this.GetChildIndex(3)); }
}
public PropertySubpatternSyntax PropertySubpattern
public sealed partial class PropertySubpatternSyntax : CSharpSyntaxNode
{
private SyntaxNode subPatterns;
internal PropertySubpatternSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode parent, int position)
: base(green, parent, position)
{
}
public SyntaxToken OpenBraceToken
{
get { return new SyntaxToken(this, ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.PropertySubpatternSyntax)this.Green).openBraceToken, this.Position, 0); }
}
public SeparatedSyntaxList<SubpatternElementSyntax> SubPatterns
{
get
{
var red = this.GetRed(ref this.subPatterns, 1);
if (red != null)
return new SeparatedSyntaxList<SubpatternElementSyntax>(red, this.GetChildIndex(1));
get { return new SyntaxToken(this, ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.PropertySubpatternSyntax)this.Green).closeBraceToken, this.GetChildPosition(2), this.GetChildIndex(2)); }
[assembly:System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign","RS0027:Public API with optional parameter(s) should have the most parameters amongst its public overloads.",Justification="<Pending>",Scope="member",Target="~M:Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParenthesizedVariableDesignation(Microsoft.CodeAnalysis.SeparatedSyntaxList{Microsoft.CodeAnalysis.CSharp.Syntax.VariableDesignationSyntax})~Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedVariableDesignationSyntax")]
[assembly:System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign","RS0026:Do not add multiple public overloads with optional parameters",Justification="<Pending>",Scope="member",Target="~M:Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(Microsoft.CodeAnalysis.SemanticModel,Microsoft.CodeAnalysis.CSharp.Syntax.TupleExpressionSyntax,System.Threading.CancellationToken)~Microsoft.CodeAnalysis.INamedTypeSymbol")]
[assembly:System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign","RS0026:Do not add multiple public overloads with optional parameters",Justification="<Pending>",Scope="member",Target="~M:Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(Microsoft.CodeAnalysis.SemanticModel,Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentSyntax,System.Threading.CancellationToken)~Microsoft.CodeAnalysis.ISymbol")]
[assembly:System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign","RS0027:Public API with optional parameter(s) should have the most parameters amongst its public overloads.",Justification="<Pending>",Scope="member",Target="~M:Microsoft.CodeAnalysis.CSharp.SyntaxFactory.DeconstructionPattern(Microsoft.CodeAnalysis.SeparatedSyntaxList{Microsoft.CodeAnalysis.CSharp.Syntax.SubpatternElementSyntax})~Microsoft.CodeAnalysis.CSharp.Syntax.DeconstructionPatternSyntax")]
[assembly:System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign","RS0027:Public API with optional parameter(s) should have the most parameters amongst its public overloads.",Justification="<Pending>",Scope="member",Target="~M:Microsoft.CodeAnalysis.CSharp.SyntaxFactory.PropertySubpattern(Microsoft.CodeAnalysis.SeparatedSyntaxList{Microsoft.CodeAnalysis.CSharp.Syntax.SubpatternElementSyntax})~Microsoft.CodeAnalysis.CSharp.Syntax.PropertySubpatternSyntax")]
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// (6,17): error CS0151: A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type in C# 6 and earlier.
// (6,17): error CS0151: A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type in C# 6 and earlier.
return Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxFactory.PropertySubpattern(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SubpatternElementSyntax>(), Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxFactory.Token(SyntaxKind.CloseBraceToken));
return SyntaxFactory.PropertySubpattern(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SeparatedSyntaxList<SubpatternElementSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken));
var newNode = node.WithType(node.Type).WithOpenParenToken(node.OpenParenToken).WithSubPatterns(node.SubPatterns).WithCloseParenToken(node.CloseParenToken).WithPropertySubpattern(node.PropertySubpattern).WithDesignation(node.Designation);
Assert.Equal(node, newNode);
}
[Fact]
public void TestSubpatternElementFactoryAndProperties()
{
var node = GenerateSubpatternElement();
Assert.Null(node.NameColon);
Assert.NotNull(node.Pattern);
var newNode = node.WithNameColon(node.NameColon).WithPattern(node.Pattern);
Assert.Equal(node, newNode);
}
[Fact]
public void TestPropertyPatternFactoryAndProperties()
{
var node = GeneratePropertyPattern();
Assert.Null(node.Type);
Assert.NotNull(node.PropertySubpattern);
Assert.Null(node.Designation);
var newNode = node.WithType(node.Type).WithPropertySubpattern(node.PropertySubpattern).WithDesignation(node.Designation);
Assert.Equal(node, newNode);
}
[Fact]
public void TestPropertySubpatternFactoryAndProperties()