repo_name
stringclasses 6
values | pr_number
int64 512
78.9k
| pr_title
stringlengths 3
144
| pr_description
stringlengths 0
30.3k
| author
stringlengths 2
21
| date_created
unknown | date_merged
unknown | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 17
30.4k
| filepath
stringlengths 9
210
| before_content
stringlengths 0
112M
| after_content
stringlengths 0
112M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/CSharp/Test/Semantic/Semantics/BetterCandidates.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using System.Linq;
using System.Diagnostics;
using System.Collections;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
/// <summary>
/// Tests for improved overload candidate selection.
/// See also https://github.com/dotnet/csharplang/issues/98.
/// </summary>
public class BetterCandidates : CompilingTestBase
{
private CSharpCompilation CreateCompilationWithoutBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null)
{
return CreateCompilation(source, options: options, references: references, parseOptions: TestOptions.WithoutImprovedOverloadCandidates);
}
private CSharpCompilation CreateCompilationWithBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null)
{
Debug.Assert(TestOptions.Regular.LanguageVersion >= MessageID.IDS_FeatureImprovedOverloadCandidates.RequiredVersion());
return CreateCompilation(source, options: options, references: references, parseOptions: TestOptions.Regular);
}
//When a method group contains both instance and static members, we discard the instance members if invoked with a static receiver.
[Fact]
public void TestStaticReceiver01()
{
var source =
@"class Program
{
public static void Main()
{
Program.M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver01()
{
var source =
@"class Program
{
public static void Main()
{
Program p = new Program();
p.M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// p.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 11)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver02()
{
var source =
@"class Program
{
public static void Main()
{
Program p = new Program();
p.Main2();
}
void Main2()
{
this.M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (10,14): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// this.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(10, 14)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver02b()
{
var source =
@"class Program
{
public static void Main()
{
D d = new D();
d.Main2();
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class D : Program
{
public void Main2()
{
base.M(null);
}
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (15,14): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// base.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(15, 14)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver03()
{
var source =
@"class Program
{
public static void Main()
{
new MyCollection { null };
}
}
class A {}
class B {}
class MyCollection : System.Collections.IEnumerable
{
public static void Add(A a) { System.Console.WriteLine(1); }
public void Add(B b) { System.Console.WriteLine(2); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
throw new System.NotImplementedException();
}
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,28): error CS0121: The call is ambiguous between the following methods or properties: 'MyCollection.Add(A)' and 'MyCollection.Add(B)'
// new MyCollection { null };
Diagnostic(ErrorCode.ERR_AmbigCall, "null").WithArguments("MyCollection.Add(A)", "MyCollection.Add(B)").WithLocation(5, 28)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver04()
{
var source =
@"class Program
{
public static void Main()
{
var c = new MyCollection();
foreach (var q in c) { }
}
}
class A {}
class B {}
class MyCollection : System.Collections.IEnumerable
{
public static System.Collections.IEnumerator GetEnumerator()
{
throw new System.NotImplementedException();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
System.Console.Write(1);
return new MyEnumerator();
}
}
class MyEnumerator : System.Collections.IEnumerator
{
object System.Collections.IEnumerator.Current => throw null;
bool System.Collections.IEnumerator.MoveNext()
{
System.Console.WriteLine(2);
return false;
}
void System.Collections.IEnumerator.Reset() => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,27): warning CS0279: 'MyCollection' does not implement the 'collection' pattern. 'MyCollection.GetEnumerator()' is not a public instance or extension method.
// foreach (var q in c) { }
Diagnostic(ErrorCode.WRN_PatternNotPublicOrNotInstance, "c").WithArguments("MyCollection", "collection", "MyCollection.GetEnumerator()").WithLocation(6, 27)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "12");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver05()
{
var source =
@"class Program
{
public static void Main()
{
var c = new MyCollection();
foreach (var q in c) { }
}
}
class A {}
class B {}
class MyCollection
{
public MyEnumerator GetEnumerator()
{
return new MyEnumerator();
}
}
class MyEnumerator
{
public object Current => throw null;
public bool MoveNext()
{
System.Console.WriteLine(2);
return false;
}
public static bool MoveNext() => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (26,24): error CS0111: Type 'MyEnumerator' already defines a member called 'MoveNext' with the same parameter types
// public static bool MoveNext() => throw null;
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "MoveNext").WithArguments("MoveNext", "MyEnumerator").WithLocation(26, 24),
// (6,27): error CS0202: foreach requires that the return type 'MyEnumerator' of 'MyCollection.GetEnumerator()' must have a suitable public 'MoveNext' method and public 'Current' property
// foreach (var q in c) { }
Diagnostic(ErrorCode.ERR_BadGetEnumerator, "c").WithArguments("MyEnumerator", "MyCollection.GetEnumerator()").WithLocation(6, 27)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (26,24): error CS0111: Type 'MyEnumerator' already defines a member called 'MoveNext' with the same parameter types
// public static bool MoveNext() => throw null;
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "MoveNext").WithArguments("MoveNext", "MyEnumerator").WithLocation(26, 24)
);
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver06()
{
var source =
@"class Program
{
public static void Main()
{
var o = new MyDeconstructable();
(var a, var b) = o;
System.Console.WriteLine(a);
}
}
class MyDeconstructable
{
public void Deconstruct(out int a, out int b) => (a, b) = (1, 2);
public static void Deconstruct(out long a, out long b) => (a, b) = (3, 4);
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,26): error CS0121: The call is ambiguous between the following methods or properties: 'MyDeconstructable.Deconstruct(out int, out int)' and 'MyDeconstructable.Deconstruct(out long, out long)'
// (var a, var b) = o;
Diagnostic(ErrorCode.ERR_AmbigCall, "o").WithArguments("MyDeconstructable.Deconstruct(out int, out int)", "MyDeconstructable.Deconstruct(out long, out long)").WithLocation(6, 26),
// (6,14): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'a'.
// (var a, var b) = o;
Diagnostic(ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, "a").WithArguments("a").WithLocation(6, 14),
// (6,21): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'b'.
// (var a, var b) = o;
Diagnostic(ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, "b").WithArguments("b").WithLocation(6, 21)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver07()
{
var source =
@"class Program
{
public static void Main()
{
M(new MyTask<int>(3)).GetAwaiter().GetResult();
}
static async System.Threading.Tasks.Task M(MyTask<int> x)
{
var z = await x;
System.Console.WriteLine(z);
}
}
public class MyTask<TResult>
{
MyTaskAwaiter<TResult> awaiter;
public MyTask(TResult value)
{
this.awaiter = new MyTaskAwaiter<TResult>(value);
}
public static MyTaskAwaiter<TResult> GetAwaiter() => null;
}
public class MyTaskAwaiter<TResult> : System.Runtime.CompilerServices.INotifyCompletion
{
TResult value;
public MyTaskAwaiter(TResult value)
{
this.value = value;
}
public bool IsCompleted { get => true; }
public TResult GetResult() => value;
public void OnCompleted(System.Action continuation) => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS1986: 'await' requires that the type MyTask<int> have a suitable GetAwaiter method
// var z = await x;
Diagnostic(ErrorCode.ERR_BadAwaitArg, "await x").WithArguments("MyTask<int>").WithLocation(9, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS1986: 'await' requires that the type MyTask<int> have a suitable GetAwaiter method
// var z = await x;
Diagnostic(ErrorCode.ERR_BadAwaitArg, "await x").WithArguments("MyTask<int>").WithLocation(9, 17)
);
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver08()
{
var source =
@"class Program
{
public static void Main()
{
M(new MyTask<int>(3)).GetAwaiter().GetResult();
}
static async System.Threading.Tasks.Task M(MyTask<int> x)
{
var z = await x;
System.Console.WriteLine(z);
}
}
public class MyTask<TResult>
{
MyTaskAwaiter<TResult> awaiter;
public MyTask(TResult value)
{
this.awaiter = new MyTaskAwaiter<TResult>(value);
}
public MyTaskAwaiter<TResult> GetAwaiter() => awaiter;
}
public struct MyTaskAwaiter<TResult> : System.Runtime.CompilerServices.INotifyCompletion
{
TResult value;
public MyTaskAwaiter(TResult value)
{
this.value = value;
}
public bool IsCompleted { get => true; }
public static TResult GetResult() => throw null;
public void OnCompleted(System.Action continuation) => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS0176: Member 'MyTaskAwaiter<int>.GetResult()' cannot be accessed with an instance reference; qualify it with a type name instead
// var z = await x;
Diagnostic(ErrorCode.ERR_ObjectProhibited, "await x").WithArguments("MyTaskAwaiter<int>.GetResult()").WithLocation(9, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS0176: Member 'MyTaskAwaiter<int>.GetResult()' cannot be accessed with an instance reference; qualify it with a type name instead
// var z = await x;
Diagnostic(ErrorCode.ERR_ObjectProhibited, "await x").WithArguments("MyTaskAwaiter<int>.GetResult()").WithLocation(9, 17)
);
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver09()
{
var source =
@"using System;
class Program
{
static void Main()
{
var q = from x in new Q() select x;
}
}
class Q
{
public static object Select(Func<A, A> y)
{
Console.WriteLine(1);
return null;
}
public object Select(Func<B, B> y)
{
Console.WriteLine(2);
return null;
}
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,35): error CS1940: Multiple implementations of the query pattern were found for source type 'Q'. Ambiguous call to 'Select'.
// var q = from x in new Q() select x;
Diagnostic(ErrorCode.ERR_QueryMultipleProviders, "select x").WithArguments("Q", "Select").WithLocation(6, 35)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 1: in a static method
[Fact]
public void TestStaticContext01()
{
var source =
@"class Program
{
public static void Main()
{
M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 2: in a field initializer
[Fact]
public void TestStaticContext02()
{
var source =
@"class Program
{
public static void Main()
{
new Program();
}
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
int X = M(null);
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,13): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// int X = M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(9, 13)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 4: in a constructor-initializer
[Fact]
public void TestStaticContext04()
{
var source =
@"class Program
{
public static void Main()
{
new Program();
}
public Program() : this(M(null)) {}
public Program(int x) {}
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (7,29): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// public Program() : this(M(null)) {}
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(7, 29)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 5: in an attribute argument
[Fact]
public void TestStaticContext05()
{
var source =
@"public class Program
{
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
[My(M(null))]
public int x;
}
public class A {}
public class B {}
public class MyAttribute : System.Attribute
{
public MyAttribute(int value) {}
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// [My(M(null))]
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 9)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,9): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
// [My(M(null))]
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "M(null)").WithLocation(6, 9)
);
}
//When a method group contains no receiver in a static context, we include only static members.
// In a default parameter value
[Fact]
public void TestStaticContext06()
{
var source =
@"public class Program
{
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
public void Q(int x = M(null))
{
}
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,27): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// public void Q(int x = M(null))
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 27)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,27): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// public void Q(int x = M(null))
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 27)
);
}
//When a method group contains no receiver, we include both static and instance members in an other-than-static context. i.e. discard nothing.
[Fact]
public void TestInstanceContext01()
{
var source =
@"public class Program
{
public void M()
{
M(null);
}
public static int M(A a) => 1;
public int M(B b) => 2;
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 9)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 9)
);
}
//When a method group receiver is ambiguously an instance or type due to a color-color situation, we include both instance and static candidates.
[Fact]
public void TestAmbiguousContext01()
{
var source =
@"public class Color
{
public void M()
{
Color Color = null;
Color.M(null);
}
public static int M(A a) => 1;
public int M(B b) => 2;
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,15): error CS0121: The call is ambiguous between the following methods or properties: 'Color.M(A)' and 'Color.M(B)'
// Color.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Color.M(A)", "Color.M(B)").WithLocation(6, 15)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,15): error CS0121: The call is ambiguous between the following methods or properties: 'Color.M(A)' and 'Color.M(B)'
// Color.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Color.M(A)", "Color.M(B)").WithLocation(6, 15)
);
}
//When a method group contains some generic methods whose type parameters do not satisfy their constraints, these members are removed from the candidate set.
[Fact]
public void TestConstraintFailed01()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), 0);
}
static void M<T>(T t1, int i) where T: B { System.Console.WriteLine(1); }
static void M<T>(T t1, short s) { System.Console.WriteLine(2); }
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0311: The type 'A' cannot be used as type parameter 'T' in the generic type or method 'Program.M<T>(T, int)'. There is no implicit reference conversion from 'A' to 'B'.
// M(new A(), 0);
Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedRefType, "M").WithArguments("Program.M<T>(T, int)", "B", "T", "A").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains some generic methods whose type parameters do not satisfy their constraints, these members are removed from the candidate set.
// Test that this permits overload resolution to use type parameter constraints "as a tie-breaker" to guide overload resolution.
[Fact]
public void TestConstraintFailed02()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), null);
M(new B(), null);
}
static void M<T>(T t1, B b) where T: struct { System.Console.Write(""struct ""); }
static void M<T>(T t1, X s) where T : class { System.Console.Write(""class ""); }
}
public struct A {}
public class B {}
public class X {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, X)'
// M(new A(), null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, X)").WithLocation(5, 9),
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, X)'
// M(new B(), null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, X)").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "struct class ");
}
//For a method group conversion, candidate methods whose return type doesn't match up with the delegate's return type are removed from the set.
[Fact]
public void TestReturnTypeMismatch01()
{
var source =
@"public class Program
{
static void Main()
{
M(Program.Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
static void Q(A a) { }
static void Q(B b) { }
}
delegate int D1(A a);
delegate void D2(B b);
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//For a method group conversion, candidate methods whose return ref kind doesn't match up with the delegate's return ref kind are removed from the set.
[Fact]
public void TestReturnRefMismatch01()
{
var source =
@"public class Program
{
static int tmp;
static void Main()
{
M(Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
static ref int Q() { return ref tmp; }
}
delegate int D1();
delegate ref int D2();
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//For a method group conversion, candidate methods whose return ref kind doesn't match up with the delegate's return ref kind are removed from the set.
[Fact]
public void TestReturnRefMismatch02()
{
var source =
@"public class Program
{
static int tmp = 2;
static void Main()
{
M(Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
static int Q() { return tmp; }
}
delegate int D1();
delegate ref int D2();
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//For a method group conversion, candidate methods whose return type doesn't match up with the delegate's return type are removed from the set.
[Fact]
public void TestReturnTypeMismatch02()
{
var source =
@"public class Program
{
static void Main()
{
M(new Z().Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
}
delegate int D1(A a);
delegate void D2(B b);
public class A {}
public class B {}
public class Z {}
public static class X
{
public static void Q(this Z z, A a) {}
public static void Q(this Z z, B b) {}
}
namespace System.Runtime.CompilerServices
{
public class ExtensionAttribute : System.Attribute {}
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(new Z().Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
// Test suggested by @VSadov
// 1) one candidate is generic, but candidate fails constraints, while another overload requires a conversion. Used to be an error, second should be picked now.
[Fact]
public void TestConstraintFailed03()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), 0);
}
static void M<T>(T t1, int i) where T: B { System.Console.WriteLine(1); }
static void M(C c, short s) { System.Console.WriteLine(2); }
}
public class A {}
public class B {}
public class C { public static implicit operator C(A a) => null; }
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0311: The type 'A' cannot be used as type parameter 'T' in the generic type or method 'Program.M<T>(T, int)'. There is no implicit reference conversion from 'A' to 'B'.
// M(new A(), 0);
Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedRefType, "M").WithArguments("Program.M<T>(T, int)", "B", "T", "A").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
// Test suggested by @VSadov
// 2) one candidate is generic without constraints, but we pass a ref-struct to it, which cannot be a generic type arg, another candidate requires a conversion and now works.
[Fact]
public void TestConstraintFailed04()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), 0);
}
static void M<T>(T t1, int i) { System.Console.WriteLine(1); }
static void M(C c, short s) { System.Console.WriteLine(2); }
}
public ref struct A {}
public class C { public static implicit operator C(A a) => null; }
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0306: The type 'A' may not be used as a type argument
// M(new A(), 0);
Diagnostic(ErrorCode.ERR_BadTypeArgument, "M").WithArguments("A").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
// Test suggested by @VSadov
// 3) one candidate is generic without constraints, but we pass a pointer to it, which cannot be a generic type arg, another candidate requires a conversion and now works.
[Fact]
public void TestConstraintFailed05()
{
var source =
@"public class Program
{
static unsafe void Main()
{
int *p = null;
M(p, 0);
}
static void M<T>(T t1, int i) { System.Console.WriteLine(1); }
static void M(C c, short s) { System.Console.WriteLine(2); }
}
public class C { public static unsafe implicit operator C(int* p) => null; }
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
// (6,9): error CS0306: The type 'int*' may not be used as a type argument
// M(p, 0);
Diagnostic(ErrorCode.ERR_BadTypeArgument, "M").WithArguments("int*").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2", verify: Verification.Skipped);
}
[ClrOnlyFact]
public void IndexedPropertyTest01()
{
var source1 =
@"Imports System
Imports System.Runtime.InteropServices
<Assembly: PrimaryInteropAssembly(0, 0)>
<Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")>
<ComImport()>
<Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")>
Public Class C
Public Property P(a As A) As Object
Get
Return Nothing
End Get
Set(value As Object)
End Set
End Property
Public Shared Property P(b As B) As Object
Get
Return Nothing
End Get
Set(value As Object)
End Set
End Property
End Class
Public Class A
End Class
Public Class B
End Class
";
var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes);
var source2 =
@"class D : C
{
static void Main()
{
}
void M()
{
object o;
o = P[null];
P[null] = o;
o = this.P[null];
base.P[null] = o;
o = D.P[null]; // C# does not support static indexed properties
D.P[null] = o; // C# does not support static indexed properties
}
}";
CreateCompilationWithoutBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
// (13,13): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// o = D.P[null];
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(13, 13),
// (14,9): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// D.P[null] = o;
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(14, 9)
);
CreateCompilationWithBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
// (13,13): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// o = D.P[null];
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(13, 13),
// (14,9): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// D.P[null] = o;
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(14, 9)
);
}
[Fact]
public void TestAmbiguous01()
{
// test semantic model in the face of ambiguities even when there are static/instance violations
var source =
@"class Program
{
public static void Main()
{
Program p = null;
Program.M(null); // two static candidates
p.M(null); // two instance candidates
M(null); // two static candidates
}
void Q()
{
Program Program = null;
M(null); // four candidates
Program.M(null); // four candidates
}
public static void M(A a) => throw null;
public void M(B b) => throw null;
public static void M(C c) => throw null;
public void M(D d) => throw null;
}
class A {}
class B {}
class C {}
class D {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 17),
// (7,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// p.M(null); // two instance candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(7, 11),
// (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(8, 9),
// (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(13, 9),
// (14,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(14, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(C)'
// Program.M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(C)").WithLocation(6, 17),
// (7,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(B)' and 'Program.M(D)'
// p.M(null); // two instance candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(B)", "Program.M(D)").WithLocation(7, 11),
// (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(C)'
// M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(C)").WithLocation(8, 9),
// (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(13, 9),
// (14,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(14, 17)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(5, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[1].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[2].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[3].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[4].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
[Fact]
public void TestAmbiguous02()
{
// test semantic model in the face of ambiguities even when there are constraint violations
var source =
@"class Program
{
public static void Main()
{
M(1, null);
}
public static void M<T>(T t, A a) where T : Constraint => throw null;
public static void M<T>(T t, B b) => throw null;
public static void M<T>(T t, C c) where T : Constraint => throw null;
public static void M<T>(T t, D d) => throw null;
}
class A {}
class B {}
class C {}
class D {}
class Constraint {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, A)' and 'Program.M<T>(T, B)'
// M(1, null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, A)", "Program.M<T>(T, B)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, D)'
// M(1, null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, D)").WithLocation(5, 9)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(1, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
[Fact]
public void TestAmbiguous03()
{
// test semantic model in the face of ambiguities even when there are constraint violations
var source =
@"class Program
{
public static void Main()
{
1.M(null);
}
}
public class A {}
public class B {}
public class C {}
public class D {}
public class Constraint {}
public static class Extensions
{
public static void M<T>(this T t, A a) where T : Constraint => throw null;
public static void M<T>(this T t, B b) => throw null;
public static void M<T>(this T t, C c) where T : Constraint => throw null;
public static void M<T>(this T t, D d) => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,11): error CS0121: The call is ambiguous between the following methods or properties: 'Extensions.M<T>(T, A)' and 'Extensions.M<T>(T, B)'
// 1.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Extensions.M<T>(T, A)", "Extensions.M<T>(T, B)").WithLocation(5, 11)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,11): error CS0121: The call is ambiguous between the following methods or properties: 'Extensions.M<T>(T, B)' and 'Extensions.M<T>(T, D)'
// 1.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Extensions.M<T>(T, B)", "Extensions.M<T>(T, D)").WithLocation(5, 11)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(1, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void System.Int32.M<System.Int32>(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void System.Int32.M<System.Int32>(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void System.Int32.M<System.Int32>(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void System.Int32.M<System.Int32>(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
[Fact]
public void TestAmbiguous04()
{
// test semantic model in the face of ambiguities even when there are return type mismatches
var source =
@"class Program
{
public static void Main()
{
Invoked(Argument);
}
public static void Invoked(Delegate d)
{
}
public delegate A Delegate(IZ c);
static B Argument(IQ x) => null;
static D Argument(IW x) => null;
static C Argument(IX x) => null;
static D Argument(IY x) => null;
}
class A {} class B: A {} class C: A {}
class D {}
interface IQ {}
interface IW {}
interface IX {}
interface IY {}
interface IZ: IQ, IW, IX, IY {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.Argument(IQ)' and 'Program.Argument(IW)'
// Invoked(Argument);
Diagnostic(ErrorCode.ERR_AmbigCall, "Argument").WithArguments("Program.Argument(IQ)", "Program.Argument(IW)").WithLocation(5, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.Argument(IQ)' and 'Program.Argument(IX)'
// Invoked(Argument);
Diagnostic(ErrorCode.ERR_AmbigCall, "Argument").WithArguments("Program.Argument(IQ)", "Program.Argument(IX)").WithLocation(5, 17)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(1, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].ArgumentList.Arguments[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("B Program.Argument(IQ x)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("D Program.Argument(IW x)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("C Program.Argument(IX x)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("D Program.Argument(IY x)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using System.Linq;
using System.Diagnostics;
using System.Collections;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
/// <summary>
/// Tests for improved overload candidate selection.
/// See also https://github.com/dotnet/csharplang/issues/98.
/// </summary>
public class BetterCandidates : CompilingTestBase
{
private CSharpCompilation CreateCompilationWithoutBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null)
{
return CreateCompilation(source, options: options, references: references, parseOptions: TestOptions.WithoutImprovedOverloadCandidates);
}
private CSharpCompilation CreateCompilationWithBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null)
{
Debug.Assert(TestOptions.Regular.LanguageVersion >= MessageID.IDS_FeatureImprovedOverloadCandidates.RequiredVersion());
return CreateCompilation(source, options: options, references: references, parseOptions: TestOptions.Regular);
}
//When a method group contains both instance and static members, we discard the instance members if invoked with a static receiver.
[Fact]
public void TestStaticReceiver01()
{
var source =
@"class Program
{
public static void Main()
{
Program.M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver01()
{
var source =
@"class Program
{
public static void Main()
{
Program p = new Program();
p.M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// p.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 11)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver02()
{
var source =
@"class Program
{
public static void Main()
{
Program p = new Program();
p.Main2();
}
void Main2()
{
this.M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (10,14): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// this.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(10, 14)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver02b()
{
var source =
@"class Program
{
public static void Main()
{
D d = new D();
d.Main2();
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class D : Program
{
public void Main2()
{
base.M(null);
}
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (15,14): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// base.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(15, 14)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver03()
{
var source =
@"class Program
{
public static void Main()
{
new MyCollection { null };
}
}
class A {}
class B {}
class MyCollection : System.Collections.IEnumerable
{
public static void Add(A a) { System.Console.WriteLine(1); }
public void Add(B b) { System.Console.WriteLine(2); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
throw new System.NotImplementedException();
}
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,28): error CS0121: The call is ambiguous between the following methods or properties: 'MyCollection.Add(A)' and 'MyCollection.Add(B)'
// new MyCollection { null };
Diagnostic(ErrorCode.ERR_AmbigCall, "null").WithArguments("MyCollection.Add(A)", "MyCollection.Add(B)").WithLocation(5, 28)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver04()
{
var source =
@"class Program
{
public static void Main()
{
var c = new MyCollection();
foreach (var q in c) { }
}
}
class A {}
class B {}
class MyCollection : System.Collections.IEnumerable
{
public static System.Collections.IEnumerator GetEnumerator()
{
throw new System.NotImplementedException();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
System.Console.Write(1);
return new MyEnumerator();
}
}
class MyEnumerator : System.Collections.IEnumerator
{
object System.Collections.IEnumerator.Current => throw null;
bool System.Collections.IEnumerator.MoveNext()
{
System.Console.WriteLine(2);
return false;
}
void System.Collections.IEnumerator.Reset() => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,27): warning CS0279: 'MyCollection' does not implement the 'collection' pattern. 'MyCollection.GetEnumerator()' is not a public instance or extension method.
// foreach (var q in c) { }
Diagnostic(ErrorCode.WRN_PatternNotPublicOrNotInstance, "c").WithArguments("MyCollection", "collection", "MyCollection.GetEnumerator()").WithLocation(6, 27)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "12");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver05()
{
var source =
@"class Program
{
public static void Main()
{
var c = new MyCollection();
foreach (var q in c) { }
}
}
class A {}
class B {}
class MyCollection
{
public MyEnumerator GetEnumerator()
{
return new MyEnumerator();
}
}
class MyEnumerator
{
public object Current => throw null;
public bool MoveNext()
{
System.Console.WriteLine(2);
return false;
}
public static bool MoveNext() => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (26,24): error CS0111: Type 'MyEnumerator' already defines a member called 'MoveNext' with the same parameter types
// public static bool MoveNext() => throw null;
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "MoveNext").WithArguments("MoveNext", "MyEnumerator").WithLocation(26, 24),
// (6,27): error CS0202: foreach requires that the return type 'MyEnumerator' of 'MyCollection.GetEnumerator()' must have a suitable public 'MoveNext' method and public 'Current' property
// foreach (var q in c) { }
Diagnostic(ErrorCode.ERR_BadGetEnumerator, "c").WithArguments("MyEnumerator", "MyCollection.GetEnumerator()").WithLocation(6, 27)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (26,24): error CS0111: Type 'MyEnumerator' already defines a member called 'MoveNext' with the same parameter types
// public static bool MoveNext() => throw null;
Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "MoveNext").WithArguments("MoveNext", "MyEnumerator").WithLocation(26, 24)
);
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver06()
{
var source =
@"class Program
{
public static void Main()
{
var o = new MyDeconstructable();
(var a, var b) = o;
System.Console.WriteLine(a);
}
}
class MyDeconstructable
{
public void Deconstruct(out int a, out int b) => (a, b) = (1, 2);
public static void Deconstruct(out long a, out long b) => (a, b) = (3, 4);
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,26): error CS0121: The call is ambiguous between the following methods or properties: 'MyDeconstructable.Deconstruct(out int, out int)' and 'MyDeconstructable.Deconstruct(out long, out long)'
// (var a, var b) = o;
Diagnostic(ErrorCode.ERR_AmbigCall, "o").WithArguments("MyDeconstructable.Deconstruct(out int, out int)", "MyDeconstructable.Deconstruct(out long, out long)").WithLocation(6, 26),
// (6,14): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'a'.
// (var a, var b) = o;
Diagnostic(ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, "a").WithArguments("a").WithLocation(6, 14),
// (6,21): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'b'.
// (var a, var b) = o;
Diagnostic(ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, "b").WithArguments("b").WithLocation(6, 21)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver07()
{
var source =
@"class Program
{
public static void Main()
{
M(new MyTask<int>(3)).GetAwaiter().GetResult();
}
static async System.Threading.Tasks.Task M(MyTask<int> x)
{
var z = await x;
System.Console.WriteLine(z);
}
}
public class MyTask<TResult>
{
MyTaskAwaiter<TResult> awaiter;
public MyTask(TResult value)
{
this.awaiter = new MyTaskAwaiter<TResult>(value);
}
public static MyTaskAwaiter<TResult> GetAwaiter() => null;
}
public class MyTaskAwaiter<TResult> : System.Runtime.CompilerServices.INotifyCompletion
{
TResult value;
public MyTaskAwaiter(TResult value)
{
this.value = value;
}
public bool IsCompleted { get => true; }
public TResult GetResult() => value;
public void OnCompleted(System.Action continuation) => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS1986: 'await' requires that the type MyTask<int> have a suitable GetAwaiter method
// var z = await x;
Diagnostic(ErrorCode.ERR_BadAwaitArg, "await x").WithArguments("MyTask<int>").WithLocation(9, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS1986: 'await' requires that the type MyTask<int> have a suitable GetAwaiter method
// var z = await x;
Diagnostic(ErrorCode.ERR_BadAwaitArg, "await x").WithArguments("MyTask<int>").WithLocation(9, 17)
);
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver08()
{
var source =
@"class Program
{
public static void Main()
{
M(new MyTask<int>(3)).GetAwaiter().GetResult();
}
static async System.Threading.Tasks.Task M(MyTask<int> x)
{
var z = await x;
System.Console.WriteLine(z);
}
}
public class MyTask<TResult>
{
MyTaskAwaiter<TResult> awaiter;
public MyTask(TResult value)
{
this.awaiter = new MyTaskAwaiter<TResult>(value);
}
public MyTaskAwaiter<TResult> GetAwaiter() => awaiter;
}
public struct MyTaskAwaiter<TResult> : System.Runtime.CompilerServices.INotifyCompletion
{
TResult value;
public MyTaskAwaiter(TResult value)
{
this.value = value;
}
public bool IsCompleted { get => true; }
public static TResult GetResult() => throw null;
public void OnCompleted(System.Action continuation) => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS0176: Member 'MyTaskAwaiter<int>.GetResult()' cannot be accessed with an instance reference; qualify it with a type name instead
// var z = await x;
Diagnostic(ErrorCode.ERR_ObjectProhibited, "await x").WithArguments("MyTaskAwaiter<int>.GetResult()").WithLocation(9, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,17): error CS0176: Member 'MyTaskAwaiter<int>.GetResult()' cannot be accessed with an instance reference; qualify it with a type name instead
// var z = await x;
Diagnostic(ErrorCode.ERR_ObjectProhibited, "await x").WithArguments("MyTaskAwaiter<int>.GetResult()").WithLocation(9, 17)
);
}
//When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
[Fact]
public void TestInstanceReceiver09()
{
var source =
@"using System;
class Program
{
static void Main()
{
var q = from x in new Q() select x;
}
}
class Q
{
public static object Select(Func<A, A> y)
{
Console.WriteLine(1);
return null;
}
public object Select(Func<B, B> y)
{
Console.WriteLine(2);
return null;
}
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,35): error CS1940: Multiple implementations of the query pattern were found for source type 'Q'. Ambiguous call to 'Select'.
// var q = from x in new Q() select x;
Diagnostic(ErrorCode.ERR_QueryMultipleProviders, "select x").WithArguments("Q", "Select").WithLocation(6, 35)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 1: in a static method
[Fact]
public void TestStaticContext01()
{
var source =
@"class Program
{
public static void Main()
{
M(null);
}
public static void M(A a) { System.Console.WriteLine(1); }
public void M(B b) { System.Console.WriteLine(2); }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 2: in a field initializer
[Fact]
public void TestStaticContext02()
{
var source =
@"class Program
{
public static void Main()
{
new Program();
}
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
int X = M(null);
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (9,13): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// int X = M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(9, 13)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 4: in a constructor-initializer
[Fact]
public void TestStaticContext04()
{
var source =
@"class Program
{
public static void Main()
{
new Program();
}
public Program() : this(M(null)) {}
public Program(int x) {}
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
}
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (7,29): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// public Program() : this(M(null)) {}
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(7, 29)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//When a method group contains no receiver in a static context, we include only static members.
// Type 5: in an attribute argument
[Fact]
public void TestStaticContext05()
{
var source =
@"public class Program
{
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
[My(M(null))]
public int x;
}
public class A {}
public class B {}
public class MyAttribute : System.Attribute
{
public MyAttribute(int value) {}
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// [My(M(null))]
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 9)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,9): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
// [My(M(null))]
Diagnostic(ErrorCode.ERR_BadAttributeArgument, "M(null)").WithLocation(6, 9)
);
}
//When a method group contains no receiver in a static context, we include only static members.
// In a default parameter value
[Fact]
public void TestStaticContext06()
{
var source =
@"public class Program
{
public static int M(A a) { System.Console.WriteLine(1); return 1; }
public int M(B b) { System.Console.WriteLine(2); return 2; }
public void Q(int x = M(null))
{
}
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,27): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// public void Q(int x = M(null))
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 27)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,27): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// public void Q(int x = M(null))
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 27)
);
}
//When a method group contains no receiver, we include both static and instance members in an other-than-static context. i.e. discard nothing.
[Fact]
public void TestInstanceContext01()
{
var source =
@"public class Program
{
public void M()
{
M(null);
}
public static int M(A a) => 1;
public int M(B b) => 2;
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 9)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 9)
);
}
//When a method group receiver is ambiguously an instance or type due to a color-color situation, we include both instance and static candidates.
[Fact]
public void TestAmbiguousContext01()
{
var source =
@"public class Color
{
public void M()
{
Color Color = null;
Color.M(null);
}
public static int M(A a) => 1;
public int M(B b) => 2;
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,15): error CS0121: The call is ambiguous between the following methods or properties: 'Color.M(A)' and 'Color.M(B)'
// Color.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Color.M(A)", "Color.M(B)").WithLocation(6, 15)
);
CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
// (6,15): error CS0121: The call is ambiguous between the following methods or properties: 'Color.M(A)' and 'Color.M(B)'
// Color.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Color.M(A)", "Color.M(B)").WithLocation(6, 15)
);
}
//When a method group contains some generic methods whose type parameters do not satisfy their constraints, these members are removed from the candidate set.
[Fact]
public void TestConstraintFailed01()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), 0);
}
static void M<T>(T t1, int i) where T: B { System.Console.WriteLine(1); }
static void M<T>(T t1, short s) { System.Console.WriteLine(2); }
}
public class A {}
public class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0311: The type 'A' cannot be used as type parameter 'T' in the generic type or method 'Program.M<T>(T, int)'. There is no implicit reference conversion from 'A' to 'B'.
// M(new A(), 0);
Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedRefType, "M").WithArguments("Program.M<T>(T, int)", "B", "T", "A").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//When a method group contains some generic methods whose type parameters do not satisfy their constraints, these members are removed from the candidate set.
// Test that this permits overload resolution to use type parameter constraints "as a tie-breaker" to guide overload resolution.
[Fact]
public void TestConstraintFailed02()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), null);
M(new B(), null);
}
static void M<T>(T t1, B b) where T: struct { System.Console.Write(""struct ""); }
static void M<T>(T t1, X s) where T : class { System.Console.Write(""class ""); }
}
public struct A {}
public class B {}
public class X {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, X)'
// M(new A(), null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, X)").WithLocation(5, 9),
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, X)'
// M(new B(), null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, X)").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "struct class ");
}
//For a method group conversion, candidate methods whose return type doesn't match up with the delegate's return type are removed from the set.
[Fact]
public void TestReturnTypeMismatch01()
{
var source =
@"public class Program
{
static void Main()
{
M(Program.Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
static void Q(A a) { }
static void Q(B b) { }
}
delegate int D1(A a);
delegate void D2(B b);
class A {}
class B {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//For a method group conversion, candidate methods whose return ref kind doesn't match up with the delegate's return ref kind are removed from the set.
[Fact]
public void TestReturnRefMismatch01()
{
var source =
@"public class Program
{
static int tmp;
static void Main()
{
M(Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
static ref int Q() { return ref tmp; }
}
delegate int D1();
delegate ref int D2();
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
//For a method group conversion, candidate methods whose return ref kind doesn't match up with the delegate's return ref kind are removed from the set.
[Fact]
public void TestReturnRefMismatch02()
{
var source =
@"public class Program
{
static int tmp = 2;
static void Main()
{
M(Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
static int Q() { return tmp; }
}
delegate int D1();
delegate ref int D2();
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "1");
}
//For a method group conversion, candidate methods whose return type doesn't match up with the delegate's return type are removed from the set.
[Fact]
public void TestReturnTypeMismatch02()
{
var source =
@"public class Program
{
static void Main()
{
M(new Z().Q);
}
static void M(D1 d) { System.Console.WriteLine(1); }
static void M(D2 d) { System.Console.WriteLine(2); }
}
delegate int D1(A a);
delegate void D2(B b);
public class A {}
public class B {}
public class Z {}
public static class X
{
public static void Q(this Z z, A a) {}
public static void Q(this Z z, B b) {}
}
namespace System.Runtime.CompilerServices
{
public class ExtensionAttribute : System.Attribute {}
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
// M(new Z().Q);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
// Test suggested by @VSadov
// 1) one candidate is generic, but candidate fails constraints, while another overload requires a conversion. Used to be an error, second should be picked now.
[Fact]
public void TestConstraintFailed03()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), 0);
}
static void M<T>(T t1, int i) where T: B { System.Console.WriteLine(1); }
static void M(C c, short s) { System.Console.WriteLine(2); }
}
public class A {}
public class B {}
public class C { public static implicit operator C(A a) => null; }
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0311: The type 'A' cannot be used as type parameter 'T' in the generic type or method 'Program.M<T>(T, int)'. There is no implicit reference conversion from 'A' to 'B'.
// M(new A(), 0);
Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedRefType, "M").WithArguments("Program.M<T>(T, int)", "B", "T", "A").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
// Test suggested by @VSadov
// 2) one candidate is generic without constraints, but we pass a ref-struct to it, which cannot be a generic type arg, another candidate requires a conversion and now works.
[Fact]
public void TestConstraintFailed04()
{
var source =
@"public class Program
{
static void Main()
{
M(new A(), 0);
}
static void M<T>(T t1, int i) { System.Console.WriteLine(1); }
static void M(C c, short s) { System.Console.WriteLine(2); }
}
public ref struct A {}
public class C { public static implicit operator C(A a) => null; }
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0306: The type 'A' may not be used as a type argument
// M(new A(), 0);
Diagnostic(ErrorCode.ERR_BadTypeArgument, "M").WithArguments("A").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2");
}
// Test suggested by @VSadov
// 3) one candidate is generic without constraints, but we pass a pointer to it, which cannot be a generic type arg, another candidate requires a conversion and now works.
[Fact]
public void TestConstraintFailed05()
{
var source =
@"public class Program
{
static unsafe void Main()
{
int *p = null;
M(p, 0);
}
static void M<T>(T t1, int i) { System.Console.WriteLine(1); }
static void M(C c, short s) { System.Console.WriteLine(2); }
}
public class C { public static unsafe implicit operator C(int* p) => null; }
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
// (6,9): error CS0306: The type 'int*' may not be used as a type argument
// M(p, 0);
Diagnostic(ErrorCode.ERR_BadTypeArgument, "M").WithArguments("int*").WithLocation(6, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
);
CompileAndVerify(compilation, expectedOutput: "2", verify: Verification.Skipped);
}
[ClrOnlyFact]
public void IndexedPropertyTest01()
{
var source1 =
@"Imports System
Imports System.Runtime.InteropServices
<Assembly: PrimaryInteropAssembly(0, 0)>
<Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")>
<ComImport()>
<Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")>
Public Class C
Public Property P(a As A) As Object
Get
Return Nothing
End Get
Set(value As Object)
End Set
End Property
Public Shared Property P(b As B) As Object
Get
Return Nothing
End Get
Set(value As Object)
End Set
End Property
End Class
Public Class A
End Class
Public Class B
End Class
";
var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes);
var source2 =
@"class D : C
{
static void Main()
{
}
void M()
{
object o;
o = P[null];
P[null] = o;
o = this.P[null];
base.P[null] = o;
o = D.P[null]; // C# does not support static indexed properties
D.P[null] = o; // C# does not support static indexed properties
}
}";
CreateCompilationWithoutBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
// (13,13): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// o = D.P[null];
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(13, 13),
// (14,9): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// D.P[null] = o;
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(14, 9)
);
CreateCompilationWithBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
// (13,13): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// o = D.P[null];
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(13, 13),
// (14,9): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
// D.P[null] = o;
Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(14, 9)
);
}
[Fact]
public void TestAmbiguous01()
{
// test semantic model in the face of ambiguities even when there are static/instance violations
var source =
@"class Program
{
public static void Main()
{
Program p = null;
Program.M(null); // two static candidates
p.M(null); // two instance candidates
M(null); // two static candidates
}
void Q()
{
Program Program = null;
M(null); // four candidates
Program.M(null); // four candidates
}
public static void M(A a) => throw null;
public void M(B b) => throw null;
public static void M(C c) => throw null;
public void M(D d) => throw null;
}
class A {}
class B {}
class C {}
class D {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 17),
// (7,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// p.M(null); // two instance candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(7, 11),
// (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(8, 9),
// (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(13, 9),
// (14,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(14, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(C)'
// Program.M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(C)").WithLocation(6, 17),
// (7,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(B)' and 'Program.M(D)'
// p.M(null); // two instance candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(B)", "Program.M(D)").WithLocation(7, 11),
// (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(C)'
// M(null); // two static candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(C)").WithLocation(8, 9),
// (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(13, 9),
// (14,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
// Program.M(null); // four candidates
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(14, 17)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(5, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[1].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[2].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[3].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
symbolInfo = model.GetSymbolInfo(invocations[4].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
[Fact]
public void TestAmbiguous02()
{
// test semantic model in the face of ambiguities even when there are constraint violations
var source =
@"class Program
{
public static void Main()
{
M(1, null);
}
public static void M<T>(T t, A a) where T : Constraint => throw null;
public static void M<T>(T t, B b) => throw null;
public static void M<T>(T t, C c) where T : Constraint => throw null;
public static void M<T>(T t, D d) => throw null;
}
class A {}
class B {}
class C {}
class D {}
class Constraint {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, A)' and 'Program.M<T>(T, B)'
// M(1, null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, A)", "Program.M<T>(T, B)").WithLocation(5, 9)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, D)'
// M(1, null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, D)").WithLocation(5, 9)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(1, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void Program.M<System.Int32>(System.Int32 t, D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
[Fact]
public void TestAmbiguous03()
{
// test semantic model in the face of ambiguities even when there are constraint violations
var source =
@"class Program
{
public static void Main()
{
1.M(null);
}
}
public class A {}
public class B {}
public class C {}
public class D {}
public class Constraint {}
public static class Extensions
{
public static void M<T>(this T t, A a) where T : Constraint => throw null;
public static void M<T>(this T t, B b) => throw null;
public static void M<T>(this T t, C c) where T : Constraint => throw null;
public static void M<T>(this T t, D d) => throw null;
}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,11): error CS0121: The call is ambiguous between the following methods or properties: 'Extensions.M<T>(T, A)' and 'Extensions.M<T>(T, B)'
// 1.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Extensions.M<T>(T, A)", "Extensions.M<T>(T, B)").WithLocation(5, 11)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,11): error CS0121: The call is ambiguous between the following methods or properties: 'Extensions.M<T>(T, B)' and 'Extensions.M<T>(T, D)'
// 1.M(null);
Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Extensions.M<T>(T, B)", "Extensions.M<T>(T, D)").WithLocation(5, 11)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(1, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("void System.Int32.M<System.Int32>(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("void System.Int32.M<System.Int32>(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("void System.Int32.M<System.Int32>(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("void System.Int32.M<System.Int32>(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
[Fact]
public void TestAmbiguous04()
{
// test semantic model in the face of ambiguities even when there are return type mismatches
var source =
@"class Program
{
public static void Main()
{
Invoked(Argument);
}
public static void Invoked(Delegate d)
{
}
public delegate A Delegate(IZ c);
static B Argument(IQ x) => null;
static D Argument(IW x) => null;
static C Argument(IX x) => null;
static D Argument(IY x) => null;
}
class A {} class B: A {} class C: A {}
class D {}
interface IQ {}
interface IW {}
interface IX {}
interface IY {}
interface IZ: IQ, IW, IX, IY {}
";
CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.Argument(IQ)' and 'Program.Argument(IW)'
// Invoked(Argument);
Diagnostic(ErrorCode.ERR_AmbigCall, "Argument").WithArguments("Program.Argument(IQ)", "Program.Argument(IW)").WithLocation(5, 17)
);
var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.Argument(IQ)' and 'Program.Argument(IX)'
// Invoked(Argument);
Diagnostic(ErrorCode.ERR_AmbigCall, "Argument").WithArguments("Program.Argument(IQ)", "Program.Argument(IX)").WithLocation(5, 17)
);
var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Assert.Equal(1, invocations.Length);
var symbolInfo = model.GetSymbolInfo(invocations[0].ArgumentList.Arguments[0].Expression);
Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
Assert.Equal("B Program.Argument(IQ x)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
Assert.Equal("D Program.Argument(IW x)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
Assert.Equal("C Program.Argument(IX x)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
Assert.Equal("D Program.Argument(IY x)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Features/Core/Portable/Workspace/BackgroundCompiler.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Host
{
internal sealed class BackgroundCompiler : IDisposable
{
private Workspace _workspace;
private readonly IDocumentTrackingService _documentTrackingService;
private readonly TaskQueue _taskQueue;
[SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Used to keep a strong reference to the built compilations so they are not GC'd")]
private Compilation?[]? _mostRecentCompilations;
private readonly object _buildGate = new();
private CancellationTokenSource _cancellationSource;
public BackgroundCompiler(Workspace workspace)
{
_workspace = workspace;
_documentTrackingService = _workspace.Services.GetRequiredService<IDocumentTrackingService>();
// make a scheduler that runs on the thread pool
var listenerProvider = workspace.Services.GetRequiredService<IWorkspaceAsynchronousOperationListenerProvider>();
_taskQueue = new TaskQueue(listenerProvider.GetListener(), TaskScheduler.Default);
_cancellationSource = new CancellationTokenSource();
_workspace.WorkspaceChanged += OnWorkspaceChanged;
_workspace.DocumentOpened += OnDocumentOpened;
_workspace.DocumentClosed += OnDocumentClosed;
}
public void Dispose()
{
if (_workspace != null)
{
CancelBuild(releasePreviousCompilations: true);
_workspace.DocumentClosed -= OnDocumentClosed;
_workspace.DocumentOpened -= OnDocumentOpened;
_workspace.WorkspaceChanged -= OnWorkspaceChanged;
_workspace = null!;
}
}
private void OnDocumentOpened(object? sender, DocumentEventArgs args)
=> Rebuild(args.Document.Project.Solution, args.Document.Project.Id);
private void OnDocumentClosed(object? sender, DocumentEventArgs args)
=> Rebuild(args.Document.Project.Solution, args.Document.Project.Id);
private void OnWorkspaceChanged(object? sender, WorkspaceChangeEventArgs args)
{
switch (args.Kind)
{
case WorkspaceChangeKind.SolutionCleared:
case WorkspaceChangeKind.SolutionAdded:
case WorkspaceChangeKind.SolutionRemoved:
CancelBuild(releasePreviousCompilations: true);
break;
case WorkspaceChangeKind.SolutionChanged:
case WorkspaceChangeKind.ProjectRemoved:
if (args.NewSolution.ProjectIds.Count == 0)
{
// Close solution no longer triggers a SolutionRemoved event,
// so we need to make an explicitly check for ProjectRemoved event.
CancelBuild(releasePreviousCompilations: true);
}
else
{
Rebuild(args.NewSolution);
}
break;
default:
Rebuild(args.NewSolution, args.ProjectId);
break;
}
}
private void Rebuild(Solution solution, ProjectId? initialProject = null)
{
lock (_buildGate)
{
// Keep the previous compilations around so that we can incrementally
// build the current compilations without rebuilding the entire DeclarationTable
CancelBuild(releasePreviousCompilations: false);
var allOpenProjects = _workspace.GetOpenDocumentIds().Select(d => d.ProjectId).ToSet();
var activeProject = _documentTrackingService.TryGetActiveDocument()?.ProjectId;
// don't even get started if there is nothing to do
if (allOpenProjects.Count > 0)
{
_ = BuildCompilationsAsync(solution, initialProject, allOpenProjects, activeProject);
}
}
}
private void CancelBuild(bool releasePreviousCompilations)
{
lock (_buildGate)
{
_cancellationSource.Cancel();
_cancellationSource = new CancellationTokenSource();
if (releasePreviousCompilations)
{
_mostRecentCompilations = null;
}
}
}
private Task BuildCompilationsAsync(
Solution solution,
ProjectId? initialProject,
ISet<ProjectId> allOpenProjects,
ProjectId? activeProject)
{
var cancellationToken = _cancellationSource.Token;
return _taskQueue.ScheduleTask(
"BackgroundCompiler.BuildCompilationsAsync",
() => BuildCompilationsAsync(solution, initialProject, allOpenProjects, activeProject, cancellationToken),
cancellationToken);
}
private Task BuildCompilationsAsync(
Solution solution,
ProjectId? initialProject,
ISet<ProjectId> projectsToBuild,
ProjectId? activeProject,
CancellationToken cancellationToken)
{
var allProjectIds = new List<ProjectId>();
if (initialProject != null)
{
allProjectIds.Add(initialProject);
}
allProjectIds.AddRange(projectsToBuild.Where(p => p != initialProject));
var logger = Logger.LogBlock(FunctionId.BackgroundCompiler_BuildCompilationsAsync, cancellationToken);
// Skip performing any background compilation for projects where user has explicitly
// set the background analysis scope to only analyze active files.
var compilationTasks = allProjectIds
.Select(solution.GetProject)
.Select(async p =>
{
if (p is null)
return null;
if (SolutionCrawlerOptions.GetBackgroundAnalysisScope(p) == BackgroundAnalysisScope.ActiveFile
&& p.Id != activeProject)
{
// For open files with Active File analysis scope, only build the compilation if the project is
// active.
return null;
}
return await p.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
})
.ToArray();
return Task.WhenAll(compilationTasks).SafeContinueWith(t =>
{
logger.Dispose();
if (t.Status == TaskStatus.RanToCompletion)
{
lock (_buildGate)
{
if (!cancellationToken.IsCancellationRequested)
{
_mostRecentCompilations = t.Result;
}
}
}
},
CancellationToken.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Host
{
internal sealed class BackgroundCompiler : IDisposable
{
private Workspace _workspace;
private readonly IDocumentTrackingService _documentTrackingService;
private readonly TaskQueue _taskQueue;
[SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Used to keep a strong reference to the built compilations so they are not GC'd")]
private Compilation?[]? _mostRecentCompilations;
private readonly object _buildGate = new();
private CancellationTokenSource _cancellationSource;
public BackgroundCompiler(Workspace workspace)
{
_workspace = workspace;
_documentTrackingService = _workspace.Services.GetRequiredService<IDocumentTrackingService>();
// make a scheduler that runs on the thread pool
var listenerProvider = workspace.Services.GetRequiredService<IWorkspaceAsynchronousOperationListenerProvider>();
_taskQueue = new TaskQueue(listenerProvider.GetListener(), TaskScheduler.Default);
_cancellationSource = new CancellationTokenSource();
_workspace.WorkspaceChanged += OnWorkspaceChanged;
_workspace.DocumentOpened += OnDocumentOpened;
_workspace.DocumentClosed += OnDocumentClosed;
}
public void Dispose()
{
if (_workspace != null)
{
CancelBuild(releasePreviousCompilations: true);
_workspace.DocumentClosed -= OnDocumentClosed;
_workspace.DocumentOpened -= OnDocumentOpened;
_workspace.WorkspaceChanged -= OnWorkspaceChanged;
_workspace = null!;
}
}
private void OnDocumentOpened(object? sender, DocumentEventArgs args)
=> Rebuild(args.Document.Project.Solution, args.Document.Project.Id);
private void OnDocumentClosed(object? sender, DocumentEventArgs args)
=> Rebuild(args.Document.Project.Solution, args.Document.Project.Id);
private void OnWorkspaceChanged(object? sender, WorkspaceChangeEventArgs args)
{
switch (args.Kind)
{
case WorkspaceChangeKind.SolutionCleared:
case WorkspaceChangeKind.SolutionAdded:
case WorkspaceChangeKind.SolutionRemoved:
CancelBuild(releasePreviousCompilations: true);
break;
case WorkspaceChangeKind.SolutionChanged:
case WorkspaceChangeKind.ProjectRemoved:
if (args.NewSolution.ProjectIds.Count == 0)
{
// Close solution no longer triggers a SolutionRemoved event,
// so we need to make an explicitly check for ProjectRemoved event.
CancelBuild(releasePreviousCompilations: true);
}
else
{
Rebuild(args.NewSolution);
}
break;
default:
Rebuild(args.NewSolution, args.ProjectId);
break;
}
}
private void Rebuild(Solution solution, ProjectId? initialProject = null)
{
lock (_buildGate)
{
// Keep the previous compilations around so that we can incrementally
// build the current compilations without rebuilding the entire DeclarationTable
CancelBuild(releasePreviousCompilations: false);
var allOpenProjects = _workspace.GetOpenDocumentIds().Select(d => d.ProjectId).ToSet();
var activeProject = _documentTrackingService.TryGetActiveDocument()?.ProjectId;
// don't even get started if there is nothing to do
if (allOpenProjects.Count > 0)
{
_ = BuildCompilationsAsync(solution, initialProject, allOpenProjects, activeProject);
}
}
}
private void CancelBuild(bool releasePreviousCompilations)
{
lock (_buildGate)
{
_cancellationSource.Cancel();
_cancellationSource = new CancellationTokenSource();
if (releasePreviousCompilations)
{
_mostRecentCompilations = null;
}
}
}
private Task BuildCompilationsAsync(
Solution solution,
ProjectId? initialProject,
ISet<ProjectId> allOpenProjects,
ProjectId? activeProject)
{
var cancellationToken = _cancellationSource.Token;
return _taskQueue.ScheduleTask(
"BackgroundCompiler.BuildCompilationsAsync",
() => BuildCompilationsAsync(solution, initialProject, allOpenProjects, activeProject, cancellationToken),
cancellationToken);
}
private Task BuildCompilationsAsync(
Solution solution,
ProjectId? initialProject,
ISet<ProjectId> projectsToBuild,
ProjectId? activeProject,
CancellationToken cancellationToken)
{
var allProjectIds = new List<ProjectId>();
if (initialProject != null)
{
allProjectIds.Add(initialProject);
}
allProjectIds.AddRange(projectsToBuild.Where(p => p != initialProject));
var logger = Logger.LogBlock(FunctionId.BackgroundCompiler_BuildCompilationsAsync, cancellationToken);
// Skip performing any background compilation for projects where user has explicitly
// set the background analysis scope to only analyze active files.
var compilationTasks = allProjectIds
.Select(solution.GetProject)
.Select(async p =>
{
if (p is null)
return null;
if (SolutionCrawlerOptions.GetBackgroundAnalysisScope(p) == BackgroundAnalysisScope.ActiveFile
&& p.Id != activeProject)
{
// For open files with Active File analysis scope, only build the compilation if the project is
// active.
return null;
}
return await p.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
})
.ToArray();
return Task.WhenAll(compilationTasks).SafeContinueWith(t =>
{
logger.Dispose();
if (t.Status == TaskStatus.RanToCompletion)
{
lock (_buildGate)
{
if (!cancellationToken.IsCancellationRequested)
{
_mostRecentCompilations = t.Result;
}
}
}
},
CancellationToken.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerReference.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// Represents an analyzer assembly reference that contains diagnostic analyzers.
/// </summary>
/// <remarks>
/// Represents a logical location of the analyzer reference, not the content of the reference.
/// The content might change in time. A snapshot is taken when the compiler queries the reference for its analyzers.
/// </remarks>
public abstract class AnalyzerReference
{
protected AnalyzerReference()
{
}
/// <summary>
/// Full path describing the location of the analyzer reference, or null if the reference has no location.
/// </summary>
public abstract string? FullPath { get; }
/// <summary>
/// Path or name used in error messages to identity the reference.
/// </summary>
/// <remarks>
/// Should not be null.
/// </remarks>
public virtual string Display
{
get { return string.Empty; }
}
/// <summary>
/// A unique identifier for this analyzer reference.
/// </summary>
/// <remarks>
/// Should not be null.
/// Note that this and <see cref="FullPath"/> serve different purposes. An analyzer reference may not
/// have a path, but it always has an ID. Further, two analyzer references with different paths may
/// represent two copies of the same analyzer, in which case the IDs should also be the same.
/// </remarks>
public abstract object Id { get; }
/// <summary>
/// Gets all the diagnostic analyzers defined in this assembly reference, irrespective of the language supported by the analyzer.
/// Use this method only if you need all the analyzers defined in the assembly, without a language context.
/// In most instances, either the analyzer reference is associated with a project or is being queried for analyzers in a particular language context.
/// If so, use <see cref="GetAnalyzers(string)"/> method.
/// </summary>
public abstract ImmutableArray<DiagnosticAnalyzer> GetAnalyzersForAllLanguages();
/// <summary>
/// Gets all the diagnostic analyzers defined in this assembly reference for the given <paramref name="language"/>.
/// </summary>
/// <param name="language">Language name.</param>
public abstract ImmutableArray<DiagnosticAnalyzer> GetAnalyzers(string language);
/// <summary>
/// Gets all the source generators defined in this assembly reference.
/// </summary>
public virtual ImmutableArray<ISourceGenerator> GetGeneratorsForAllLanguages() => ImmutableArray<ISourceGenerator>.Empty;
[Obsolete("Use GetGenerators(string language) or GetGeneratorsForAllLanguages()")]
public virtual ImmutableArray<ISourceGenerator> GetGenerators() => ImmutableArray<ISourceGenerator>.Empty;
/// <summary>
/// Gets all the generators defined in this assembly reference for the given <paramref name="language"/>.
/// </summary>
/// <param name="language">Language name.</param>
public virtual ImmutableArray<ISourceGenerator> GetGenerators(string language) => ImmutableArray<ISourceGenerator>.Empty;
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// Represents an analyzer assembly reference that contains diagnostic analyzers.
/// </summary>
/// <remarks>
/// Represents a logical location of the analyzer reference, not the content of the reference.
/// The content might change in time. A snapshot is taken when the compiler queries the reference for its analyzers.
/// </remarks>
public abstract class AnalyzerReference
{
protected AnalyzerReference()
{
}
/// <summary>
/// Full path describing the location of the analyzer reference, or null if the reference has no location.
/// </summary>
public abstract string? FullPath { get; }
/// <summary>
/// Path or name used in error messages to identity the reference.
/// </summary>
/// <remarks>
/// Should not be null.
/// </remarks>
public virtual string Display
{
get { return string.Empty; }
}
/// <summary>
/// A unique identifier for this analyzer reference.
/// </summary>
/// <remarks>
/// Should not be null.
/// Note that this and <see cref="FullPath"/> serve different purposes. An analyzer reference may not
/// have a path, but it always has an ID. Further, two analyzer references with different paths may
/// represent two copies of the same analyzer, in which case the IDs should also be the same.
/// </remarks>
public abstract object Id { get; }
/// <summary>
/// Gets all the diagnostic analyzers defined in this assembly reference, irrespective of the language supported by the analyzer.
/// Use this method only if you need all the analyzers defined in the assembly, without a language context.
/// In most instances, either the analyzer reference is associated with a project or is being queried for analyzers in a particular language context.
/// If so, use <see cref="GetAnalyzers(string)"/> method.
/// </summary>
public abstract ImmutableArray<DiagnosticAnalyzer> GetAnalyzersForAllLanguages();
/// <summary>
/// Gets all the diagnostic analyzers defined in this assembly reference for the given <paramref name="language"/>.
/// </summary>
/// <param name="language">Language name.</param>
public abstract ImmutableArray<DiagnosticAnalyzer> GetAnalyzers(string language);
/// <summary>
/// Gets all the source generators defined in this assembly reference.
/// </summary>
public virtual ImmutableArray<ISourceGenerator> GetGeneratorsForAllLanguages() => ImmutableArray<ISourceGenerator>.Empty;
[Obsolete("Use GetGenerators(string language) or GetGeneratorsForAllLanguages()")]
public virtual ImmutableArray<ISourceGenerator> GetGenerators() => ImmutableArray<ISourceGenerator>.Empty;
/// <summary>
/// Gets all the generators defined in this assembly reference for the given <paramref name="language"/>.
/// </summary>
/// <param name="language">Language name.</param>
public virtual ImmutableArray<ISourceGenerator> GetGenerators(string language) => ImmutableArray<ISourceGenerator>.Empty;
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Features/CSharp/Portable/Completion/CompletionProviders/AttributeNamedParameterCompletionProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers
{
[ExportCompletionProvider(nameof(AttributeNamedParameterCompletionProvider), LanguageNames.CSharp)]
[ExtensionOrder(After = nameof(FirstBuiltInCompletionProvider))]
[Shared]
internal class AttributeNamedParameterCompletionProvider : LSPCompletionProvider
{
private const string EqualsString = "=";
private const string SpaceEqualsString = " =";
private const string ColonString = ":";
private static readonly CompletionItemRules _spaceItemFilterRule = CompletionItemRules.Default.WithFilterCharacterRule(
CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, ' '));
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public AttributeNamedParameterCompletionProvider()
{
}
public override bool IsInsertionTrigger(SourceText text, int characterPosition, OptionSet options)
=> CompletionUtilities.IsTriggerCharacter(text, characterPosition, options);
public override ImmutableHashSet<char> TriggerCharacters { get; } = CompletionUtilities.CommonTriggerCharacters;
public override async Task ProvideCompletionsAsync(CompletionContext context)
{
try
{
var document = context.Document;
var position = context.Position;
var cancellationToken = context.CancellationToken;
var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
if (syntaxTree.IsInNonUserCode(position, cancellationToken))
{
return;
}
var token = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken);
token = token.GetPreviousTokenIfTouchingWord(position);
if (!token.IsKind(SyntaxKind.OpenParenToken, SyntaxKind.CommaToken))
{
return;
}
if (token.Parent.Parent is not AttributeSyntax attributeSyntax || token.Parent is not AttributeArgumentListSyntax attributeArgumentList)
{
return;
}
if (IsAfterNameColonArgument(token) || IsAfterNameEqualsArgument(token))
{
context.IsExclusive = true;
}
// We actually want to collect two sets of named parameters to present the user. The
// normal named parameters that come from the attribute constructors. These will be
// presented like "goo:". And also the named parameters that come from the writable
// fields/properties in the attribute. These will be presented like "bar =".
var existingNamedParameters = GetExistingNamedParameters(attributeArgumentList, position);
var workspace = document.Project.Solution.Workspace;
var semanticModel = await document.ReuseExistingSpeculativeModelAsync(attributeSyntax, cancellationToken).ConfigureAwait(false);
var nameColonItems = await GetNameColonItemsAsync(context, semanticModel, token, attributeSyntax, existingNamedParameters).ConfigureAwait(false);
var nameEqualsItems = await GetNameEqualsItemsAsync(context, semanticModel, token, attributeSyntax, existingNamedParameters).ConfigureAwait(false);
context.AddItems(nameEqualsItems);
// If we're after a name= parameter, then we only want to show name= parameters.
// Otherwise, show name: parameters too.
if (!IsAfterNameEqualsArgument(token))
{
context.AddItems(nameColonItems);
}
}
catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e))
{
// nop
}
}
private static bool IsAfterNameColonArgument(SyntaxToken token)
{
if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList)
{
foreach (var item in argumentList.Arguments.GetWithSeparators())
{
if (item.IsToken && item.AsToken() == token)
{
return false;
}
if (item.IsNode)
{
var node = item.AsNode() as AttributeArgumentSyntax;
if (node.NameColon != null)
{
return true;
}
}
}
}
return false;
}
private static bool IsAfterNameEqualsArgument(SyntaxToken token)
{
if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList)
{
foreach (var item in argumentList.Arguments.GetWithSeparators())
{
if (item.IsToken && item.AsToken() == token)
{
return false;
}
if (item.IsNode)
{
var node = item.AsNode() as AttributeArgumentSyntax;
if (node.NameEquals != null)
{
return true;
}
}
}
}
return false;
}
private static async Task<ImmutableArray<CompletionItem>> GetNameEqualsItemsAsync(
CompletionContext context, SemanticModel semanticModel,
SyntaxToken token, AttributeSyntax attributeSyntax, ISet<string> existingNamedParameters)
{
var attributeNamedParameters = GetAttributeNamedParameters(semanticModel, context.Position, attributeSyntax, context.CancellationToken);
var unspecifiedNamedParameters = attributeNamedParameters.Where(p => !existingNamedParameters.Contains(p.Name));
var text = await semanticModel.SyntaxTree.GetTextAsync(context.CancellationToken).ConfigureAwait(false);
var q = from p in attributeNamedParameters
where !existingNamedParameters.Contains(p.Name)
select SymbolCompletionItem.CreateWithSymbolId(
displayText: p.Name.ToIdentifierToken().ToString(),
displayTextSuffix: SpaceEqualsString,
insertionText: null,
symbols: ImmutableArray.Create(p),
contextPosition: token.SpanStart,
sortText: p.Name,
rules: _spaceItemFilterRule);
return q.ToImmutableArray();
}
private static async Task<IEnumerable<CompletionItem>> GetNameColonItemsAsync(
CompletionContext context, SemanticModel semanticModel, SyntaxToken token, AttributeSyntax attributeSyntax, ISet<string> existingNamedParameters)
{
var parameterLists = GetParameterLists(semanticModel, context.Position, attributeSyntax, context.CancellationToken);
parameterLists = parameterLists.Where(pl => IsValid(pl, existingNamedParameters));
var text = await semanticModel.SyntaxTree.GetTextAsync(context.CancellationToken).ConfigureAwait(false);
return from pl in parameterLists
from p in pl
where !existingNamedParameters.Contains(p.Name)
select SymbolCompletionItem.CreateWithSymbolId(
displayText: p.Name.ToIdentifierToken().ToString(),
displayTextSuffix: ColonString,
insertionText: null,
symbols: ImmutableArray.Create(p),
contextPosition: token.SpanStart,
sortText: p.Name,
rules: CompletionItemRules.Default);
}
protected override Task<CompletionDescription> GetDescriptionWorkerAsync(Document document, CompletionItem item, CancellationToken cancellationToken)
=> SymbolCompletionItem.GetDescriptionAsync(item, document, cancellationToken);
private static bool IsValid(ImmutableArray<IParameterSymbol> parameterList, ISet<string> existingNamedParameters)
=> existingNamedParameters.Except(parameterList.Select(p => p.Name)).IsEmpty();
private static ISet<string> GetExistingNamedParameters(AttributeArgumentListSyntax argumentList, int position)
{
var existingArguments1 =
argumentList.Arguments.Where(a => a.Span.End <= position)
.Where(a => a.NameColon != null)
.Select(a => a.NameColon.Name.Identifier.ValueText);
var existingArguments2 =
argumentList.Arguments.Where(a => a.Span.End <= position)
.Where(a => a.NameEquals != null)
.Select(a => a.NameEquals.Name.Identifier.ValueText);
return existingArguments1.Concat(existingArguments2).ToSet();
}
private static IEnumerable<ImmutableArray<IParameterSymbol>> GetParameterLists(
SemanticModel semanticModel,
int position,
AttributeSyntax attribute,
CancellationToken cancellationToken)
{
var within = semanticModel.GetEnclosingNamedTypeOrAssembly(position, cancellationToken);
if (within != null && semanticModel.GetTypeInfo(attribute, cancellationToken).Type is INamedTypeSymbol attributeType)
{
return attributeType.InstanceConstructors.Where(c => c.IsAccessibleWithin(within))
.Select(c => c.Parameters);
}
return SpecializedCollections.EmptyEnumerable<ImmutableArray<IParameterSymbol>>();
}
private static IEnumerable<ISymbol> GetAttributeNamedParameters(
SemanticModel semanticModel,
int position,
AttributeSyntax attribute,
CancellationToken cancellationToken)
{
var within = semanticModel.GetEnclosingNamedTypeOrAssembly(position, cancellationToken);
var attributeType = semanticModel.GetTypeInfo(attribute, cancellationToken).Type as INamedTypeSymbol;
return attributeType.GetAttributeNamedParameters(semanticModel.Compilation, within);
}
protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken)
=> Task.FromResult(GetTextChange(selectedItem, ch));
private static TextChange? GetTextChange(CompletionItem selectedItem, char? ch)
{
var displayText = selectedItem.DisplayText + selectedItem.DisplayTextSuffix;
if (ch != null)
{
// If user types a space, do not complete the " =" (space and equals) at the end of a named parameter. The
// typed space character will be passed through to the editor, and they can then type the '='.
if (ch == ' ' && displayText.EndsWith(SpaceEqualsString, StringComparison.Ordinal))
{
return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - SpaceEqualsString.Length));
}
// If the user types '=', do not complete the '=' at the end of the named parameter because the typed '='
// will be passed through to the editor.
if (ch == '=' && displayText.EndsWith(EqualsString, StringComparison.Ordinal))
{
return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - EqualsString.Length));
}
// If the user types ':', do not complete the ':' at the end of the named parameter because the typed ':'
// will be passed through to the editor.
if (ch == ':' && displayText.EndsWith(ColonString, StringComparison.Ordinal))
{
return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - ColonString.Length));
}
}
return new TextChange(selectedItem.Span, displayText);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers
{
[ExportCompletionProvider(nameof(AttributeNamedParameterCompletionProvider), LanguageNames.CSharp)]
[ExtensionOrder(After = nameof(FirstBuiltInCompletionProvider))]
[Shared]
internal class AttributeNamedParameterCompletionProvider : LSPCompletionProvider
{
private const string EqualsString = "=";
private const string SpaceEqualsString = " =";
private const string ColonString = ":";
private static readonly CompletionItemRules _spaceItemFilterRule = CompletionItemRules.Default.WithFilterCharacterRule(
CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, ' '));
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public AttributeNamedParameterCompletionProvider()
{
}
public override bool IsInsertionTrigger(SourceText text, int characterPosition, OptionSet options)
=> CompletionUtilities.IsTriggerCharacter(text, characterPosition, options);
public override ImmutableHashSet<char> TriggerCharacters { get; } = CompletionUtilities.CommonTriggerCharacters;
public override async Task ProvideCompletionsAsync(CompletionContext context)
{
try
{
var document = context.Document;
var position = context.Position;
var cancellationToken = context.CancellationToken;
var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
if (syntaxTree.IsInNonUserCode(position, cancellationToken))
{
return;
}
var token = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken);
token = token.GetPreviousTokenIfTouchingWord(position);
if (!token.IsKind(SyntaxKind.OpenParenToken, SyntaxKind.CommaToken))
{
return;
}
if (token.Parent.Parent is not AttributeSyntax attributeSyntax || token.Parent is not AttributeArgumentListSyntax attributeArgumentList)
{
return;
}
if (IsAfterNameColonArgument(token) || IsAfterNameEqualsArgument(token))
{
context.IsExclusive = true;
}
// We actually want to collect two sets of named parameters to present the user. The
// normal named parameters that come from the attribute constructors. These will be
// presented like "goo:". And also the named parameters that come from the writable
// fields/properties in the attribute. These will be presented like "bar =".
var existingNamedParameters = GetExistingNamedParameters(attributeArgumentList, position);
var workspace = document.Project.Solution.Workspace;
var semanticModel = await document.ReuseExistingSpeculativeModelAsync(attributeSyntax, cancellationToken).ConfigureAwait(false);
var nameColonItems = await GetNameColonItemsAsync(context, semanticModel, token, attributeSyntax, existingNamedParameters).ConfigureAwait(false);
var nameEqualsItems = await GetNameEqualsItemsAsync(context, semanticModel, token, attributeSyntax, existingNamedParameters).ConfigureAwait(false);
context.AddItems(nameEqualsItems);
// If we're after a name= parameter, then we only want to show name= parameters.
// Otherwise, show name: parameters too.
if (!IsAfterNameEqualsArgument(token))
{
context.AddItems(nameColonItems);
}
}
catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e))
{
// nop
}
}
private static bool IsAfterNameColonArgument(SyntaxToken token)
{
if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList)
{
foreach (var item in argumentList.Arguments.GetWithSeparators())
{
if (item.IsToken && item.AsToken() == token)
{
return false;
}
if (item.IsNode)
{
var node = item.AsNode() as AttributeArgumentSyntax;
if (node.NameColon != null)
{
return true;
}
}
}
}
return false;
}
private static bool IsAfterNameEqualsArgument(SyntaxToken token)
{
if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList)
{
foreach (var item in argumentList.Arguments.GetWithSeparators())
{
if (item.IsToken && item.AsToken() == token)
{
return false;
}
if (item.IsNode)
{
var node = item.AsNode() as AttributeArgumentSyntax;
if (node.NameEquals != null)
{
return true;
}
}
}
}
return false;
}
private static async Task<ImmutableArray<CompletionItem>> GetNameEqualsItemsAsync(
CompletionContext context, SemanticModel semanticModel,
SyntaxToken token, AttributeSyntax attributeSyntax, ISet<string> existingNamedParameters)
{
var attributeNamedParameters = GetAttributeNamedParameters(semanticModel, context.Position, attributeSyntax, context.CancellationToken);
var unspecifiedNamedParameters = attributeNamedParameters.Where(p => !existingNamedParameters.Contains(p.Name));
var text = await semanticModel.SyntaxTree.GetTextAsync(context.CancellationToken).ConfigureAwait(false);
var q = from p in attributeNamedParameters
where !existingNamedParameters.Contains(p.Name)
select SymbolCompletionItem.CreateWithSymbolId(
displayText: p.Name.ToIdentifierToken().ToString(),
displayTextSuffix: SpaceEqualsString,
insertionText: null,
symbols: ImmutableArray.Create(p),
contextPosition: token.SpanStart,
sortText: p.Name,
rules: _spaceItemFilterRule);
return q.ToImmutableArray();
}
private static async Task<IEnumerable<CompletionItem>> GetNameColonItemsAsync(
CompletionContext context, SemanticModel semanticModel, SyntaxToken token, AttributeSyntax attributeSyntax, ISet<string> existingNamedParameters)
{
var parameterLists = GetParameterLists(semanticModel, context.Position, attributeSyntax, context.CancellationToken);
parameterLists = parameterLists.Where(pl => IsValid(pl, existingNamedParameters));
var text = await semanticModel.SyntaxTree.GetTextAsync(context.CancellationToken).ConfigureAwait(false);
return from pl in parameterLists
from p in pl
where !existingNamedParameters.Contains(p.Name)
select SymbolCompletionItem.CreateWithSymbolId(
displayText: p.Name.ToIdentifierToken().ToString(),
displayTextSuffix: ColonString,
insertionText: null,
symbols: ImmutableArray.Create(p),
contextPosition: token.SpanStart,
sortText: p.Name,
rules: CompletionItemRules.Default);
}
protected override Task<CompletionDescription> GetDescriptionWorkerAsync(Document document, CompletionItem item, CancellationToken cancellationToken)
=> SymbolCompletionItem.GetDescriptionAsync(item, document, cancellationToken);
private static bool IsValid(ImmutableArray<IParameterSymbol> parameterList, ISet<string> existingNamedParameters)
=> existingNamedParameters.Except(parameterList.Select(p => p.Name)).IsEmpty();
private static ISet<string> GetExistingNamedParameters(AttributeArgumentListSyntax argumentList, int position)
{
var existingArguments1 =
argumentList.Arguments.Where(a => a.Span.End <= position)
.Where(a => a.NameColon != null)
.Select(a => a.NameColon.Name.Identifier.ValueText);
var existingArguments2 =
argumentList.Arguments.Where(a => a.Span.End <= position)
.Where(a => a.NameEquals != null)
.Select(a => a.NameEquals.Name.Identifier.ValueText);
return existingArguments1.Concat(existingArguments2).ToSet();
}
private static IEnumerable<ImmutableArray<IParameterSymbol>> GetParameterLists(
SemanticModel semanticModel,
int position,
AttributeSyntax attribute,
CancellationToken cancellationToken)
{
var within = semanticModel.GetEnclosingNamedTypeOrAssembly(position, cancellationToken);
if (within != null && semanticModel.GetTypeInfo(attribute, cancellationToken).Type is INamedTypeSymbol attributeType)
{
return attributeType.InstanceConstructors.Where(c => c.IsAccessibleWithin(within))
.Select(c => c.Parameters);
}
return SpecializedCollections.EmptyEnumerable<ImmutableArray<IParameterSymbol>>();
}
private static IEnumerable<ISymbol> GetAttributeNamedParameters(
SemanticModel semanticModel,
int position,
AttributeSyntax attribute,
CancellationToken cancellationToken)
{
var within = semanticModel.GetEnclosingNamedTypeOrAssembly(position, cancellationToken);
var attributeType = semanticModel.GetTypeInfo(attribute, cancellationToken).Type as INamedTypeSymbol;
return attributeType.GetAttributeNamedParameters(semanticModel.Compilation, within);
}
protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken)
=> Task.FromResult(GetTextChange(selectedItem, ch));
private static TextChange? GetTextChange(CompletionItem selectedItem, char? ch)
{
var displayText = selectedItem.DisplayText + selectedItem.DisplayTextSuffix;
if (ch != null)
{
// If user types a space, do not complete the " =" (space and equals) at the end of a named parameter. The
// typed space character will be passed through to the editor, and they can then type the '='.
if (ch == ' ' && displayText.EndsWith(SpaceEqualsString, StringComparison.Ordinal))
{
return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - SpaceEqualsString.Length));
}
// If the user types '=', do not complete the '=' at the end of the named parameter because the typed '='
// will be passed through to the editor.
if (ch == '=' && displayText.EndsWith(EqualsString, StringComparison.Ordinal))
{
return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - EqualsString.Length));
}
// If the user types ':', do not complete the ':' at the end of the named parameter because the typed ':'
// will be passed through to the editor.
if (ch == ':' && displayText.EndsWith(ColonString, StringComparison.Ordinal))
{
return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - ColonString.Length));
}
}
return new TextChange(selectedItem.Span, displayText);
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Workspaces/Core/Portable/PublicAPI.Shipped.txt | abstract Microsoft.CodeAnalysis.CodeActions.CodeAction.Title.get -> string
abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.GetOptions(System.Threading.CancellationToken cancellationToken) -> object
abstract Microsoft.CodeAnalysis.CodeActions.PreviewOperation.GetPreviewAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<object>
abstract Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.FixableDiagnosticIds.get -> System.Collections.Immutable.ImmutableArray<string>
abstract Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.RegisterCodeFixesAsync(Microsoft.CodeAnalysis.CodeFixes.CodeFixContext context) -> System.Threading.Tasks.Task
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.GetAllDiagnosticsAsync(Microsoft.CodeAnalysis.Project project, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.GetDocumentDiagnosticsAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.GetProjectDiagnosticsAsync(Microsoft.CodeAnalysis.Project project, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetFixAsync(Microsoft.CodeAnalysis.CodeFixes.FixAllContext fixAllContext) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.CodeActions.CodeAction>
abstract Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.ComputeRefactoringsAsync(Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext context) -> System.Threading.Tasks.Task
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetChildren(TNode node) -> System.Collections.Generic.IEnumerable<TNode>
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetDescendants(TNode node) -> System.Collections.Generic.IEnumerable<TNode>
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetDistance(TNode oldNode, TNode newNode) -> double
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetLabel(TNode node) -> int
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetSpan(TNode node) -> Microsoft.CodeAnalysis.Text.TextSpan
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.LabelCount.get -> int
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TiedToAncestor(int label) -> int
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TreesEqual(TNode oldNode, TNode newNode) -> bool
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TryGetParent(TNode node, out TNode parent) -> bool
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.ValuesEqual(TNode oldNode, TNode newNode) -> bool
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddBaseType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode baseType) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddEventHandler(Microsoft.CodeAnalysis.SyntaxNode event, Microsoft.CodeAnalysis.SyntaxNode handler) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddInterfaceType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AliasImportDeclaration(string aliasIdentifierName, Microsoft.CodeAnalysis.SyntaxNode name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Argument(string name, Microsoft.CodeAnalysis.RefKind refKind, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ArrayCreationExpression(Microsoft.CodeAnalysis.SyntaxNode elementType, Microsoft.CodeAnalysis.SyntaxNode size) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ArrayCreationExpression(Microsoft.CodeAnalysis.SyntaxNode elementType, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> elements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ArrayTypeExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPrivateInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType, string interfaceMemberName) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPublicInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType, string interfaceMemberName) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AssignmentStatement(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(Microsoft.CodeAnalysis.SyntaxNode name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AttributeArgument(string name, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AwaitExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BaseExpression() -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BitwiseAndExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BitwiseNotExpression(Microsoft.CodeAnalysis.SyntaxNode operand) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BitwiseOrExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CastExpression(Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CatchClause(Microsoft.CodeAnalysis.SyntaxNode type, string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ClassDeclaration(string name, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), Microsoft.CodeAnalysis.SyntaxNode baseType = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> interfaceTypes = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ClearTrivia<TNode>(TNode node) -> TNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CoalesceExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CompilationUnit(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConditionalAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode whenNotNull) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConditionalExpression(Microsoft.CodeAnalysis.SyntaxNode condition, Microsoft.CodeAnalysis.SyntaxNode whenTrue, Microsoft.CodeAnalysis.SyntaxNode whenFalse) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConstructorDeclaration(string containingTypeName = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> baseConstructorArguments = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConvertExpression(Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CustomEventDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> addAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> removeAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultExpression(Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultSwitchSection(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DelegateDeclaration(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.SyntaxNode returnType = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers)) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DivideExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementBindingExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EnumDeclaration(string name, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EnumMember(string name, Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EventDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers)) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ExitSwitchStatement() -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ExpressionStatement(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FieldDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), Microsoft.CodeAnalysis.SyntaxNode initializer = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessibility(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.Accessibility
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessors(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAttributeArguments(Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetBaseAndInterfaceTypes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetDeclarationKind(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.Editing.DeclarationKind
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetExpression(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetMembers(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetModifiers(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetName(Microsoft.CodeAnalysis.SyntaxNode declaration) -> string
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetParameters(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetSetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetStatements(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetType(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GreaterThanExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GreaterThanOrEqualExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IdentifierName(string identifier) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IfStatement(Microsoft.CodeAnalysis.SyntaxNode condition, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> trueStatements, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> falseStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IndexerDeclaration(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAccessors(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> accessors) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAttributeArguments(Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> imports) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> switchSections) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InterfaceDeclaration(string name, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> interfaceTypes = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InvocationExpression(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IsTypeExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LambdaParameter(string identifier, Microsoft.CodeAnalysis.SyntaxNode type = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LessThanExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LessThanOrEqualExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LiteralExpression(object value) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LocalDeclarationStatement(Microsoft.CodeAnalysis.SyntaxNode type, string identifier, Microsoft.CodeAnalysis.SyntaxNode initializer = null, bool isConst = false) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LockStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LogicalAndExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LogicalNotExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LogicalOrExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberBindingExpression(Microsoft.CodeAnalysis.SyntaxNode name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MethodDeclaration(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.SyntaxNode returnType = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ModuloExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MultiplyExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NameExpression(Microsoft.CodeAnalysis.INamespaceOrTypeSymbol namespaceOrTypeSymbol) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NameOfExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(Microsoft.CodeAnalysis.SyntaxNode name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceImportDeclaration(Microsoft.CodeAnalysis.SyntaxNode name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NegateExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NullableTypeExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.SyntaxNode namedType, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ParameterDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type = null, Microsoft.CodeAnalysis.SyntaxNode initializer = null, Microsoft.CodeAnalysis.RefKind refKind = Microsoft.CodeAnalysis.RefKind.None) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PropertyDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.QualifiedName(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReferenceEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReferenceNotEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveEventHandler(Microsoft.CodeAnalysis.SyntaxNode event, Microsoft.CodeAnalysis.SyntaxNode handler) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReturnStatement(Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.StructDeclaration(string name, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> interfaceTypes = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SubtractExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchSection(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> caseExpressions, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> sections) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ThisExpression() -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ThrowExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ThrowStatement(Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCastExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCatchStatement(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> tryStatements, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> catchClauses, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> finallyStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleElementExpression(Microsoft.CodeAnalysis.SyntaxNode type, string name = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypedConstantExpression(Microsoft.CodeAnalysis.TypedConstant value) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeExpression(Microsoft.CodeAnalysis.ITypeSymbol typeSymbol) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeExpression(Microsoft.CodeAnalysis.SpecialType specialType) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeOfExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.UsingStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.UsingStatement(Microsoft.CodeAnalysis.SyntaxNode type, string name, Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueNotEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WhileStatement(Microsoft.CodeAnalysis.SyntaxNode condition, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessibility(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Accessibility accessibility) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessorDeclarations(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> accessorDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithExpression(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithGetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithModifiers(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithName(Microsoft.CodeAnalysis.SyntaxNode declaration, string name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithSetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeArguments(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> types = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<string> typeParameters) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.GetService<TLanguageService>() -> TLanguageService
abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.Language.get -> string
abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.WorkspaceServices.get -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
abstract Microsoft.CodeAnalysis.Host.HostServices.CreateWorkspaceServices(Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.FindLanguageServices<TLanguageService>(Microsoft.CodeAnalysis.Host.HostWorkspaceServices.MetadataFilter filter) -> System.Collections.Generic.IEnumerable<TLanguageService>
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetService<TWorkspaceService>() -> TWorkspaceService
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.HostServices.get -> Microsoft.CodeAnalysis.Host.HostServices
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.Workspace.get -> Microsoft.CodeAnalysis.Workspace
abstract Microsoft.CodeAnalysis.Options.OptionSet.WithChangedOption(Microsoft.CodeAnalysis.Options.OptionKey optionAndLanguage, object value) -> Microsoft.CodeAnalysis.Options.OptionSet
abstract Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction.GetDescription(System.Globalization.CultureInfo culture = null) -> string
abstract Microsoft.CodeAnalysis.TextLoader.LoadTextAndVersionAsync(Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.DocumentId documentId, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.TextAndVersion>
abstract Microsoft.CodeAnalysis.XmlDocumentationProvider.GetSourceStream(System.Threading.CancellationToken cancellationToken) -> System.IO.Stream
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ClassName = "class name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Comment = "comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ConstantName = "constant name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ControlKeyword = "keyword - control" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.DelegateName = "delegate name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.EnumMemberName = "enum member name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.EnumName = "enum name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.EventName = "event name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ExcludedCode = "excluded code" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ExtensionMethodName = "extension method name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.FieldName = "field name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Identifier = "identifier" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.InterfaceName = "interface name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Keyword = "keyword" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.LabelName = "label name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.LocalName = "local name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.MethodName = "method name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ModuleName = "module name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.NamespaceName = "namespace name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.NumericLiteral = "number" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Operator = "operator" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.OperatorOverloaded = "operator - overloaded" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ParameterName = "parameter name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.PreprocessorKeyword = "preprocessor keyword" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.PreprocessorText = "preprocessor text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.PropertyName = "property name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Punctuation = "punctuation" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexAlternation = "regex - alternation" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexAnchor = "regex - anchor" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexCharacterClass = "regex - character class" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexComment = "regex - comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexGrouping = "regex - grouping" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexOtherEscape = "regex - other escape" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexQuantifier = "regex - quantifier" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexSelfEscapedCharacter = "regex - self escaped character" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexText = "regex - text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StaticSymbol = "static symbol" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StringEscapeCharacter = "string - escape character" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StringLiteral = "string" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StructName = "struct name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Text = "text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.TypeParameterName = "type parameter name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.VerbatimStringLiteral = "string - verbatim" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.WhiteSpace = "whitespace" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentAttributeName = "xml doc comment - attribute name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentAttributeQuotes = "xml doc comment - attribute quotes" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentAttributeValue = "xml doc comment - attribute value" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentCDataSection = "xml doc comment - cdata section" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentComment = "xml doc comment - comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentDelimiter = "xml doc comment - delimiter" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentEntityReference = "xml doc comment - entity reference" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentName = "xml doc comment - name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentProcessingInstruction = "xml doc comment - processing instruction" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentText = "xml doc comment - text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralAttributeName = "xml literal - attribute name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralAttributeQuotes = "xml literal - attribute quotes" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralAttributeValue = "xml literal - attribute value" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralCDataSection = "xml literal - cdata section" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralComment = "xml literal - comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralDelimiter = "xml literal - delimiter" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralEmbeddedExpression = "xml literal - embedded expression" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralEntityReference = "xml literal - entity reference" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralName = "xml literal - name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralProcessingInstruction = "xml literal - processing instruction" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralText = "xml literal - text" -> string
const Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.Kind = "CodeAction_Conflict" -> string
const Microsoft.CodeAnalysis.CodeActions.RenameAnnotation.Kind = "CodeAction_Rename" -> string
const Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.Kind = "CodeAction_Warning" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Default = "Default" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Desktop = "Desktop" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Editor = "Editor" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Host = "Host" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Assembly = "Assembly" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Class = "Class" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Constant = "Constant" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Delegate = "Delegate" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Enum = "Enum" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.EnumMember = "EnumMember" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Error = "Error" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Event = "Event" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.ExtensionMethod = "ExtensionMethod" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Field = "Field" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.File = "File" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Folder = "Folder" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Interface = "Interface" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Internal = "Internal" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Intrinsic = "Intrinsic" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Keyword = "Keyword" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Label = "Label" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Local = "Local" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Method = "Method" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Module = "Module" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Namespace = "Namespace" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Operator = "Operator" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Parameter = "Parameter" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Private = "Private" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Project = "Project" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Property = "Property" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Protected = "Protected" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Public = "Public" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.RangeVariable = "RangeVariable" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Reference = "Reference" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Snippet = "Snippet" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Structure = "Structure" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.TypeParameter = "TypeParameter" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Warning = "Warning" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Debugger = "Debugger" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Host = "Host" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Interactive = "Interactive" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.MetadataAsSource = "MetadataAsSource" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.MiscellaneousFiles = "MiscellaneousFiles" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.MSBuild = "MSBuildWorkspace" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Preview = "Preview" -> string
Microsoft.CodeAnalysis.AdditionalDocument
Microsoft.CodeAnalysis.AdhocWorkspace
Microsoft.CodeAnalysis.AdhocWorkspace.AddDocument(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.AdhocWorkspace.AddDocument(Microsoft.CodeAnalysis.ProjectId projectId, string name, Microsoft.CodeAnalysis.Text.SourceText text) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.AdhocWorkspace.AddProject(Microsoft.CodeAnalysis.ProjectInfo projectInfo) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.AdhocWorkspace.AddProject(string name, string language) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.AdhocWorkspace.AddProjects(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectInfo> projectInfos) -> void
Microsoft.CodeAnalysis.AdhocWorkspace.AddSolution(Microsoft.CodeAnalysis.SolutionInfo solutionInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.AdhocWorkspace.AdhocWorkspace() -> void
Microsoft.CodeAnalysis.AdhocWorkspace.AdhocWorkspace(Microsoft.CodeAnalysis.Host.HostServices host, string workspaceKind = "Custom") -> void
Microsoft.CodeAnalysis.AdhocWorkspace.ClearSolution() -> void
Microsoft.CodeAnalysis.AnalyzerConfigDocument
Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddAdditionalDocument = 11 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddAnalyzerConfigDocument = 17 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddAnalyzerReference = 9 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddDocument = 6 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddMetadataReference = 4 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddProject = 0 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddProjectReference = 2 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddSolutionAnalyzerReference = 20 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeAdditionalDocument = 13 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeAnalyzerConfigDocument = 19 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeCompilationOptions = 14 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeDocument = 8 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeDocumentInfo = 16 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeParseOptions = 15 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveAdditionalDocument = 12 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveAnalyzerConfigDocument = 18 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveAnalyzerReference = 10 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveDocument = 7 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveMetadataReference = 5 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveProject = 1 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveProjectReference = 3 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveSolutionAnalyzerReference = 21 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.Classification.ClassificationTypeNames
Microsoft.CodeAnalysis.Classification.ClassifiedSpan
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassificationType.get -> string
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassifiedSpan() -> void
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassifiedSpan(Microsoft.CodeAnalysis.Text.TextSpan textSpan, string classificationType) -> void
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassifiedSpan(string classificationType, Microsoft.CodeAnalysis.Text.TextSpan textSpan) -> void
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.Equals(Microsoft.CodeAnalysis.Classification.ClassifiedSpan other) -> bool
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.TextSpan.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.Classification.Classifier
Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation
Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.ApplyChangesOperation(Microsoft.CodeAnalysis.Solution changedSolution) -> void
Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.ChangedSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.CodeActions.CodeAction
Microsoft.CodeAnalysis.CodeActions.CodeAction.CodeAction() -> void
Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessAsync(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation> operations, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Solution changedSolution, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
Microsoft.CodeAnalysis.CodeActions.CodeActionOperation
Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.CodeActionOperation() -> void
Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions
Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.CodeActionWithOptions() -> void
Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.GetOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation
Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation
Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation.DocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation.OpenDocumentOperation(Microsoft.CodeAnalysis.DocumentId documentId, bool activateIfAlreadyOpen = false) -> void
Microsoft.CodeAnalysis.CodeActions.PreviewOperation
Microsoft.CodeAnalysis.CodeActions.PreviewOperation.PreviewOperation() -> void
Microsoft.CodeAnalysis.CodeActions.RenameAnnotation
Microsoft.CodeAnalysis.CodeActions.WarningAnnotation
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CancellationToken.get -> System.Threading.CancellationToken
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext() -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Diagnostic diagnostic, System.Action<Microsoft.CodeAnalysis.CodeActions.CodeAction, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>> registerCodeFix, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic> diagnostics, System.Action<Microsoft.CodeAnalysis.CodeActions.CodeAction, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>> registerCodeFix, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Diagnostics.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.RegisterCodeFix(Microsoft.CodeAnalysis.CodeActions.CodeAction action, Microsoft.CodeAnalysis.Diagnostic diagnostic) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.RegisterCodeFix(Microsoft.CodeAnalysis.CodeActions.CodeAction action, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic> diagnostics) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.RegisterCodeFix(Microsoft.CodeAnalysis.CodeActions.CodeAction action, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic> diagnostics) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Span.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider
Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.CodeFixProvider() -> void
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.ExportCodeFixProviderAttribute(string firstLanguage, params string[] additionalLanguages) -> void
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.Languages.get -> string[]
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.Name.get -> string
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.Name.set -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.CancellationToken.get -> System.Threading.CancellationToken
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.CodeActionEquivalenceKey.get -> string
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.CodeFixProvider.get -> Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticIds.get -> System.Collections.Immutable.ImmutableHashSet<string>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.DiagnosticProvider() -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.FixAllContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider codeFixProvider, Microsoft.CodeAnalysis.CodeFixes.FixAllScope scope, string codeActionEquivalenceKey, System.Collections.Generic.IEnumerable<string> diagnosticIds, Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider fixAllDiagnosticProvider, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.FixAllContext(Microsoft.CodeAnalysis.Project project, Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider codeFixProvider, Microsoft.CodeAnalysis.CodeFixes.FixAllScope scope, string codeActionEquivalenceKey, System.Collections.Generic.IEnumerable<string> diagnosticIds, Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider fixAllDiagnosticProvider, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetAllDiagnosticsAsync(Microsoft.CodeAnalysis.Project project) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetDocumentDiagnosticsAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetProjectDiagnosticsAsync(Microsoft.CodeAnalysis.Project project) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Project.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Scope.get -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Solution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.WithCancellationToken(System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.CodeFixes.FixAllContext
Microsoft.CodeAnalysis.CodeFixes.FixAllProvider
Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.FixAllProvider() -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Custom = 3 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Document = 0 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Project = 1 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Solution = 2 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.WellKnownFixAllProviders
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.CancellationToken.get -> System.Threading.CancellationToken
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.CodeRefactoringContext() -> void
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.CodeRefactoringContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Action<Microsoft.CodeAnalysis.CodeActions.CodeAction> registerRefactoring, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.RegisterRefactoring(Microsoft.CodeAnalysis.CodeActions.CodeAction action) -> void
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.Span.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.CodeRefactoringProvider() -> void
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.ExportCodeRefactoringProviderAttribute(string firstLanguage, params string[] additionalLanguages) -> void
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.Languages.get -> string[]
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.Name.get -> string
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.Name.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.CodeStyleOption(T value, Microsoft.CodeAnalysis.CodeStyle.NotificationOption notification) -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Equals(Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T> other) -> bool
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Notification.get -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Notification.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.ToXElement() -> System.Xml.Linq.XElement
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Value.get -> T
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Value.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.CodeStyleOptions() -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Name.get -> string
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Name.set -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Severity.get -> Microsoft.CodeAnalysis.ReportDiagnostic
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Severity.set -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Value.get -> Microsoft.CodeAnalysis.DiagnosticSeverity
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Value.set -> void
Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.CompilationOutputInfo.AssemblyPath.get -> string
Microsoft.CodeAnalysis.CompilationOutputInfo.CompilationOutputInfo() -> void
Microsoft.CodeAnalysis.CompilationOutputInfo.Equals(Microsoft.CodeAnalysis.CompilationOutputInfo other) -> bool
Microsoft.CodeAnalysis.CompilationOutputInfo.WithAssemblyPath(string path) -> Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.Differencing.Edit<TNode>
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Edit() -> void
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Equals(Microsoft.CodeAnalysis.Differencing.Edit<TNode> other) -> bool
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Kind.get -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.NewNode.get -> TNode
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.OldNode.get -> TNode
Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Delete = 3 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Insert = 2 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Move = 4 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.None = 0 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Reorder = 5 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Update = 1 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditScript<TNode>
Microsoft.CodeAnalysis.Differencing.EditScript<TNode>.Edits.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Differencing.Edit<TNode>>
Microsoft.CodeAnalysis.Differencing.EditScript<TNode>.Match.get -> Microsoft.CodeAnalysis.Differencing.Match<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.Comparer.get -> Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.GetSequenceEdits(System.Collections.Generic.IEnumerable<TNode> oldNodes, System.Collections.Generic.IEnumerable<TNode> newNodes) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Differencing.Edit<TNode>>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.GetTreeEdits() -> Microsoft.CodeAnalysis.Differencing.EditScript<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.Matches.get -> System.Collections.Generic.IReadOnlyDictionary<TNode, TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.NewRoot.get -> TNode
Microsoft.CodeAnalysis.Differencing.Match<TNode>.OldRoot.get -> TNode
Microsoft.CodeAnalysis.Differencing.Match<TNode>.ReverseMatches.get -> System.Collections.Generic.IReadOnlyDictionary<TNode, TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.TryGetNewNode(TNode oldNode, out TNode newNode) -> bool
Microsoft.CodeAnalysis.Differencing.Match<TNode>.TryGetOldNode(TNode newNode, out TNode oldNode) -> bool
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.ComputeEditScript(TNode oldRoot, TNode newRoot) -> Microsoft.CodeAnalysis.Differencing.EditScript<TNode>
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.ComputeMatch(TNode oldRoot, TNode newRoot, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TNode, TNode>> knownMatches = null) -> Microsoft.CodeAnalysis.Differencing.Match<TNode>
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TreeComparer() -> void
Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.GetLinkedDocumentIds() -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Document.GetOptionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Options.DocumentOptionSet>
Microsoft.CodeAnalysis.Document.GetSemanticModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SemanticModel>
Microsoft.CodeAnalysis.Document.GetSyntaxRootAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxNode>
Microsoft.CodeAnalysis.Document.GetSyntaxTreeAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxTree>
Microsoft.CodeAnalysis.Document.GetSyntaxVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Document.GetTextChangesAsync(Microsoft.CodeAnalysis.Document oldDocument, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextChange>>
Microsoft.CodeAnalysis.Document.SourceCodeKind.get -> Microsoft.CodeAnalysis.SourceCodeKind
Microsoft.CodeAnalysis.Document.SupportsSemanticModel.get -> bool
Microsoft.CodeAnalysis.Document.SupportsSyntaxTree.get -> bool
Microsoft.CodeAnalysis.Document.TryGetSemanticModel(out Microsoft.CodeAnalysis.SemanticModel semanticModel) -> bool
Microsoft.CodeAnalysis.Document.TryGetSyntaxRoot(out Microsoft.CodeAnalysis.SyntaxNode root) -> bool
Microsoft.CodeAnalysis.Document.TryGetSyntaxTree(out Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> bool
Microsoft.CodeAnalysis.Document.TryGetSyntaxVersion(out Microsoft.CodeAnalysis.VersionStamp version) -> bool
Microsoft.CodeAnalysis.Document.WithFilePath(string filePath) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithFolders(System.Collections.Generic.IEnumerable<string> folders) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithName(string name) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithSourceCodeKind(Microsoft.CodeAnalysis.SourceCodeKind kind) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithSyntaxRoot(Microsoft.CodeAnalysis.SyntaxNode root) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithText(Microsoft.CodeAnalysis.Text.SourceText text) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.DocumentActiveContextChangedEventArgs(Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.Text.SourceTextContainer sourceTextContainer, Microsoft.CodeAnalysis.DocumentId oldActiveContextDocumentId, Microsoft.CodeAnalysis.DocumentId newActiveContextDocumentId) -> void
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.NewActiveContextDocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.OldActiveContextDocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.Solution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.SourceTextContainer.get -> Microsoft.CodeAnalysis.Text.SourceTextContainer
Microsoft.CodeAnalysis.DocumentDiagnostic
Microsoft.CodeAnalysis.DocumentDiagnostic.DocumentDiagnostic(Microsoft.CodeAnalysis.WorkspaceDiagnosticKind kind, string message, Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.DocumentDiagnostic.DocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentEventArgs
Microsoft.CodeAnalysis.DocumentEventArgs.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.DocumentEventArgs.DocumentEventArgs(Microsoft.CodeAnalysis.Document document) -> void
Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentId.Equals(Microsoft.CodeAnalysis.DocumentId other) -> bool
Microsoft.CodeAnalysis.DocumentId.Id.get -> System.Guid
Microsoft.CodeAnalysis.DocumentId.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.FilePath.get -> string
Microsoft.CodeAnalysis.DocumentInfo.Folders.get -> System.Collections.Generic.IReadOnlyList<string>
Microsoft.CodeAnalysis.DocumentInfo.Id.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentInfo.IsGenerated.get -> bool
Microsoft.CodeAnalysis.DocumentInfo.Name.get -> string
Microsoft.CodeAnalysis.DocumentInfo.SourceCodeKind.get -> Microsoft.CodeAnalysis.SourceCodeKind
Microsoft.CodeAnalysis.DocumentInfo.TextLoader.get -> Microsoft.CodeAnalysis.TextLoader
Microsoft.CodeAnalysis.DocumentInfo.WithFilePath(string filePath) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithFolders(System.Collections.Generic.IEnumerable<string> folders) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithId(Microsoft.CodeAnalysis.DocumentId id) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithName(string name) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithSourceCodeKind(Microsoft.CodeAnalysis.SourceCodeKind kind) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithTextLoader(Microsoft.CodeAnalysis.TextLoader loader) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.AddAccessor = 26 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Attribute = 22 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Class = 2 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.CompilationUnit = 1 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Constructor = 10 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.ConversionOperator = 9 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.CustomEvent = 17 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Delegate = 6 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Destructor = 11 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Enum = 5 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.EnumMember = 15 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Event = 16 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Field = 12 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.GetAccessor = 24 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Indexer = 14 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Interface = 4 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.LambdaExpression = 23 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Method = 7 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Namespace = 18 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.NamespaceImport = 19 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.None = 0 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Operator = 8 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Parameter = 20 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Property = 13 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.RaiseAccessor = 28 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.RemoveAccessor = 27 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.SetAccessor = 25 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Struct = 3 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Variable = 21 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.DeclarationModifiers() -> void
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsAbstract.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsAsync.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsConst.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsExtern.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsNew.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsOverride.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsPartial.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsReadOnly.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsRef.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsSealed.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsStatic.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsUnsafe.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsVirtual.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsVolatile.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsWithEvents.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsWriteOnly.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithAsync(bool isAsync) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsAbstract(bool isAbstract) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsConst(bool isConst) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsExtern(bool isExtern) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsNew(bool isNew) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsOverride(bool isOverride) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsReadOnly(bool isReadOnly) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsRef(bool isRef) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsSealed(bool isSealed) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsStatic(bool isStatic) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsUnsafe(bool isUnsafe) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsVirtual(bool isVirtual) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsVolatile(bool isVolatile) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsWriteOnly(bool isWriteOnly) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithPartial(bool isPartial) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithWithEvents(bool withEvents) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DocumentEditor
Microsoft.CodeAnalysis.Editing.DocumentEditor.GetChangedDocument() -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Editing.DocumentEditor.OriginalDocument.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Editing.DocumentEditor.SemanticModel.get -> Microsoft.CodeAnalysis.SemanticModel
Microsoft.CodeAnalysis.Editing.ImportAdder
Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Addition = 2 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.BitwiseAnd = 3 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.BitwiseOr = 4 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Decrement = 5 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Division = 6 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Equality = 7 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.ExclusiveOr = 8 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.ExplicitConversion = 1 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.False = 9 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.GreaterThan = 10 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.GreaterThanOrEqual = 11 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.ImplicitConversion = 0 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Increment = 12 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Inequality = 13 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LeftShift = 14 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LessThan = 15 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LessThanOrEqual = 16 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LogicalNot = 17 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Modulus = 18 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Multiply = 19 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.OnesComplement = 20 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.RightShift = 21 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Subtraction = 22 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.True = 23 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.UnaryNegation = 24 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.UnaryPlus = 25 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.SolutionEditor
Microsoft.CodeAnalysis.Editing.SolutionEditor.GetChangedSolution() -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SolutionEditor.GetDocumentEditorAsync(Microsoft.CodeAnalysis.DocumentId id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Editing.DocumentEditor>
Microsoft.CodeAnalysis.Editing.SolutionEditor.OriginalSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SolutionEditor.SolutionEditor(Microsoft.CodeAnalysis.Solution solution) -> void
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.Constructor = 4 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.None = 0 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.ReferenceType = 1 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.ValueType = 2 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SymbolEditor
Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction
Microsoft.CodeAnalysis.Editing.SymbolEditor.ChangedSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditAllDeclarationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditAllDeclarationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.ISymbol member, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.ISymbol member, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Location location, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Location location, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.GetChangedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Document>
Microsoft.CodeAnalysis.Editing.SymbolEditor.GetCurrentDeclarationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>>
Microsoft.CodeAnalysis.Editing.SymbolEditor.GetCurrentSymbolAsync(Microsoft.CodeAnalysis.ISymbol symbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.OriginalSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions
Microsoft.CodeAnalysis.Editing.SyntaxEditor
Microsoft.CodeAnalysis.Editing.SyntaxEditor.Generator.get -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
Microsoft.CodeAnalysis.Editing.SyntaxEditor.GetChangedRoot() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertAfter(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertAfter(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newNodes) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertBefore(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertBefore(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newNodes) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.OriginalRoot.get -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxEditor.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode node) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxRemoveOptions options) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.ReplaceNode(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.ReplaceNode(Microsoft.CodeAnalysis.SyntaxNode node, System.Func<Microsoft.CodeAnalysis.SyntaxNode, Microsoft.CodeAnalysis.Editing.SyntaxGenerator, Microsoft.CodeAnalysis.SyntaxNode> computeReplacement) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.SyntaxEditor(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.Workspace workspace) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.TrackNode(Microsoft.CodeAnalysis.SyntaxNode node) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions
Microsoft.CodeAnalysis.Editing.SyntaxGenerator
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAccessors(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> accessors) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAttributeArguments(Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] members) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] imports) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> imports) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> switchSections) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AliasImportDeclaration(string aliasIdentifierName, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol symbol) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Argument(Microsoft.CodeAnalysis.RefKind refKind, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Argument(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPrivateInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPublicInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(Microsoft.CodeAnalysis.AttributeData attribute) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(string name, params Microsoft.CodeAnalysis.SyntaxNode[] attributeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AttributeArgument(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CastExpression(Microsoft.CodeAnalysis.ITypeSymbol type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CatchClause(Microsoft.CodeAnalysis.ITypeSymbol type, string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CompilationUnit(params Microsoft.CodeAnalysis.SyntaxNode[] declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConstructorDeclaration(Microsoft.CodeAnalysis.IMethodSymbol constructorMethod, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> baseConstructorArguments = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConvertExpression(Microsoft.CodeAnalysis.ITypeSymbol type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CustomEventDeclaration(Microsoft.CodeAnalysis.IEventSymbol symbol, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> addAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> removeAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Declaration(Microsoft.CodeAnalysis.ISymbol symbol) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DottedName(string dottedName) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementBindingExpression(params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EventDeclaration(Microsoft.CodeAnalysis.IEventSymbol symbol) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FalseLiteralExpression() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FieldDeclaration(Microsoft.CodeAnalysis.IFieldSymbol field) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FieldDeclaration(Microsoft.CodeAnalysis.IFieldSymbol field, Microsoft.CodeAnalysis.SyntaxNode initializer) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, params Microsoft.CodeAnalysis.ITypeSymbol[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, params Microsoft.CodeAnalysis.SyntaxNode[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ITypeSymbol> typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessor(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Editing.DeclarationKind kind) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetDeclaration(Microsoft.CodeAnalysis.SyntaxNode node) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetDeclaration(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Editing.DeclarationKind kind) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IfStatement(Microsoft.CodeAnalysis.SyntaxNode condition, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> trueStatements, Microsoft.CodeAnalysis.SyntaxNode falseStatement) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IndexerDeclaration(Microsoft.CodeAnalysis.IPropertySymbol indexer, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IndexOf<T>(System.Collections.Generic.IReadOnlyList<T> list, T element) -> int
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] members) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] imports) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InvocationExpression(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IsTypeExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LambdaParameter(string identifier, Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LocalDeclarationStatement(Microsoft.CodeAnalysis.ITypeSymbol type, string name, Microsoft.CodeAnalysis.SyntaxNode initializer = null, bool isConst = false) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LocalDeclarationStatement(string name, Microsoft.CodeAnalysis.SyntaxNode initializer) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, string memberName) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MethodDeclaration(Microsoft.CodeAnalysis.IMethodSymbol method, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(Microsoft.CodeAnalysis.SyntaxNode name, params Microsoft.CodeAnalysis.SyntaxNode[] declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(string name, params Microsoft.CodeAnalysis.SyntaxNode[] declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceImportDeclaration(string name) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NullLiteralExpression() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.ITypeSymbol type, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.ITypeSymbol type, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.SyntaxNode type, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.OperatorDeclaration(Microsoft.CodeAnalysis.IMethodSymbol method, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ParameterDeclaration(Microsoft.CodeAnalysis.IParameterSymbol symbol, Microsoft.CodeAnalysis.SyntaxNode initializer = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PropertyDeclaration(Microsoft.CodeAnalysis.IPropertySymbol property, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveAllAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNodes(Microsoft.CodeAnalysis.SyntaxNode root, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchSection(Microsoft.CodeAnalysis.SyntaxNode caseExpression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchStatement(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] sections) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SyntaxGenerator() -> void
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TrueLiteralExpression() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCastExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCatchStatement(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> tryStatements, params Microsoft.CodeAnalysis.SyntaxNode[] catchClauses) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryFinallyStatement(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> tryStatements, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> finallyStatements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleElementExpression(Microsoft.CodeAnalysis.ITypeSymbol type, string name = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleTypeExpression(params Microsoft.CodeAnalysis.SyntaxNode[] elements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleTypeExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ITypeSymbol> elementTypes, System.Collections.Generic.IEnumerable<string> elementNames = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleTypeExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> elements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeExpression(Microsoft.CodeAnalysis.ITypeSymbol typeSymbol, bool addImport) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.UsingStatement(string name, Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(string parameterName, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(string parameterName, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(string parameterName, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(string parameterName, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessorDeclarations(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] accessorDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeArguments(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, params Microsoft.CodeAnalysis.SyntaxNode[] types) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, params Microsoft.CodeAnalysis.SyntaxNode[] types) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, params string[] typeParameters) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.ExtensionOrderAttribute
Microsoft.CodeAnalysis.ExtensionOrderAttribute.After.get -> string
Microsoft.CodeAnalysis.ExtensionOrderAttribute.After.set -> void
Microsoft.CodeAnalysis.ExtensionOrderAttribute.Before.get -> string
Microsoft.CodeAnalysis.ExtensionOrderAttribute.Before.set -> void
Microsoft.CodeAnalysis.ExtensionOrderAttribute.ExtensionOrderAttribute() -> void
Microsoft.CodeAnalysis.FileTextLoader
Microsoft.CodeAnalysis.FileTextLoader.DefaultEncoding.get -> System.Text.Encoding
Microsoft.CodeAnalysis.FileTextLoader.FileTextLoader(string path, System.Text.Encoding defaultEncoding) -> void
Microsoft.CodeAnalysis.FileTextLoader.Path.get -> string
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnCompleted() -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnDefinitionFound(Microsoft.CodeAnalysis.ISymbol symbol) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnFindInDocumentCompleted(Microsoft.CodeAnalysis.Document document) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnFindInDocumentStarted(Microsoft.CodeAnalysis.Document document) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnReferenceFound(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation location) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnStarted() -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.ReportProgress(int current, int maximum) -> void
Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol
Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol.Definition.get -> Microsoft.CodeAnalysis.ISymbol
Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol.Locations.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation>
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Alias.get -> Microsoft.CodeAnalysis.IAliasSymbol
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.CandidateReason.get -> Microsoft.CodeAnalysis.CandidateReason
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.CompareTo(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation other) -> int
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Equals(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation other) -> bool
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.IsCandidateLocation.get -> bool
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.IsImplicit.get -> bool
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Location.get -> Microsoft.CodeAnalysis.Location
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.ReferenceLocation() -> void
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.CalledSymbol.get -> Microsoft.CodeAnalysis.ISymbol
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.CallingSymbol.get -> Microsoft.CodeAnalysis.ISymbol
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.IsDirect.get -> bool
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.Locations.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.SymbolCallerInfo() -> void
Microsoft.CodeAnalysis.FindSymbols.SymbolFinder
Microsoft.CodeAnalysis.Formatting.Formatter
Microsoft.CodeAnalysis.Formatting.FormattingOptions
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle.Block = 1 -> Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle.None = 0 -> Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle.Smart = 2 -> Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Host.HostLanguageServices
Microsoft.CodeAnalysis.Host.HostLanguageServices.GetRequiredService<TLanguageService>() -> TLanguageService
Microsoft.CodeAnalysis.Host.HostLanguageServices.HostLanguageServices() -> void
Microsoft.CodeAnalysis.Host.HostServices
Microsoft.CodeAnalysis.Host.HostServices.HostServices() -> void
Microsoft.CodeAnalysis.Host.HostWorkspaceServices
Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetRequiredService<TWorkspaceService>() -> TWorkspaceService
Microsoft.CodeAnalysis.Host.HostWorkspaceServices.HostWorkspaceServices() -> void
Microsoft.CodeAnalysis.Host.HostWorkspaceServices.MetadataFilter
Microsoft.CodeAnalysis.Host.IAnalyzerService
Microsoft.CodeAnalysis.Host.IAnalyzerService.GetLoader() -> Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader
Microsoft.CodeAnalysis.Host.ILanguageService
Microsoft.CodeAnalysis.Host.IPersistentStorage
Microsoft.CodeAnalysis.Host.IPersistentStorage.ReadStreamAsync(Microsoft.CodeAnalysis.Document document, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.IPersistentStorage.ReadStreamAsync(Microsoft.CodeAnalysis.Project project, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.IPersistentStorage.ReadStreamAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.IPersistentStorage.WriteStreamAsync(Microsoft.CodeAnalysis.Document document, string name, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>
Microsoft.CodeAnalysis.Host.IPersistentStorage.WriteStreamAsync(Microsoft.CodeAnalysis.Project project, string name, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>
Microsoft.CodeAnalysis.Host.IPersistentStorage.WriteStreamAsync(string name, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>
Microsoft.CodeAnalysis.Host.IPersistentStorageService
Microsoft.CodeAnalysis.Host.IPersistentStorageService.GetStorage(Microsoft.CodeAnalysis.Solution solution) -> Microsoft.CodeAnalysis.Host.IPersistentStorage
Microsoft.CodeAnalysis.Host.ITemporaryStorageService
Microsoft.CodeAnalysis.Host.ITemporaryStorageService.CreateTemporaryStreamStorage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage
Microsoft.CodeAnalysis.Host.ITemporaryStorageService.CreateTemporaryTextStorage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Host.ITemporaryTextStorage
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.ReadStream(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.IO.Stream
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.ReadStreamAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.WriteStream(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.WriteStreamAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.ReadText(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Text.SourceText
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.ReadTextAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Text.SourceText>
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.WriteText(Microsoft.CodeAnalysis.Text.SourceText text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.WriteTextAsync(Microsoft.CodeAnalysis.Text.SourceText text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Host.IWorkspaceService
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.ExportLanguageServiceAttribute(System.Type type, string language, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.Language.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.ExportLanguageServiceFactoryAttribute(System.Type type, string language, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.Language.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute.ExportWorkspaceServiceAttribute(System.Type serviceType, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute.ExportWorkspaceServiceFactoryAttribute(System.Type serviceType, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ILanguageServiceFactory
Microsoft.CodeAnalysis.Host.Mef.ILanguageServiceFactory.CreateLanguageService(Microsoft.CodeAnalysis.Host.HostLanguageServices languageServices) -> Microsoft.CodeAnalysis.Host.ILanguageService
Microsoft.CodeAnalysis.Host.Mef.IWorkspaceServiceFactory
Microsoft.CodeAnalysis.Host.Mef.IWorkspaceServiceFactory.CreateService(Microsoft.CodeAnalysis.Host.HostWorkspaceServices workspaceServices) -> Microsoft.CodeAnalysis.Host.IWorkspaceService
Microsoft.CodeAnalysis.Host.Mef.MefHostServices
Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefHostServices(System.Composition.CompositionContext compositionContext) -> void
Microsoft.CodeAnalysis.Host.Mef.ServiceLayer
Microsoft.CodeAnalysis.Options.DocumentOptionSet
Microsoft.CodeAnalysis.Options.DocumentOptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option) -> T
Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, T value) -> Microsoft.CodeAnalysis.Options.DocumentOptionSet
Microsoft.CodeAnalysis.Options.IOption
Microsoft.CodeAnalysis.Options.IOption.DefaultValue.get -> object
Microsoft.CodeAnalysis.Options.IOption.Feature.get -> string
Microsoft.CodeAnalysis.Options.IOption.IsPerLanguage.get -> bool
Microsoft.CodeAnalysis.Options.IOption.Name.get -> string
Microsoft.CodeAnalysis.Options.IOption.StorageLocations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Options.OptionStorageLocation>
Microsoft.CodeAnalysis.Options.IOption.Type.get -> System.Type
Microsoft.CodeAnalysis.Options.Option<T>
Microsoft.CodeAnalysis.Options.Option<T>.DefaultValue.get -> T
Microsoft.CodeAnalysis.Options.Option<T>.Feature.get -> string
Microsoft.CodeAnalysis.Options.Option<T>.Name.get -> string
Microsoft.CodeAnalysis.Options.Option<T>.Option(string feature, string name) -> void
Microsoft.CodeAnalysis.Options.Option<T>.Option(string feature, string name, T defaultValue) -> void
Microsoft.CodeAnalysis.Options.Option<T>.Option(string feature, string name, T defaultValue, params Microsoft.CodeAnalysis.Options.OptionStorageLocation[] storageLocations) -> void
Microsoft.CodeAnalysis.Options.Option<T>.StorageLocations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Options.OptionStorageLocation>
Microsoft.CodeAnalysis.Options.Option<T>.Type.get -> System.Type
Microsoft.CodeAnalysis.Options.OptionKey
Microsoft.CodeAnalysis.Options.OptionKey.Equals(Microsoft.CodeAnalysis.Options.OptionKey other) -> bool
Microsoft.CodeAnalysis.Options.OptionKey.Language.get -> string
Microsoft.CodeAnalysis.Options.OptionKey.Option.get -> Microsoft.CodeAnalysis.Options.IOption
Microsoft.CodeAnalysis.Options.OptionKey.OptionKey() -> void
Microsoft.CodeAnalysis.Options.OptionKey.OptionKey(Microsoft.CodeAnalysis.Options.IOption option, string language = null) -> void
Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Options.OptionSet.GetOption(Microsoft.CodeAnalysis.Options.OptionKey optionKey) -> object
Microsoft.CodeAnalysis.Options.OptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.Option<T> option) -> T
Microsoft.CodeAnalysis.Options.OptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.OptionKey optionKey) -> T
Microsoft.CodeAnalysis.Options.OptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, string language) -> T
Microsoft.CodeAnalysis.Options.OptionSet.OptionSet() -> void
Microsoft.CodeAnalysis.Options.OptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.Option<T> option, T value) -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Options.OptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, string language, T value) -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Options.OptionStorageLocation
Microsoft.CodeAnalysis.Options.OptionStorageLocation.OptionStorageLocation() -> void
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.DefaultValue.get -> T
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Feature.get -> string
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Name.get -> string
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.PerLanguageOption(string feature, string name, T defaultValue) -> void
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.PerLanguageOption(string feature, string name, T defaultValue, params Microsoft.CodeAnalysis.Options.OptionStorageLocation[] storageLocations) -> void
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.StorageLocations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Options.OptionStorageLocation>
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Type.get -> System.Type
Microsoft.CodeAnalysis.PreservationMode
Microsoft.CodeAnalysis.PreservationMode.PreserveIdentity = 1 -> Microsoft.CodeAnalysis.PreservationMode
Microsoft.CodeAnalysis.PreservationMode.PreserveValue = 0 -> Microsoft.CodeAnalysis.PreservationMode
Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddAdditionalDocument(string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.AddAdditionalDocument(string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.AddAnalyzerConfigDocument(string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.AddAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddDocument(string name, Microsoft.CodeAnalysis.SyntaxNode syntaxRoot, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.AddDocument(string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.AddDocument(string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.AdditionalDocumentIds.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Project.AdditionalDocuments.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.TextDocument>
Microsoft.CodeAnalysis.Project.AddMetadataReference(Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddMetadataReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddProjectReference(Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddProjectReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AllProjectReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.Project.AnalyzerConfigDocuments.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.AnalyzerConfigDocument>
Microsoft.CodeAnalysis.Project.AnalyzerOptions.get -> Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions
Microsoft.CodeAnalysis.Project.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.Project.AssemblyName.get -> string
Microsoft.CodeAnalysis.Project.CompilationOptions.get -> Microsoft.CodeAnalysis.CompilationOptions
Microsoft.CodeAnalysis.Project.CompilationOutputInfo.get -> Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.Project.ContainsAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Project.ContainsAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Project.ContainsDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Project.DefaultNamespace.get -> string
Microsoft.CodeAnalysis.Project.DocumentIds.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Project.Documents.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Document>
Microsoft.CodeAnalysis.Project.FilePath.get -> string
Microsoft.CodeAnalysis.Project.GetAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.GetAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.AnalyzerConfigDocument
Microsoft.CodeAnalysis.Project.GetChanges(Microsoft.CodeAnalysis.Project oldProject) -> Microsoft.CodeAnalysis.ProjectChanges
Microsoft.CodeAnalysis.Project.GetCompilationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Compilation>
Microsoft.CodeAnalysis.Project.GetDependentSemanticVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.GetDependentVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.GetDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.GetDocument(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.GetDocumentId(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.Project.GetLatestDocumentVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.GetSemanticVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.HasDocuments.get -> bool
Microsoft.CodeAnalysis.Project.Id.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.Project.IsSubmission.get -> bool
Microsoft.CodeAnalysis.Project.Language.get -> string
Microsoft.CodeAnalysis.Project.LanguageServices.get -> Microsoft.CodeAnalysis.Host.HostLanguageServices
Microsoft.CodeAnalysis.Project.MetadataReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.Project.Name.get -> string
Microsoft.CodeAnalysis.Project.OutputFilePath.get -> string
Microsoft.CodeAnalysis.Project.OutputRefFilePath.get -> string
Microsoft.CodeAnalysis.Project.ParseOptions.get -> Microsoft.CodeAnalysis.ParseOptions
Microsoft.CodeAnalysis.Project.ProjectReferences.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.Project.RemoveAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAdditionalDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAnalyzerConfigDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveMetadataReference(Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveProjectReference(Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.Solution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Project.SupportsCompilation.get -> bool
Microsoft.CodeAnalysis.Project.TryGetCompilation(out Microsoft.CodeAnalysis.Compilation compilation) -> bool
Microsoft.CodeAnalysis.Project.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Project.WithAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferencs) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithAssemblyName(string assemblyName) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithCompilationOptions(Microsoft.CodeAnalysis.CompilationOptions options) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithDefaultNamespace(string defaultNamespace) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithMetadataReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithParseOptions(Microsoft.CodeAnalysis.ParseOptions options) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithProjectReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.ProjectChanges
Microsoft.CodeAnalysis.ProjectChanges.GetAddedAdditionalDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedAnalyzerConfigDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedMetadataReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedProjectReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedAdditionalDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedAnalyzerConfigDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedDocuments(bool onlyGetDocumentsWithTextChanges) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedAdditionalDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedAnalyzerConfigDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedMetadataReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedProjectReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.ProjectChanges.NewProject.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.ProjectChanges.OldProject.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.ProjectChanges.ProjectChanges() -> void
Microsoft.CodeAnalysis.ProjectChanges.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectDependencyGraph
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetDependencySets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectId>>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatDirectlyDependOnThisProject(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatThisProjectDirectlyDependsOn(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetTopologicallySortedProjects(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDiagnostic
Microsoft.CodeAnalysis.ProjectDiagnostic.ProjectDiagnostic(Microsoft.CodeAnalysis.WorkspaceDiagnosticKind kind, string message, Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.ProjectDiagnostic.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectId.Equals(Microsoft.CodeAnalysis.ProjectId other) -> bool
Microsoft.CodeAnalysis.ProjectId.Id.get -> System.Guid
Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.AdditionalDocuments.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentInfo>
Microsoft.CodeAnalysis.ProjectInfo.AnalyzerConfigDocuments.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentInfo>
Microsoft.CodeAnalysis.ProjectInfo.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.ProjectInfo.AssemblyName.get -> string
Microsoft.CodeAnalysis.ProjectInfo.CompilationOptions.get -> Microsoft.CodeAnalysis.CompilationOptions
Microsoft.CodeAnalysis.ProjectInfo.CompilationOutputInfo.get -> Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.ProjectInfo.Documents.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentInfo>
Microsoft.CodeAnalysis.ProjectInfo.FilePath.get -> string
Microsoft.CodeAnalysis.ProjectInfo.HostObjectType.get -> System.Type
Microsoft.CodeAnalysis.ProjectInfo.Id.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectInfo.IsSubmission.get -> bool
Microsoft.CodeAnalysis.ProjectInfo.Language.get -> string
Microsoft.CodeAnalysis.ProjectInfo.MetadataReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.ProjectInfo.Name.get -> string
Microsoft.CodeAnalysis.ProjectInfo.OutputFilePath.get -> string
Microsoft.CodeAnalysis.ProjectInfo.OutputRefFilePath.get -> string
Microsoft.CodeAnalysis.ProjectInfo.ParseOptions.get -> Microsoft.CodeAnalysis.ParseOptions
Microsoft.CodeAnalysis.ProjectInfo.ProjectReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.ProjectInfo.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.ProjectInfo.WithAdditionalDocuments(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> additionalDocuments) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithAnalyzerConfigDocuments(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> analyzerConfigDocuments) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithAssemblyName(string assemblyName) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithCompilationOptions(Microsoft.CodeAnalysis.CompilationOptions compilationOptions) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithCompilationOutputInfo(in Microsoft.CodeAnalysis.CompilationOutputInfo info) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithDefaultNamespace(string defaultNamespace) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithDocuments(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> documents) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithFilePath(string filePath) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithMetadataReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithName(string name) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithOutputFilePath(string outputFilePath) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithOutputRefFilePath(string outputRefFilePath) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithParseOptions(Microsoft.CodeAnalysis.ParseOptions parseOptions) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithProjectReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithVersion(Microsoft.CodeAnalysis.VersionStamp version) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectReference
Microsoft.CodeAnalysis.ProjectReference.Aliases.get -> System.Collections.Immutable.ImmutableArray<string>
Microsoft.CodeAnalysis.ProjectReference.EmbedInteropTypes.get -> bool
Microsoft.CodeAnalysis.ProjectReference.Equals(Microsoft.CodeAnalysis.ProjectReference reference) -> bool
Microsoft.CodeAnalysis.ProjectReference.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectReference.ProjectReference(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Immutable.ImmutableArray<string> aliases = default(System.Collections.Immutable.ImmutableArray<string>), bool embedInteropTypes = false) -> void
Microsoft.CodeAnalysis.Recommendations.RecommendationOptions
Microsoft.CodeAnalysis.Recommendations.Recommender
Microsoft.CodeAnalysis.Rename.RenameEntityKind
Microsoft.CodeAnalysis.Rename.RenameEntityKind.BaseSymbol = 0 -> Microsoft.CodeAnalysis.Rename.RenameEntityKind
Microsoft.CodeAnalysis.Rename.RenameEntityKind.OverloadedSymbols = 1 -> Microsoft.CodeAnalysis.Rename.RenameEntityKind
Microsoft.CodeAnalysis.Rename.RenameOptions
Microsoft.CodeAnalysis.Rename.Renamer
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction.GetErrors(System.Globalization.CultureInfo culture = null) -> System.Collections.Immutable.ImmutableArray<string>
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.ApplicableActions.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction>
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.UpdateSolutionAsync(Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction> actions, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.UpdateSolutionAsync(Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
Microsoft.CodeAnalysis.Simplification.SimplificationOptions
Microsoft.CodeAnalysis.Simplification.Simplifier
Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocument(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerConfigDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.SyntaxNode syntaxRoot, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null, bool isGenerated = false, Microsoft.CodeAnalysis.PreservationMode preservationMode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null, bool isGenerated = false) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.TextLoader loader, System.Collections.Generic.IEnumerable<string> folders = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddMetadataReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProject(Microsoft.CodeAnalysis.ProjectId projectId, string name, string assemblyName, string language) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProject(Microsoft.CodeAnalysis.ProjectInfo projectInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProject(string name, string assemblyName, string language) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.AddProjectReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProjectReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.Solution.ContainsAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Solution.ContainsAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Solution.ContainsDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Solution.ContainsProject(Microsoft.CodeAnalysis.ProjectId projectId) -> bool
Microsoft.CodeAnalysis.Solution.FilePath.get -> string
Microsoft.CodeAnalysis.Solution.GetAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Solution.GetAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.AnalyzerConfigDocument
Microsoft.CodeAnalysis.Solution.GetChanges(Microsoft.CodeAnalysis.Solution oldSolution) -> Microsoft.CodeAnalysis.SolutionChanges
Microsoft.CodeAnalysis.Solution.GetDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Solution.GetDocument(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Solution.GetDocumentId(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.Solution.GetDocumentId(Microsoft.CodeAnalysis.SyntaxTree syntaxTree, Microsoft.CodeAnalysis.ProjectId projectId) -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.Solution.GetDocumentIdsWithFilePath(string filePath) -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Solution.GetIsolatedSolution() -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.GetLatestProjectVersion() -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Solution.GetProject(Microsoft.CodeAnalysis.IAssemblySymbol assemblySymbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.GetProject(Microsoft.CodeAnalysis.ProjectId projectId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.GetProjectDependencyGraph() -> Microsoft.CodeAnalysis.ProjectDependencyGraph
Microsoft.CodeAnalysis.Solution.Id.get -> Microsoft.CodeAnalysis.SolutionId
Microsoft.CodeAnalysis.Solution.Options.get -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Solution.ProjectIds.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.Solution.Projects.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>
Microsoft.CodeAnalysis.Solution.RemoveAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAdditionalDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerConfigDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveProject(Microsoft.CodeAnalysis.ProjectId projectId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveProjectReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Solution.WithAdditionalDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAdditionalDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAdditionalDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentFilePath(Microsoft.CodeAnalysis.DocumentId documentId, string filePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentFolders(Microsoft.CodeAnalysis.DocumentId documentId, System.Collections.Generic.IEnumerable<string> folders) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentName(Microsoft.CodeAnalysis.DocumentId documentId, string name) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentSourceCodeKind(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.SourceCodeKind sourceCodeKind) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentSyntaxRoot(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentText(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId> documentIds, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithOptions(Microsoft.CodeAnalysis.Options.OptionSet options) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectAnalyzerReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectAssemblyName(Microsoft.CodeAnalysis.ProjectId projectId, string assemblyName) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectCompilationOptions(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.CompilationOptions options) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectCompilationOutputInfo(Microsoft.CodeAnalysis.ProjectId projectId, in Microsoft.CodeAnalysis.CompilationOutputInfo info) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectDefaultNamespace(Microsoft.CodeAnalysis.ProjectId projectId, string defaultNamespace) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectDocumentsOrder(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Immutable.ImmutableList<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectFilePath(Microsoft.CodeAnalysis.ProjectId projectId, string filePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectMetadataReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectName(Microsoft.CodeAnalysis.ProjectId projectId, string name) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectOutputFilePath(Microsoft.CodeAnalysis.ProjectId projectId, string outputFilePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectOutputRefFilePath(Microsoft.CodeAnalysis.ProjectId projectId, string outputRefFilePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectParseOptions(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ParseOptions options) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.Workspace.get -> Microsoft.CodeAnalysis.Workspace
Microsoft.CodeAnalysis.SolutionChanges
Microsoft.CodeAnalysis.SolutionChanges.GetAddedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.SolutionChanges.GetAddedProjects() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>
Microsoft.CodeAnalysis.SolutionChanges.GetProjectChanges() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectChanges>
Microsoft.CodeAnalysis.SolutionChanges.GetRemovedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.SolutionChanges.GetRemovedProjects() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>
Microsoft.CodeAnalysis.SolutionChanges.SolutionChanges() -> void
Microsoft.CodeAnalysis.SolutionId
Microsoft.CodeAnalysis.SolutionId.Equals(Microsoft.CodeAnalysis.SolutionId other) -> bool
Microsoft.CodeAnalysis.SolutionId.Id.get -> System.Guid
Microsoft.CodeAnalysis.SolutionInfo
Microsoft.CodeAnalysis.SolutionInfo.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.SolutionInfo.FilePath.get -> string
Microsoft.CodeAnalysis.SolutionInfo.Id.get -> Microsoft.CodeAnalysis.SolutionId
Microsoft.CodeAnalysis.SolutionInfo.Projects.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectInfo>
Microsoft.CodeAnalysis.SolutionInfo.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Tags.WellKnownTags
Microsoft.CodeAnalysis.TextAndVersion
Microsoft.CodeAnalysis.TextAndVersion.FilePath.get -> string
Microsoft.CodeAnalysis.TextAndVersion.Text.get -> Microsoft.CodeAnalysis.Text.SourceText
Microsoft.CodeAnalysis.TextAndVersion.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.TextDocument.FilePath.get -> string
Microsoft.CodeAnalysis.TextDocument.Folders.get -> System.Collections.Generic.IReadOnlyList<string>
Microsoft.CodeAnalysis.TextDocument.GetTextAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Text.SourceText>
Microsoft.CodeAnalysis.TextDocument.GetTextVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.TextDocument.Id.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.TextDocument.Name.get -> string
Microsoft.CodeAnalysis.TextDocument.Project.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.TextDocument.TryGetText(out Microsoft.CodeAnalysis.Text.SourceText text) -> bool
Microsoft.CodeAnalysis.TextDocument.TryGetTextVersion(out Microsoft.CodeAnalysis.VersionStamp version) -> bool
Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.AdditionalDocument = 1 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.AnalyzerConfigDocument = 2 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.Document = 0 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextLoader
Microsoft.CodeAnalysis.TextLoader.TextLoader() -> void
Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.VersionStamp.Equals(Microsoft.CodeAnalysis.VersionStamp version) -> bool
Microsoft.CodeAnalysis.VersionStamp.GetNewerVersion() -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.VersionStamp.GetNewerVersion(Microsoft.CodeAnalysis.VersionStamp version) -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.VersionStamp.VersionStamp() -> void
Microsoft.CodeAnalysis.Workspace
Microsoft.CodeAnalysis.Workspace.CheckAdditionalDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAdditionalDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAnalyzerConfigDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAnalyzerConfigDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckCanOpenDocuments() -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsClosed(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsOpen(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotContainOpenDocuments(Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveProjectReference(Microsoft.CodeAnalysis.ProjectId fromProjectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveTransitiveProjectReference(Microsoft.CodeAnalysis.ProjectId fromProjectId, Microsoft.CodeAnalysis.ProjectId toProjectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectHasAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectHasMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectHasProjectReference(Microsoft.CodeAnalysis.ProjectId fromProjectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectIsInCurrentSolution(Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectIsNotInCurrentSolution(Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckSolutionIsEmpty() -> void
Microsoft.CodeAnalysis.Workspace.ClearOpenDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.ClearOpenDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool isSolutionClosing) -> void
Microsoft.CodeAnalysis.Workspace.ClearSolution() -> void
Microsoft.CodeAnalysis.Workspace.CreateSolution(Microsoft.CodeAnalysis.SolutionId id) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.CreateSolution(Microsoft.CodeAnalysis.SolutionInfo solutionInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.CurrentSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.Dispose() -> void
Microsoft.CodeAnalysis.Workspace.DocumentActiveContextChanged -> System.EventHandler<Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs>
Microsoft.CodeAnalysis.Workspace.DocumentClosed -> System.EventHandler<Microsoft.CodeAnalysis.DocumentEventArgs>
Microsoft.CodeAnalysis.Workspace.DocumentOpened -> System.EventHandler<Microsoft.CodeAnalysis.DocumentEventArgs>
Microsoft.CodeAnalysis.Workspace.Kind.get -> string
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentClosed(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader reloader) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentOpened(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, bool isCurrentContext = true) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText newText, Microsoft.CodeAnalysis.PreservationMode mode) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentTextLoaderChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentClosed(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader reloader) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentOpened(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, bool isCurrentContext = true) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText newText, Microsoft.CodeAnalysis.PreservationMode mode) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentTextLoaderChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.OnAssemblyNameChanged(Microsoft.CodeAnalysis.ProjectId projectId, string assemblyName) -> void
Microsoft.CodeAnalysis.Workspace.OnCompilationOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.CompilationOptions options) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentClosed(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader reloader, bool updateActiveContext = false) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentContextUpdated(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentInfoChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.DocumentInfo newInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentOpened(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, bool isCurrentContext = true) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentReloaded(Microsoft.CodeAnalysis.DocumentInfo newDocumentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentsAdded(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentSourceCodeKindChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.SourceCodeKind sourceCodeKind) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText newText, Microsoft.CodeAnalysis.PreservationMode mode) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentTextLoaderChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader) -> void
Microsoft.CodeAnalysis.Workspace.OnMetadataReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.OnMetadataReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.OnOutputFilePathChanged(Microsoft.CodeAnalysis.ProjectId projectId, string outputFilePath) -> void
Microsoft.CodeAnalysis.Workspace.OnOutputRefFilePathChanged(Microsoft.CodeAnalysis.ProjectId projectId, string outputFilePath) -> void
Microsoft.CodeAnalysis.Workspace.OnParseOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ParseOptions options) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectAdded(Microsoft.CodeAnalysis.ProjectInfo projectInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectNameChanged(Microsoft.CodeAnalysis.ProjectId projectId, string name, string filePath) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.OnSolutionAdded(Microsoft.CodeAnalysis.SolutionInfo solutionInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnSolutionReloaded(Microsoft.CodeAnalysis.SolutionInfo reloadedSolutionInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnSolutionRemoved() -> void
Microsoft.CodeAnalysis.Workspace.Options.get -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Workspace.Options.set -> void
Microsoft.CodeAnalysis.Workspace.RaiseDocumentActiveContextChangedEventAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseDocumentActiveContextChangedEventAsync(Microsoft.CodeAnalysis.Text.SourceTextContainer sourceTextContainer, Microsoft.CodeAnalysis.DocumentId oldActiveContextDocumentId, Microsoft.CodeAnalysis.DocumentId newActiveContextDocumentId) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseDocumentClosedEventAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseDocumentOpenedEventAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseWorkspaceChangedEventAsync(Microsoft.CodeAnalysis.WorkspaceChangeKind kind, Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution newSolution, Microsoft.CodeAnalysis.ProjectId projectId = null, Microsoft.CodeAnalysis.DocumentId documentId = null) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RegisterText(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer) -> void
Microsoft.CodeAnalysis.Workspace.ScheduleTask(System.Action action, string taskName = "Workspace.Task") -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.ScheduleTask<T>(System.Func<T> func, string taskName = "Workspace.Task") -> System.Threading.Tasks.Task<T>
Microsoft.CodeAnalysis.Workspace.Services.get -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
Microsoft.CodeAnalysis.Workspace.SetCurrentSolution(Microsoft.CodeAnalysis.Solution solution) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.UnregisterText(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer) -> void
Microsoft.CodeAnalysis.Workspace.UpdateReferencesAfterAdd() -> void
Microsoft.CodeAnalysis.Workspace.Workspace(Microsoft.CodeAnalysis.Host.HostServices host, string workspaceKind) -> void
Microsoft.CodeAnalysis.Workspace.WorkspaceChanged -> System.EventHandler<Microsoft.CodeAnalysis.WorkspaceChangeEventArgs>
Microsoft.CodeAnalysis.Workspace.WorkspaceFailed -> System.EventHandler<Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs>
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.DocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.Kind.get -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.NewSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.OldSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.WorkspaceChangeEventArgs(Microsoft.CodeAnalysis.WorkspaceChangeKind kind, Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution newSolution, Microsoft.CodeAnalysis.ProjectId projectId = null, Microsoft.CodeAnalysis.DocumentId documentId = null) -> void
Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentAdded = 13 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentChanged = 16 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentReloaded = 15 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentRemoved = 14 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentAdded = 18 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentChanged = 21 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentReloaded = 20 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentRemoved = 19 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentAdded = 9 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentChanged = 12 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentInfoChanged = 17 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentReloaded = 11 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentRemoved = 10 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectAdded = 5 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectChanged = 7 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectReloaded = 8 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectRemoved = 6 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionAdded = 1 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionChanged = 0 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionCleared = 3 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionReloaded = 4 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionRemoved = 2 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceDiagnostic
Microsoft.CodeAnalysis.WorkspaceDiagnostic.Kind.get -> Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceDiagnostic.Message.get -> string
Microsoft.CodeAnalysis.WorkspaceDiagnostic.WorkspaceDiagnostic(Microsoft.CodeAnalysis.WorkspaceDiagnosticKind kind, string message) -> void
Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs
Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs.Diagnostic.get -> Microsoft.CodeAnalysis.WorkspaceDiagnostic
Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs.WorkspaceDiagnosticEventArgs(Microsoft.CodeAnalysis.WorkspaceDiagnostic diagnostic) -> void
Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceDiagnosticKind.Failure = 0 -> Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceDiagnosticKind.Warning = 1 -> Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceKind
Microsoft.CodeAnalysis.WorkspaceRegistration
Microsoft.CodeAnalysis.WorkspaceRegistration.Workspace.get -> Microsoft.CodeAnalysis.Workspace
Microsoft.CodeAnalysis.WorkspaceRegistration.WorkspaceChanged -> System.EventHandler
Microsoft.CodeAnalysis.XmlDocumentationProvider
Microsoft.CodeAnalysis.XmlDocumentationProvider.XmlDocumentationProvider() -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.CanApplyChange(Microsoft.CodeAnalysis.ApplyChangesKind feature) -> bool
override Microsoft.CodeAnalysis.AdhocWorkspace.CanOpenDocuments.get -> bool
override Microsoft.CodeAnalysis.AdhocWorkspace.CloseAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.CloseAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.CloseDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.OpenAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.OpenAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.OpenDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
override Microsoft.CodeAnalysis.Classification.ClassifiedSpan.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Classification.ClassifiedSpan.GetHashCode() -> int
override Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void
override Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
override Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void
override Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.GetHashCode() -> int
override Microsoft.CodeAnalysis.CodeStyle.NotificationOption.ToString() -> string
override Microsoft.CodeAnalysis.CompilationOutputInfo.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.CompilationOutputInfo.GetHashCode() -> int
override Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Differencing.Edit<TNode>.GetHashCode() -> int
override Microsoft.CodeAnalysis.DocumentId.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.DocumentId.GetHashCode() -> int
override Microsoft.CodeAnalysis.DocumentId.ToString() -> string
override Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Editing.DeclarationModifiers.GetHashCode() -> int
override Microsoft.CodeAnalysis.Editing.DeclarationModifiers.ToString() -> string
override Microsoft.CodeAnalysis.FileTextLoader.LoadTextAndVersionAsync(Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.DocumentId documentId, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.TextAndVersion>
override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.GetHashCode() -> int
override Microsoft.CodeAnalysis.Host.Mef.MefHostServices.CreateWorkspaceServices(Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
override Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption(Microsoft.CodeAnalysis.Options.OptionKey optionAndLanguage, object value) -> Microsoft.CodeAnalysis.Options.OptionSet
override Microsoft.CodeAnalysis.Options.Option<T>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Options.Option<T>.GetHashCode() -> int
override Microsoft.CodeAnalysis.Options.Option<T>.ToString() -> string
override Microsoft.CodeAnalysis.Options.OptionKey.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Options.OptionKey.GetHashCode() -> int
override Microsoft.CodeAnalysis.Options.OptionKey.ToString() -> string
override Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.GetHashCode() -> int
override Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.ToString() -> string
override Microsoft.CodeAnalysis.ProjectId.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.ProjectId.GetHashCode() -> int
override Microsoft.CodeAnalysis.ProjectId.ToString() -> string
override Microsoft.CodeAnalysis.ProjectReference.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.ProjectReference.GetHashCode() -> int
override Microsoft.CodeAnalysis.SolutionId.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.SolutionId.GetHashCode() -> int
override Microsoft.CodeAnalysis.VersionStamp.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.VersionStamp.GetHashCode() -> int
override Microsoft.CodeAnalysis.VersionStamp.ToString() -> string
override Microsoft.CodeAnalysis.WorkspaceDiagnostic.ToString() -> string
override Microsoft.CodeAnalysis.XmlDocumentationProvider.GetDocumentationForSymbol(string documentationMemberID, System.Globalization.CultureInfo preferredCulture, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string
static Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.AdditiveTypeNames.get -> System.Collections.Immutable.ImmutableArray<string>
static Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpans(Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Text.TextSpan textSpan, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Classification.ClassifiedSpan>
static Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpansAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Classification.ClassifiedSpan>>
static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeAction> nestedActions, bool isInlinable) -> Microsoft.CodeAnalysis.CodeActions.CodeAction
static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>> createChangedDocument, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction
static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>> createChangedSolution, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction
static Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.Create(string description) -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.GetDescription(Microsoft.CodeAnalysis.SyntaxAnnotation annotation) -> string
static Microsoft.CodeAnalysis.CodeActions.RenameAnnotation.Create() -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.Create(string description) -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.GetDescription(Microsoft.CodeAnalysis.SyntaxAnnotation annotation) -> string
static Microsoft.CodeAnalysis.CodeFixes.WellKnownFixAllProviders.BatchFixer.get -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider
static Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Default.get -> Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
static Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.FromXElement(System.Xml.Linq.XElement element) -> Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
static Microsoft.CodeAnalysis.CompilationOutputInfo.operator !=(in Microsoft.CodeAnalysis.CompilationOutputInfo left, in Microsoft.CodeAnalysis.CompilationOutputInfo right) -> bool
static Microsoft.CodeAnalysis.CompilationOutputInfo.operator ==(in Microsoft.CodeAnalysis.CompilationOutputInfo left, in Microsoft.CodeAnalysis.CompilationOutputInfo right) -> bool
static Microsoft.CodeAnalysis.DocumentId.CreateFromSerialized(Microsoft.CodeAnalysis.ProjectId projectId, System.Guid id, string debugName = null) -> Microsoft.CodeAnalysis.DocumentId
static Microsoft.CodeAnalysis.DocumentId.CreateNewId(Microsoft.CodeAnalysis.ProjectId projectId, string debugName = null) -> Microsoft.CodeAnalysis.DocumentId
static Microsoft.CodeAnalysis.DocumentId.operator !=(Microsoft.CodeAnalysis.DocumentId left, Microsoft.CodeAnalysis.DocumentId right) -> bool
static Microsoft.CodeAnalysis.DocumentId.operator ==(Microsoft.CodeAnalysis.DocumentId left, Microsoft.CodeAnalysis.DocumentId right) -> bool
static Microsoft.CodeAnalysis.DocumentInfo.Create(Microsoft.CodeAnalysis.DocumentId id, string name, System.Collections.Generic.IEnumerable<string> folders = null, Microsoft.CodeAnalysis.SourceCodeKind sourceCodeKind = Microsoft.CodeAnalysis.SourceCodeKind.Regular, Microsoft.CodeAnalysis.TextLoader loader = null, string filePath = null, bool isGenerated = false) -> Microsoft.CodeAnalysis.DocumentInfo
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Abstract.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Async.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Const.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Extern.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.From(Microsoft.CodeAnalysis.ISymbol symbol) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.New.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.None.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator !=(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> bool
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator &(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator +(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator -(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator ==(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> bool
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator |(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Override.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Partial.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.ReadOnly.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Ref.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Sealed.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Static.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.TryParse(string value, out Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Unsafe.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Virtual.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Volatile.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithEvents.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WriteOnly.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DocumentEditor.CreateAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Editing.DocumentEditor>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.SymbolEditor.Create(Microsoft.CodeAnalysis.Document document) -> Microsoft.CodeAnalysis.Editing.SymbolEditor
static Microsoft.CodeAnalysis.Editing.SymbolEditor.Create(Microsoft.CodeAnalysis.Solution solution) -> Microsoft.CodeAnalysis.Editing.SymbolEditor
static Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions.GetBaseOrInterfaceDeclarationReferenceAsync(this Microsoft.CodeAnalysis.Editing.SymbolEditor editor, Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.ITypeSymbol baseOrInterfaceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxNode>
static Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions.SetBaseTypeAsync(this Microsoft.CodeAnalysis.Editing.SymbolEditor editor, Microsoft.CodeAnalysis.INamedTypeSymbol symbol, Microsoft.CodeAnalysis.ITypeSymbol newBaseType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions.SetBaseTypeAsync(this Microsoft.CodeAnalysis.Editing.SymbolEditor editor, Microsoft.CodeAnalysis.INamedTypeSymbol symbol, System.Func<Microsoft.CodeAnalysis.Editing.SyntaxGenerator, Microsoft.CodeAnalysis.SyntaxNode> getNewBaseType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddAttribute(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode attribute) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddAttributeArgument(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration, Microsoft.CodeAnalysis.SyntaxNode attributeArgument) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddBaseType(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode baseType) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddInterfaceType(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddMember(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode member) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddParameter(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode parameter) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddReturnAttribute(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode attribute) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.InsertMembers(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.InsertParameter(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, int index, Microsoft.CodeAnalysis.SyntaxNode parameter) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetAccessibility(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Accessibility accessibility) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetExpression(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode expression) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetGetAccessorStatements(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetModifiers(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetName(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, string name) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetSetAccessorStatements(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetStatements(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetType(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode type) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetTypeConstraint(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kind, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> types) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetTypeParameters(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<string> typeParameters) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultRemoveOptions -> Microsoft.CodeAnalysis.SyntaxRemoveOptions
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGenerator(Microsoft.CodeAnalysis.Document document) -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGenerator(Microsoft.CodeAnalysis.Project project) -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGenerator(Microsoft.CodeAnalysis.Workspace workspace, string language) -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PreserveTrivia<TNode>(TNode node, System.Func<TNode, Microsoft.CodeAnalysis.SyntaxNode> nodeChanger) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveRange<TNode>(Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode> list, int offset, int count) -> Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode>
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveRange<TNode>(Microsoft.CodeAnalysis.SyntaxList<TNode> list, int offset, int count) -> Microsoft.CodeAnalysis.SyntaxList<TNode>
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceRange(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> replacements) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceWithTrivia(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode original, Microsoft.CodeAnalysis.SyntaxNode replacement) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceWithTrivia(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxToken original, Microsoft.CodeAnalysis.SyntaxToken replacement) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceWithTrivia<TNode>(Microsoft.CodeAnalysis.SyntaxNode root, TNode original, System.Func<TNode, Microsoft.CodeAnalysis.SyntaxNode> replacer) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.operator !=(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation left, Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation right) -> bool
static Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.operator ==(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation left, Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation right) -> bool
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindCallersAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Document> documents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindCallersAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDerivedClassesAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, bool transitive = true, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDerivedClassesAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDerivedInterfacesAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, bool transitive = true, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindImplementationsAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, bool transitive = true, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindImplementationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindImplementedInterfaceMembersAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindOverridesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindReferencesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress progress, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Document> documents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindReferencesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Document> documents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindReferencesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSimilarSymbols<TSymbol>(TSymbol symbol, Microsoft.CodeAnalysis.Compilation compilation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<TSymbol>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, System.Func<string, bool> predicate, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, System.Func<string, bool> predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, string name, bool ignoreCase, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, string name, bool ignoreCase, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, System.Func<string, bool> predicate, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, System.Func<string, bool> predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Project project, string pattern, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Project project, string pattern, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Solution solution, string pattern, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Solution solution, string pattern, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDefinitionAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSymbolAtPosition(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSymbolAtPositionAsync(Microsoft.CodeAnalysis.Document document, int position, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSymbolAtPositionAsync(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Formatting.Formatter.Annotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IList<Microsoft.CodeAnalysis.Text.TextChange>
static Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IList<Microsoft.CodeAnalysis.Text.TextChange>
static Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IList<Microsoft.CodeAnalysis.Text.TextChange>
static Microsoft.CodeAnalysis.Formatting.Formatter.OrganizeImportsAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentationSize.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<int>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.NewLine.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<string>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.SmartIndent.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<int>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies) -> Microsoft.CodeAnalysis.Host.Mef.MefHostServices
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create(System.Composition.CompositionContext compositionContext) -> Microsoft.CodeAnalysis.Host.Mef.MefHostServices
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.DefaultAssemblies.get -> System.Collections.Immutable.ImmutableArray<System.Reflection.Assembly>
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.DefaultHost.get -> Microsoft.CodeAnalysis.Host.Mef.MefHostServices
static Microsoft.CodeAnalysis.Options.Option<T>.implicit operator Microsoft.CodeAnalysis.Options.OptionKey(Microsoft.CodeAnalysis.Options.Option<T> option) -> Microsoft.CodeAnalysis.Options.OptionKey
static Microsoft.CodeAnalysis.Options.OptionKey.operator !=(Microsoft.CodeAnalysis.Options.OptionKey left, Microsoft.CodeAnalysis.Options.OptionKey right) -> bool
static Microsoft.CodeAnalysis.Options.OptionKey.operator ==(Microsoft.CodeAnalysis.Options.OptionKey left, Microsoft.CodeAnalysis.Options.OptionKey right) -> bool
static Microsoft.CodeAnalysis.ProjectId.CreateFromSerialized(System.Guid id, string debugName = null) -> Microsoft.CodeAnalysis.ProjectId
static Microsoft.CodeAnalysis.ProjectId.CreateNewId(string debugName = null) -> Microsoft.CodeAnalysis.ProjectId
static Microsoft.CodeAnalysis.ProjectId.operator !=(Microsoft.CodeAnalysis.ProjectId left, Microsoft.CodeAnalysis.ProjectId right) -> bool
static Microsoft.CodeAnalysis.ProjectId.operator ==(Microsoft.CodeAnalysis.ProjectId left, Microsoft.CodeAnalysis.ProjectId right) -> bool
static Microsoft.CodeAnalysis.ProjectInfo.Create(Microsoft.CodeAnalysis.ProjectId id, Microsoft.CodeAnalysis.VersionStamp version, string name, string assemblyName, string language, string filePath = null, string outputFilePath = null, Microsoft.CodeAnalysis.CompilationOptions compilationOptions = null, Microsoft.CodeAnalysis.ParseOptions parseOptions = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> documents = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> additionalDocuments = null, bool isSubmission = false, System.Type hostObjectType = null, string outputRefFilePath = null) -> Microsoft.CodeAnalysis.ProjectInfo
static Microsoft.CodeAnalysis.ProjectInfo.Create(Microsoft.CodeAnalysis.ProjectId id, Microsoft.CodeAnalysis.VersionStamp version, string name, string assemblyName, string language, string filePath, string outputFilePath, Microsoft.CodeAnalysis.CompilationOptions compilationOptions, Microsoft.CodeAnalysis.ParseOptions parseOptions, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> documents, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> additionalDocuments, bool isSubmission, System.Type hostObjectType) -> Microsoft.CodeAnalysis.ProjectInfo
static Microsoft.CodeAnalysis.ProjectReference.operator !=(Microsoft.CodeAnalysis.ProjectReference left, Microsoft.CodeAnalysis.ProjectReference right) -> bool
static Microsoft.CodeAnalysis.ProjectReference.operator ==(Microsoft.CodeAnalysis.ProjectReference left, Microsoft.CodeAnalysis.ProjectReference right) -> bool
static Microsoft.CodeAnalysis.Recommendations.RecommendationOptions.FilterOutOfScopeLocals.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Recommendations.RecommendationOptions.HideAdvancedMembers.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPosition(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPositionAsync(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.Rename.RenameOptions.PreviewChanges.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameInComments.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameInStrings.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameOverloads.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAsync(Microsoft.CodeAnalysis.Document document, string newDocumentName, System.Collections.Generic.IReadOnlyList<string> newDocumentFolders = null, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet>
static Microsoft.CodeAnalysis.Rename.Renamer.RenameSymbolAsync(Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.ISymbol symbol, string newName, Microsoft.CodeAnalysis.Options.OptionSet optionSet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.AllowSimplificationToBaseType.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.AllowSimplificationToGenericType.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferAliasToQualification.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferImplicitTypeInference.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferImplicitTypeInLocalDeclaration.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferOmittingModuleNamesInQualification.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyEventAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyFieldAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyMemberAccessWithThisOrMe.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyMethodAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyPropertyAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.Simplifier.AddImportsAnnotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.Simplification.Simplifier.Annotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.Simplification.Simplifier.Expand(Microsoft.CodeAnalysis.SyntaxToken token, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Workspace workspace, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxToken
static Microsoft.CodeAnalysis.Simplification.Simplifier.Expand<TNode>(TNode node, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Workspace workspace, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, bool expandParameter = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> TNode
static Microsoft.CodeAnalysis.Simplification.Simplifier.ExpandAsync(Microsoft.CodeAnalysis.SyntaxToken token, Microsoft.CodeAnalysis.Document document, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxToken>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ExpandAsync<TNode>(TNode node, Microsoft.CodeAnalysis.Document document, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, bool expandParameter = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<TNode>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.SpecialTypeAnnotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.SolutionId.CreateFromSerialized(System.Guid id, string debugName = null) -> Microsoft.CodeAnalysis.SolutionId
static Microsoft.CodeAnalysis.SolutionId.CreateNewId(string debugName = null) -> Microsoft.CodeAnalysis.SolutionId
static Microsoft.CodeAnalysis.SolutionId.operator !=(Microsoft.CodeAnalysis.SolutionId left, Microsoft.CodeAnalysis.SolutionId right) -> bool
static Microsoft.CodeAnalysis.SolutionId.operator ==(Microsoft.CodeAnalysis.SolutionId left, Microsoft.CodeAnalysis.SolutionId right) -> bool
static Microsoft.CodeAnalysis.SolutionInfo.Create(Microsoft.CodeAnalysis.SolutionId id, Microsoft.CodeAnalysis.VersionStamp version, string filePath = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectInfo> projects = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences = null) -> Microsoft.CodeAnalysis.SolutionInfo
static Microsoft.CodeAnalysis.SolutionInfo.Create(Microsoft.CodeAnalysis.SolutionId id, Microsoft.CodeAnalysis.VersionStamp version, string filePath, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectInfo> projects) -> Microsoft.CodeAnalysis.SolutionInfo
static Microsoft.CodeAnalysis.TextAndVersion.Create(Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.VersionStamp version, string filePath = null) -> Microsoft.CodeAnalysis.TextAndVersion
static Microsoft.CodeAnalysis.TextLoader.From(Microsoft.CodeAnalysis.Text.SourceTextContainer container, Microsoft.CodeAnalysis.VersionStamp version, string filePath = null) -> Microsoft.CodeAnalysis.TextLoader
static Microsoft.CodeAnalysis.TextLoader.From(Microsoft.CodeAnalysis.TextAndVersion textAndVersion) -> Microsoft.CodeAnalysis.TextLoader
static Microsoft.CodeAnalysis.VersionStamp.Create() -> Microsoft.CodeAnalysis.VersionStamp
static Microsoft.CodeAnalysis.VersionStamp.Create(System.DateTime utcTimeLastModified) -> Microsoft.CodeAnalysis.VersionStamp
static Microsoft.CodeAnalysis.VersionStamp.Default.get -> Microsoft.CodeAnalysis.VersionStamp
static Microsoft.CodeAnalysis.VersionStamp.operator !=(Microsoft.CodeAnalysis.VersionStamp left, Microsoft.CodeAnalysis.VersionStamp right) -> bool
static Microsoft.CodeAnalysis.VersionStamp.operator ==(Microsoft.CodeAnalysis.VersionStamp left, Microsoft.CodeAnalysis.VersionStamp right) -> bool
static Microsoft.CodeAnalysis.Workspace.GetWorkspaceRegistration(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer) -> Microsoft.CodeAnalysis.WorkspaceRegistration
static Microsoft.CodeAnalysis.Workspace.TryGetWorkspace(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, out Microsoft.CodeAnalysis.Workspace workspace) -> bool
static Microsoft.CodeAnalysis.XmlDocumentationProvider.CreateFromBytes(byte[] xmlDocCommentBytes) -> Microsoft.CodeAnalysis.XmlDocumentationProvider
static Microsoft.CodeAnalysis.XmlDocumentationProvider.CreateFromFile(string xmlDocCommentFilePath) -> Microsoft.CodeAnalysis.XmlDocumentationProvider
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyEventAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyFieldAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyMethodAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyPropertyAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Error -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.None -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Silent -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Suggestion -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Warning -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.EquivalenceKey.get -> string
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedDocumentAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.Tags.get -> System.Collections.Immutable.ImmutableArray<string>
virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void
virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Title.get -> string
virtual Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.GetFixAllProvider() -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider
virtual Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetSupportedFixAllDiagnosticIds(Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider originalCodeFixProvider) -> System.Collections.Generic.IEnumerable<string>
virtual Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetSupportedFixAllScopes() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeFixes.FixAllScope>
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNodesAfter(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNodesBefore(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode memberName) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.OperatorDeclaration(Microsoft.CodeAnalysis.Editing.OperatorKind kind, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, Microsoft.CodeAnalysis.SyntaxNode returnType = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxRemoveOptions options) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceNode(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newDeclaration) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.FileTextLoader.CreateText(System.IO.Stream stream, Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Text.SourceText
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetLanguageServices(string languageName) -> Microsoft.CodeAnalysis.Host.HostLanguageServices
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.IsSupported(string languageName) -> bool
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.PersistentStorage.get -> Microsoft.CodeAnalysis.Host.IPersistentStorageService
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.SupportedLanguages.get -> System.Collections.Generic.IEnumerable<string>
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.TemporaryStorage.get -> Microsoft.CodeAnalysis.Host.ITemporaryStorageService
virtual Microsoft.CodeAnalysis.Workspace.AdjustReloadedProject(Microsoft.CodeAnalysis.Project oldProject, Microsoft.CodeAnalysis.Project reloadedProject) -> Microsoft.CodeAnalysis.Project
virtual Microsoft.CodeAnalysis.Workspace.AdjustReloadedSolution(Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution reloadedSolution) -> Microsoft.CodeAnalysis.Solution
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerConfigDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerConfigDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerConfigDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyCompilationOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.CompilationOptions options) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentInfoChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.DocumentInfo info) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyMetadataReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyMetadataReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyParseOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ParseOptions options) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectAdded(Microsoft.CodeAnalysis.ProjectInfo project) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectChanges(Microsoft.CodeAnalysis.ProjectChanges projectChanges) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectRemoved(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CanApplyChange(Microsoft.CodeAnalysis.ApplyChangesKind feature) -> bool
virtual Microsoft.CodeAnalysis.Workspace.CanApplyCompilationOptionChange(Microsoft.CodeAnalysis.CompilationOptions oldOptions, Microsoft.CodeAnalysis.CompilationOptions newOptions, Microsoft.CodeAnalysis.Project project) -> bool
virtual Microsoft.CodeAnalysis.Workspace.CanApplyParseOptionChange(Microsoft.CodeAnalysis.ParseOptions oldOptions, Microsoft.CodeAnalysis.ParseOptions newOptions, Microsoft.CodeAnalysis.Project project) -> bool
virtual Microsoft.CodeAnalysis.Workspace.CanOpenDocuments.get -> bool
virtual Microsoft.CodeAnalysis.Workspace.CheckDocumentCanBeRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CheckProjectCanBeRemoved(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ClearDocumentData(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ClearProjectData(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ClearSolutionData() -> void
virtual Microsoft.CodeAnalysis.Workspace.CloseAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CloseAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CloseDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.Dispose(bool finalize) -> void
virtual Microsoft.CodeAnalysis.Workspace.GetAdditionalDocumentName(Microsoft.CodeAnalysis.DocumentId documentId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetAnalyzerConfigDocumentName(Microsoft.CodeAnalysis.DocumentId documentId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetDocumentIdInCurrentContext(Microsoft.CodeAnalysis.Text.SourceTextContainer container) -> Microsoft.CodeAnalysis.DocumentId
virtual Microsoft.CodeAnalysis.Workspace.GetDocumentName(Microsoft.CodeAnalysis.DocumentId documentId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetOpenDocumentIds(Microsoft.CodeAnalysis.ProjectId projectId = null) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
virtual Microsoft.CodeAnalysis.Workspace.GetProjectName(Microsoft.CodeAnalysis.ProjectId projectId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetRelatedDocumentIds(Microsoft.CodeAnalysis.Text.SourceTextContainer container) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
virtual Microsoft.CodeAnalysis.Workspace.IsDocumentOpen(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
virtual Microsoft.CodeAnalysis.Workspace.OnDocumentClosing(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnDocumentTextChanged(Microsoft.CodeAnalysis.Document document) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnProjectReloaded(Microsoft.CodeAnalysis.ProjectInfo reloadedProjectInfo) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnProjectRemoved(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnWorkspaceFailed(Microsoft.CodeAnalysis.WorkspaceDiagnostic diagnostic) -> void
virtual Microsoft.CodeAnalysis.Workspace.OpenAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
virtual Microsoft.CodeAnalysis.Workspace.OpenAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
virtual Microsoft.CodeAnalysis.Workspace.OpenDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
virtual Microsoft.CodeAnalysis.Workspace.PartialSemanticsEnabled.get -> bool
virtual Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Microsoft.CodeAnalysis.Solution newSolution) -> bool
| abstract Microsoft.CodeAnalysis.CodeActions.CodeAction.Title.get -> string
abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.GetOptions(System.Threading.CancellationToken cancellationToken) -> object
abstract Microsoft.CodeAnalysis.CodeActions.PreviewOperation.GetPreviewAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<object>
abstract Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.FixableDiagnosticIds.get -> System.Collections.Immutable.ImmutableArray<string>
abstract Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.RegisterCodeFixesAsync(Microsoft.CodeAnalysis.CodeFixes.CodeFixContext context) -> System.Threading.Tasks.Task
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.GetAllDiagnosticsAsync(Microsoft.CodeAnalysis.Project project, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.GetDocumentDiagnosticsAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.GetProjectDiagnosticsAsync(Microsoft.CodeAnalysis.Project project, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>
abstract Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetFixAsync(Microsoft.CodeAnalysis.CodeFixes.FixAllContext fixAllContext) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.CodeActions.CodeAction>
abstract Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.ComputeRefactoringsAsync(Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext context) -> System.Threading.Tasks.Task
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetChildren(TNode node) -> System.Collections.Generic.IEnumerable<TNode>
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetDescendants(TNode node) -> System.Collections.Generic.IEnumerable<TNode>
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetDistance(TNode oldNode, TNode newNode) -> double
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetLabel(TNode node) -> int
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.GetSpan(TNode node) -> Microsoft.CodeAnalysis.Text.TextSpan
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.LabelCount.get -> int
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TiedToAncestor(int label) -> int
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TreesEqual(TNode oldNode, TNode newNode) -> bool
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TryGetParent(TNode node, out TNode parent) -> bool
abstract Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.ValuesEqual(TNode oldNode, TNode newNode) -> bool
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddBaseType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode baseType) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddEventHandler(Microsoft.CodeAnalysis.SyntaxNode event, Microsoft.CodeAnalysis.SyntaxNode handler) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddInterfaceType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AliasImportDeclaration(string aliasIdentifierName, Microsoft.CodeAnalysis.SyntaxNode name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Argument(string name, Microsoft.CodeAnalysis.RefKind refKind, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ArrayCreationExpression(Microsoft.CodeAnalysis.SyntaxNode elementType, Microsoft.CodeAnalysis.SyntaxNode size) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ArrayCreationExpression(Microsoft.CodeAnalysis.SyntaxNode elementType, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> elements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ArrayTypeExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPrivateInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType, string interfaceMemberName) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPublicInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType, string interfaceMemberName) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AssignmentStatement(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(Microsoft.CodeAnalysis.SyntaxNode name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AttributeArgument(string name, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AwaitExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BaseExpression() -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BitwiseAndExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BitwiseNotExpression(Microsoft.CodeAnalysis.SyntaxNode operand) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.BitwiseOrExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CastExpression(Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CatchClause(Microsoft.CodeAnalysis.SyntaxNode type, string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ClassDeclaration(string name, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), Microsoft.CodeAnalysis.SyntaxNode baseType = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> interfaceTypes = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ClearTrivia<TNode>(TNode node) -> TNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CoalesceExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CompilationUnit(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConditionalAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode whenNotNull) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConditionalExpression(Microsoft.CodeAnalysis.SyntaxNode condition, Microsoft.CodeAnalysis.SyntaxNode whenTrue, Microsoft.CodeAnalysis.SyntaxNode whenFalse) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConstructorDeclaration(string containingTypeName = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> baseConstructorArguments = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConvertExpression(Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CustomEventDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> addAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> removeAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultExpression(Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultSwitchSection(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DelegateDeclaration(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.SyntaxNode returnType = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers)) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DivideExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementBindingExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EnumDeclaration(string name, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EnumMember(string name, Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EventDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers)) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ExitSwitchStatement() -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ExpressionStatement(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FieldDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), Microsoft.CodeAnalysis.SyntaxNode initializer = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessibility(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.Accessibility
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessors(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAttributeArguments(Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetBaseAndInterfaceTypes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetDeclarationKind(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.Editing.DeclarationKind
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetExpression(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetMembers(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetModifiers(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetName(Microsoft.CodeAnalysis.SyntaxNode declaration) -> string
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetParameters(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetSetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetStatements(Microsoft.CodeAnalysis.SyntaxNode declaration) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetType(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GreaterThanExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GreaterThanOrEqualExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IdentifierName(string identifier) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IfStatement(Microsoft.CodeAnalysis.SyntaxNode condition, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> trueStatements, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> falseStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IndexerDeclaration(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAccessors(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> accessors) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAttributeArguments(Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> imports) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> switchSections) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InterfaceDeclaration(string name, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> interfaceTypes = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InvocationExpression(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IsTypeExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LambdaParameter(string identifier, Microsoft.CodeAnalysis.SyntaxNode type = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LessThanExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LessThanOrEqualExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LiteralExpression(object value) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LocalDeclarationStatement(Microsoft.CodeAnalysis.SyntaxNode type, string identifier, Microsoft.CodeAnalysis.SyntaxNode initializer = null, bool isConst = false) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LockStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LogicalAndExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LogicalNotExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LogicalOrExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberBindingExpression(Microsoft.CodeAnalysis.SyntaxNode name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MethodDeclaration(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.SyntaxNode returnType = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ModuloExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MultiplyExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NameExpression(Microsoft.CodeAnalysis.INamespaceOrTypeSymbol namespaceOrTypeSymbol) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NameOfExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(Microsoft.CodeAnalysis.SyntaxNode name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceImportDeclaration(Microsoft.CodeAnalysis.SyntaxNode name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NegateExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NullableTypeExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.SyntaxNode namedType, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ParameterDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type = null, Microsoft.CodeAnalysis.SyntaxNode initializer = null, Microsoft.CodeAnalysis.RefKind refKind = Microsoft.CodeAnalysis.RefKind.None) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PropertyDeclaration(string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.QualifiedName(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReferenceEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReferenceNotEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveEventHandler(Microsoft.CodeAnalysis.SyntaxNode event, Microsoft.CodeAnalysis.SyntaxNode handler) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReturnStatement(Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.StructDeclaration(string name, System.Collections.Generic.IEnumerable<string> typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> interfaceTypes = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SubtractExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchSection(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> caseExpressions, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> sections) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ThisExpression() -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ThrowExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ThrowStatement(Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCastExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCatchStatement(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> tryStatements, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> catchClauses, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> finallyStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleElementExpression(Microsoft.CodeAnalysis.SyntaxNode type, string name = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypedConstantExpression(Microsoft.CodeAnalysis.TypedConstant value) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeExpression(Microsoft.CodeAnalysis.ITypeSymbol typeSymbol) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeExpression(Microsoft.CodeAnalysis.SpecialType specialType) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeOfExpression(Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.UsingStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.UsingStatement(Microsoft.CodeAnalysis.SyntaxNode type, string name, Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueNotEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> lambdaParameters, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WhileStatement(Microsoft.CodeAnalysis.SyntaxNode condition, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessibility(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Accessibility accessibility) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessorDeclarations(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> accessorDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithExpression(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithGetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithModifiers(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithName(Microsoft.CodeAnalysis.SyntaxNode declaration, string name) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithSetAccessorStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeArguments(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> types = null) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<string> typeParameters) -> Microsoft.CodeAnalysis.SyntaxNode
abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.GetService<TLanguageService>() -> TLanguageService
abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.Language.get -> string
abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.WorkspaceServices.get -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
abstract Microsoft.CodeAnalysis.Host.HostServices.CreateWorkspaceServices(Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.FindLanguageServices<TLanguageService>(Microsoft.CodeAnalysis.Host.HostWorkspaceServices.MetadataFilter filter) -> System.Collections.Generic.IEnumerable<TLanguageService>
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetService<TWorkspaceService>() -> TWorkspaceService
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.HostServices.get -> Microsoft.CodeAnalysis.Host.HostServices
abstract Microsoft.CodeAnalysis.Host.HostWorkspaceServices.Workspace.get -> Microsoft.CodeAnalysis.Workspace
abstract Microsoft.CodeAnalysis.Options.OptionSet.WithChangedOption(Microsoft.CodeAnalysis.Options.OptionKey optionAndLanguage, object value) -> Microsoft.CodeAnalysis.Options.OptionSet
abstract Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction.GetDescription(System.Globalization.CultureInfo culture = null) -> string
abstract Microsoft.CodeAnalysis.TextLoader.LoadTextAndVersionAsync(Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.DocumentId documentId, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.TextAndVersion>
abstract Microsoft.CodeAnalysis.XmlDocumentationProvider.GetSourceStream(System.Threading.CancellationToken cancellationToken) -> System.IO.Stream
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ClassName = "class name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Comment = "comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ConstantName = "constant name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ControlKeyword = "keyword - control" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.DelegateName = "delegate name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.EnumMemberName = "enum member name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.EnumName = "enum name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.EventName = "event name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ExcludedCode = "excluded code" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ExtensionMethodName = "extension method name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.FieldName = "field name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Identifier = "identifier" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.InterfaceName = "interface name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Keyword = "keyword" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.LabelName = "label name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.LocalName = "local name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.MethodName = "method name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ModuleName = "module name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.NamespaceName = "namespace name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.NumericLiteral = "number" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Operator = "operator" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.OperatorOverloaded = "operator - overloaded" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.ParameterName = "parameter name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.PreprocessorKeyword = "preprocessor keyword" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.PreprocessorText = "preprocessor text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.PropertyName = "property name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Punctuation = "punctuation" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexAlternation = "regex - alternation" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexAnchor = "regex - anchor" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexCharacterClass = "regex - character class" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexComment = "regex - comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexGrouping = "regex - grouping" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexOtherEscape = "regex - other escape" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexQuantifier = "regex - quantifier" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexSelfEscapedCharacter = "regex - self escaped character" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.RegexText = "regex - text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StaticSymbol = "static symbol" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StringEscapeCharacter = "string - escape character" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StringLiteral = "string" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.StructName = "struct name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.Text = "text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.TypeParameterName = "type parameter name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.VerbatimStringLiteral = "string - verbatim" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.WhiteSpace = "whitespace" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentAttributeName = "xml doc comment - attribute name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentAttributeQuotes = "xml doc comment - attribute quotes" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentAttributeValue = "xml doc comment - attribute value" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentCDataSection = "xml doc comment - cdata section" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentComment = "xml doc comment - comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentDelimiter = "xml doc comment - delimiter" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentEntityReference = "xml doc comment - entity reference" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentName = "xml doc comment - name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentProcessingInstruction = "xml doc comment - processing instruction" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlDocCommentText = "xml doc comment - text" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralAttributeName = "xml literal - attribute name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralAttributeQuotes = "xml literal - attribute quotes" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralAttributeValue = "xml literal - attribute value" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralCDataSection = "xml literal - cdata section" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralComment = "xml literal - comment" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralDelimiter = "xml literal - delimiter" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralEmbeddedExpression = "xml literal - embedded expression" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralEntityReference = "xml literal - entity reference" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralName = "xml literal - name" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralProcessingInstruction = "xml literal - processing instruction" -> string
const Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.XmlLiteralText = "xml literal - text" -> string
const Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.Kind = "CodeAction_Conflict" -> string
const Microsoft.CodeAnalysis.CodeActions.RenameAnnotation.Kind = "CodeAction_Rename" -> string
const Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.Kind = "CodeAction_Warning" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Default = "Default" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Desktop = "Desktop" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Editor = "Editor" -> string
const Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Host = "Host" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Assembly = "Assembly" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Class = "Class" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Constant = "Constant" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Delegate = "Delegate" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Enum = "Enum" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.EnumMember = "EnumMember" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Error = "Error" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Event = "Event" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.ExtensionMethod = "ExtensionMethod" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Field = "Field" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.File = "File" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Folder = "Folder" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Interface = "Interface" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Internal = "Internal" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Intrinsic = "Intrinsic" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Keyword = "Keyword" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Label = "Label" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Local = "Local" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Method = "Method" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Module = "Module" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Namespace = "Namespace" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Operator = "Operator" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Parameter = "Parameter" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Private = "Private" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Project = "Project" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Property = "Property" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Protected = "Protected" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Public = "Public" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.RangeVariable = "RangeVariable" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Reference = "Reference" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Snippet = "Snippet" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Structure = "Structure" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.TypeParameter = "TypeParameter" -> string
const Microsoft.CodeAnalysis.Tags.WellKnownTags.Warning = "Warning" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Debugger = "Debugger" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Host = "Host" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Interactive = "Interactive" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.MetadataAsSource = "MetadataAsSource" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.MiscellaneousFiles = "MiscellaneousFiles" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.MSBuild = "MSBuildWorkspace" -> string
const Microsoft.CodeAnalysis.WorkspaceKind.Preview = "Preview" -> string
Microsoft.CodeAnalysis.AdditionalDocument
Microsoft.CodeAnalysis.AdhocWorkspace
Microsoft.CodeAnalysis.AdhocWorkspace.AddDocument(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.AdhocWorkspace.AddDocument(Microsoft.CodeAnalysis.ProjectId projectId, string name, Microsoft.CodeAnalysis.Text.SourceText text) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.AdhocWorkspace.AddProject(Microsoft.CodeAnalysis.ProjectInfo projectInfo) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.AdhocWorkspace.AddProject(string name, string language) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.AdhocWorkspace.AddProjects(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectInfo> projectInfos) -> void
Microsoft.CodeAnalysis.AdhocWorkspace.AddSolution(Microsoft.CodeAnalysis.SolutionInfo solutionInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.AdhocWorkspace.AdhocWorkspace() -> void
Microsoft.CodeAnalysis.AdhocWorkspace.AdhocWorkspace(Microsoft.CodeAnalysis.Host.HostServices host, string workspaceKind = "Custom") -> void
Microsoft.CodeAnalysis.AdhocWorkspace.ClearSolution() -> void
Microsoft.CodeAnalysis.AnalyzerConfigDocument
Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddAdditionalDocument = 11 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddAnalyzerConfigDocument = 17 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddAnalyzerReference = 9 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddDocument = 6 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddMetadataReference = 4 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddProject = 0 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddProjectReference = 2 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.AddSolutionAnalyzerReference = 20 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeAdditionalDocument = 13 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeAnalyzerConfigDocument = 19 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeCompilationOptions = 14 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeDocument = 8 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeDocumentInfo = 16 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.ChangeParseOptions = 15 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveAdditionalDocument = 12 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveAnalyzerConfigDocument = 18 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveAnalyzerReference = 10 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveDocument = 7 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveMetadataReference = 5 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveProject = 1 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveProjectReference = 3 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.ApplyChangesKind.RemoveSolutionAnalyzerReference = 21 -> Microsoft.CodeAnalysis.ApplyChangesKind
Microsoft.CodeAnalysis.Classification.ClassificationTypeNames
Microsoft.CodeAnalysis.Classification.ClassifiedSpan
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassificationType.get -> string
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassifiedSpan() -> void
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassifiedSpan(Microsoft.CodeAnalysis.Text.TextSpan textSpan, string classificationType) -> void
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.ClassifiedSpan(string classificationType, Microsoft.CodeAnalysis.Text.TextSpan textSpan) -> void
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.Equals(Microsoft.CodeAnalysis.Classification.ClassifiedSpan other) -> bool
Microsoft.CodeAnalysis.Classification.ClassifiedSpan.TextSpan.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.Classification.Classifier
Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation
Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.ApplyChangesOperation(Microsoft.CodeAnalysis.Solution changedSolution) -> void
Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.ChangedSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.CodeActions.CodeAction
Microsoft.CodeAnalysis.CodeActions.CodeAction.CodeAction() -> void
Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessAsync(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation> operations, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Solution changedSolution, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
Microsoft.CodeAnalysis.CodeActions.CodeActionOperation
Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.CodeActionOperation() -> void
Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions
Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.CodeActionWithOptions() -> void
Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.GetOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation
Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation
Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation.DocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation.OpenDocumentOperation(Microsoft.CodeAnalysis.DocumentId documentId, bool activateIfAlreadyOpen = false) -> void
Microsoft.CodeAnalysis.CodeActions.PreviewOperation
Microsoft.CodeAnalysis.CodeActions.PreviewOperation.PreviewOperation() -> void
Microsoft.CodeAnalysis.CodeActions.RenameAnnotation
Microsoft.CodeAnalysis.CodeActions.WarningAnnotation
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CancellationToken.get -> System.Threading.CancellationToken
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext() -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Diagnostic diagnostic, System.Action<Microsoft.CodeAnalysis.CodeActions.CodeAction, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>> registerCodeFix, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic> diagnostics, System.Action<Microsoft.CodeAnalysis.CodeActions.CodeAction, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>> registerCodeFix, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Diagnostics.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.RegisterCodeFix(Microsoft.CodeAnalysis.CodeActions.CodeAction action, Microsoft.CodeAnalysis.Diagnostic diagnostic) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.RegisterCodeFix(Microsoft.CodeAnalysis.CodeActions.CodeAction action, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic> diagnostics) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.RegisterCodeFix(Microsoft.CodeAnalysis.CodeActions.CodeAction action, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic> diagnostics) -> void
Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Span.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider
Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.CodeFixProvider() -> void
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.ExportCodeFixProviderAttribute(string firstLanguage, params string[] additionalLanguages) -> void
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.Languages.get -> string[]
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.Name.get -> string
Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute.Name.set -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.CancellationToken.get -> System.Threading.CancellationToken
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.CodeActionEquivalenceKey.get -> string
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.CodeFixProvider.get -> Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticIds.get -> System.Collections.Immutable.ImmutableHashSet<string>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider.DiagnosticProvider() -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.FixAllContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider codeFixProvider, Microsoft.CodeAnalysis.CodeFixes.FixAllScope scope, string codeActionEquivalenceKey, System.Collections.Generic.IEnumerable<string> diagnosticIds, Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider fixAllDiagnosticProvider, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.FixAllContext(Microsoft.CodeAnalysis.Project project, Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider codeFixProvider, Microsoft.CodeAnalysis.CodeFixes.FixAllScope scope, string codeActionEquivalenceKey, System.Collections.Generic.IEnumerable<string> diagnosticIds, Microsoft.CodeAnalysis.CodeFixes.FixAllContext.DiagnosticProvider fixAllDiagnosticProvider, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetAllDiagnosticsAsync(Microsoft.CodeAnalysis.Project project) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetDocumentDiagnosticsAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetProjectDiagnosticsAsync(Microsoft.CodeAnalysis.Project project) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>>
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Project.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Scope.get -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Solution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.CodeFixes.FixAllContext.WithCancellationToken(System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.CodeFixes.FixAllContext
Microsoft.CodeAnalysis.CodeFixes.FixAllProvider
Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.FixAllProvider() -> void
Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Custom = 3 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Document = 0 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Project = 1 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Solution = 2 -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope
Microsoft.CodeAnalysis.CodeFixes.WellKnownFixAllProviders
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.CancellationToken.get -> System.Threading.CancellationToken
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.CodeRefactoringContext() -> void
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.CodeRefactoringContext(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, System.Action<Microsoft.CodeAnalysis.CodeActions.CodeAction> registerRefactoring, System.Threading.CancellationToken cancellationToken) -> void
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.RegisterRefactoring(Microsoft.CodeAnalysis.CodeActions.CodeAction action) -> void
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.Span.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider
Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.CodeRefactoringProvider() -> void
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.ExportCodeRefactoringProviderAttribute(string firstLanguage, params string[] additionalLanguages) -> void
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.Languages.get -> string[]
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.Name.get -> string
Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.Name.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.CodeStyleOption(T value, Microsoft.CodeAnalysis.CodeStyle.NotificationOption notification) -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Equals(Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T> other) -> bool
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Notification.get -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Notification.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.ToXElement() -> System.Xml.Linq.XElement
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Value.get -> T
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Value.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.CodeStyleOptions() -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Name.get -> string
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Name.set -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Severity.get -> Microsoft.CodeAnalysis.ReportDiagnostic
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Severity.set -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Value.get -> Microsoft.CodeAnalysis.DiagnosticSeverity
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Value.set -> void
Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.CompilationOutputInfo.AssemblyPath.get -> string
Microsoft.CodeAnalysis.CompilationOutputInfo.CompilationOutputInfo() -> void
Microsoft.CodeAnalysis.CompilationOutputInfo.Equals(Microsoft.CodeAnalysis.CompilationOutputInfo other) -> bool
Microsoft.CodeAnalysis.CompilationOutputInfo.WithAssemblyPath(string path) -> Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.Differencing.Edit<TNode>
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Edit() -> void
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Equals(Microsoft.CodeAnalysis.Differencing.Edit<TNode> other) -> bool
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Kind.get -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.NewNode.get -> TNode
Microsoft.CodeAnalysis.Differencing.Edit<TNode>.OldNode.get -> TNode
Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Delete = 3 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Insert = 2 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Move = 4 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.None = 0 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Reorder = 5 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditKind.Update = 1 -> Microsoft.CodeAnalysis.Differencing.EditKind
Microsoft.CodeAnalysis.Differencing.EditScript<TNode>
Microsoft.CodeAnalysis.Differencing.EditScript<TNode>.Edits.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Differencing.Edit<TNode>>
Microsoft.CodeAnalysis.Differencing.EditScript<TNode>.Match.get -> Microsoft.CodeAnalysis.Differencing.Match<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.Comparer.get -> Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.GetSequenceEdits(System.Collections.Generic.IEnumerable<TNode> oldNodes, System.Collections.Generic.IEnumerable<TNode> newNodes) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Differencing.Edit<TNode>>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.GetTreeEdits() -> Microsoft.CodeAnalysis.Differencing.EditScript<TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.Matches.get -> System.Collections.Generic.IReadOnlyDictionary<TNode, TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.NewRoot.get -> TNode
Microsoft.CodeAnalysis.Differencing.Match<TNode>.OldRoot.get -> TNode
Microsoft.CodeAnalysis.Differencing.Match<TNode>.ReverseMatches.get -> System.Collections.Generic.IReadOnlyDictionary<TNode, TNode>
Microsoft.CodeAnalysis.Differencing.Match<TNode>.TryGetNewNode(TNode oldNode, out TNode newNode) -> bool
Microsoft.CodeAnalysis.Differencing.Match<TNode>.TryGetOldNode(TNode newNode, out TNode oldNode) -> bool
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.ComputeEditScript(TNode oldRoot, TNode newRoot) -> Microsoft.CodeAnalysis.Differencing.EditScript<TNode>
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.ComputeMatch(TNode oldRoot, TNode newRoot, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TNode, TNode>> knownMatches = null) -> Microsoft.CodeAnalysis.Differencing.Match<TNode>
Microsoft.CodeAnalysis.Differencing.TreeComparer<TNode>.TreeComparer() -> void
Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.GetLinkedDocumentIds() -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Document.GetOptionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Options.DocumentOptionSet>
Microsoft.CodeAnalysis.Document.GetSemanticModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SemanticModel>
Microsoft.CodeAnalysis.Document.GetSyntaxRootAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxNode>
Microsoft.CodeAnalysis.Document.GetSyntaxTreeAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxTree>
Microsoft.CodeAnalysis.Document.GetSyntaxVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Document.GetTextChangesAsync(Microsoft.CodeAnalysis.Document oldDocument, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextChange>>
Microsoft.CodeAnalysis.Document.SourceCodeKind.get -> Microsoft.CodeAnalysis.SourceCodeKind
Microsoft.CodeAnalysis.Document.SupportsSemanticModel.get -> bool
Microsoft.CodeAnalysis.Document.SupportsSyntaxTree.get -> bool
Microsoft.CodeAnalysis.Document.TryGetSemanticModel(out Microsoft.CodeAnalysis.SemanticModel semanticModel) -> bool
Microsoft.CodeAnalysis.Document.TryGetSyntaxRoot(out Microsoft.CodeAnalysis.SyntaxNode root) -> bool
Microsoft.CodeAnalysis.Document.TryGetSyntaxTree(out Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> bool
Microsoft.CodeAnalysis.Document.TryGetSyntaxVersion(out Microsoft.CodeAnalysis.VersionStamp version) -> bool
Microsoft.CodeAnalysis.Document.WithFilePath(string filePath) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithFolders(System.Collections.Generic.IEnumerable<string> folders) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithName(string name) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithSourceCodeKind(Microsoft.CodeAnalysis.SourceCodeKind kind) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithSyntaxRoot(Microsoft.CodeAnalysis.SyntaxNode root) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Document.WithText(Microsoft.CodeAnalysis.Text.SourceText text) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.DocumentActiveContextChangedEventArgs(Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.Text.SourceTextContainer sourceTextContainer, Microsoft.CodeAnalysis.DocumentId oldActiveContextDocumentId, Microsoft.CodeAnalysis.DocumentId newActiveContextDocumentId) -> void
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.NewActiveContextDocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.OldActiveContextDocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.Solution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs.SourceTextContainer.get -> Microsoft.CodeAnalysis.Text.SourceTextContainer
Microsoft.CodeAnalysis.DocumentDiagnostic
Microsoft.CodeAnalysis.DocumentDiagnostic.DocumentDiagnostic(Microsoft.CodeAnalysis.WorkspaceDiagnosticKind kind, string message, Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.DocumentDiagnostic.DocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentEventArgs
Microsoft.CodeAnalysis.DocumentEventArgs.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.DocumentEventArgs.DocumentEventArgs(Microsoft.CodeAnalysis.Document document) -> void
Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentId.Equals(Microsoft.CodeAnalysis.DocumentId other) -> bool
Microsoft.CodeAnalysis.DocumentId.Id.get -> System.Guid
Microsoft.CodeAnalysis.DocumentId.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.FilePath.get -> string
Microsoft.CodeAnalysis.DocumentInfo.Folders.get -> System.Collections.Generic.IReadOnlyList<string>
Microsoft.CodeAnalysis.DocumentInfo.Id.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.DocumentInfo.IsGenerated.get -> bool
Microsoft.CodeAnalysis.DocumentInfo.Name.get -> string
Microsoft.CodeAnalysis.DocumentInfo.SourceCodeKind.get -> Microsoft.CodeAnalysis.SourceCodeKind
Microsoft.CodeAnalysis.DocumentInfo.TextLoader.get -> Microsoft.CodeAnalysis.TextLoader
Microsoft.CodeAnalysis.DocumentInfo.WithFilePath(string filePath) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithFolders(System.Collections.Generic.IEnumerable<string> folders) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithId(Microsoft.CodeAnalysis.DocumentId id) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithName(string name) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithSourceCodeKind(Microsoft.CodeAnalysis.SourceCodeKind kind) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.DocumentInfo.WithTextLoader(Microsoft.CodeAnalysis.TextLoader loader) -> Microsoft.CodeAnalysis.DocumentInfo
Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.AddAccessor = 26 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Attribute = 22 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Class = 2 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.CompilationUnit = 1 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Constructor = 10 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.ConversionOperator = 9 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.CustomEvent = 17 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Delegate = 6 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Destructor = 11 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Enum = 5 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.EnumMember = 15 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Event = 16 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Field = 12 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.GetAccessor = 24 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Indexer = 14 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Interface = 4 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.LambdaExpression = 23 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Method = 7 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Namespace = 18 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.NamespaceImport = 19 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.None = 0 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Operator = 8 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Parameter = 20 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Property = 13 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.RaiseAccessor = 28 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.RemoveAccessor = 27 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.SetAccessor = 25 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Struct = 3 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationKind.Variable = 21 -> Microsoft.CodeAnalysis.Editing.DeclarationKind
Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.DeclarationModifiers() -> void
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsAbstract.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsAsync.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsConst.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsExtern.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsNew.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsOverride.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsPartial.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsReadOnly.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsRef.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsSealed.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsStatic.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsUnsafe.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsVirtual.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsVolatile.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsWithEvents.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsWriteOnly.get -> bool
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithAsync(bool isAsync) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsAbstract(bool isAbstract) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsConst(bool isConst) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsExtern(bool isExtern) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsNew(bool isNew) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsOverride(bool isOverride) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsReadOnly(bool isReadOnly) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsRef(bool isRef) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsSealed(bool isSealed) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsStatic(bool isStatic) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsUnsafe(bool isUnsafe) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsVirtual(bool isVirtual) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsVolatile(bool isVolatile) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithIsWriteOnly(bool isWriteOnly) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithPartial(bool isPartial) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithWithEvents(bool withEvents) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
Microsoft.CodeAnalysis.Editing.DocumentEditor
Microsoft.CodeAnalysis.Editing.DocumentEditor.GetChangedDocument() -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Editing.DocumentEditor.OriginalDocument.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Editing.DocumentEditor.SemanticModel.get -> Microsoft.CodeAnalysis.SemanticModel
Microsoft.CodeAnalysis.Editing.ImportAdder
Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Addition = 2 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.BitwiseAnd = 3 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.BitwiseOr = 4 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Decrement = 5 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Division = 6 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Equality = 7 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.ExclusiveOr = 8 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.ExplicitConversion = 1 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.False = 9 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.GreaterThan = 10 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.GreaterThanOrEqual = 11 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.ImplicitConversion = 0 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Increment = 12 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Inequality = 13 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LeftShift = 14 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LessThan = 15 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LessThanOrEqual = 16 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.LogicalNot = 17 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Modulus = 18 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Multiply = 19 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.OnesComplement = 20 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.RightShift = 21 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.Subtraction = 22 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.True = 23 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.UnaryNegation = 24 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.OperatorKind.UnaryPlus = 25 -> Microsoft.CodeAnalysis.Editing.OperatorKind
Microsoft.CodeAnalysis.Editing.SolutionEditor
Microsoft.CodeAnalysis.Editing.SolutionEditor.GetChangedSolution() -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SolutionEditor.GetDocumentEditorAsync(Microsoft.CodeAnalysis.DocumentId id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Editing.DocumentEditor>
Microsoft.CodeAnalysis.Editing.SolutionEditor.OriginalSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SolutionEditor.SolutionEditor(Microsoft.CodeAnalysis.Solution solution) -> void
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.Constructor = 4 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.None = 0 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.ReferenceType = 1 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind.ValueType = 2 -> Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind
Microsoft.CodeAnalysis.Editing.SymbolEditor
Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction
Microsoft.CodeAnalysis.Editing.SymbolEditor.ChangedSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditAllDeclarationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditAllDeclarationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.ISymbol member, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.ISymbol member, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Location location, Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.EditOneDeclarationAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Location location, Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction editAction, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.GetChangedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Document>
Microsoft.CodeAnalysis.Editing.SymbolEditor.GetCurrentDeclarationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.SyntaxNode>>
Microsoft.CodeAnalysis.Editing.SymbolEditor.GetCurrentSymbolAsync(Microsoft.CodeAnalysis.ISymbol symbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
Microsoft.CodeAnalysis.Editing.SymbolEditor.OriginalSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions
Microsoft.CodeAnalysis.Editing.SyntaxEditor
Microsoft.CodeAnalysis.Editing.SyntaxEditor.Generator.get -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
Microsoft.CodeAnalysis.Editing.SyntaxEditor.GetChangedRoot() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertAfter(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertAfter(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newNodes) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertBefore(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.InsertBefore(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newNodes) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.OriginalRoot.get -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxEditor.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode node) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxRemoveOptions options) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.ReplaceNode(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.ReplaceNode(Microsoft.CodeAnalysis.SyntaxNode node, System.Func<Microsoft.CodeAnalysis.SyntaxNode, Microsoft.CodeAnalysis.Editing.SyntaxGenerator, Microsoft.CodeAnalysis.SyntaxNode> computeReplacement) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.SyntaxEditor(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.Workspace workspace) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditor.TrackNode(Microsoft.CodeAnalysis.SyntaxNode node) -> void
Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions
Microsoft.CodeAnalysis.Editing.SyntaxGenerator
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAccessors(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> accessors) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAttributeArguments(Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] members) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] imports) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> imports) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> switchSections) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AliasImportDeclaration(string aliasIdentifierName, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol symbol) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Argument(Microsoft.CodeAnalysis.RefKind refKind, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Argument(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPrivateInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AsPublicInterfaceImplementation(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(Microsoft.CodeAnalysis.AttributeData attribute) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(string name, params Microsoft.CodeAnalysis.SyntaxNode[] attributeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Attribute(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> attributeArguments = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AttributeArgument(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CastExpression(Microsoft.CodeAnalysis.ITypeSymbol type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CatchClause(Microsoft.CodeAnalysis.ITypeSymbol type, string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CompilationUnit(params Microsoft.CodeAnalysis.SyntaxNode[] declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConstructorDeclaration(Microsoft.CodeAnalysis.IMethodSymbol constructorMethod, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> baseConstructorArguments = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ConvertExpression(Microsoft.CodeAnalysis.ITypeSymbol type, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.CustomEventDeclaration(Microsoft.CodeAnalysis.IEventSymbol symbol, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> addAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> removeAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.Declaration(Microsoft.CodeAnalysis.ISymbol symbol) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DottedName(string dottedName) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ElementBindingExpression(params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.EventDeclaration(Microsoft.CodeAnalysis.IEventSymbol symbol) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FalseLiteralExpression() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FieldDeclaration(Microsoft.CodeAnalysis.IFieldSymbol field) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.FieldDeclaration(Microsoft.CodeAnalysis.IFieldSymbol field, Microsoft.CodeAnalysis.SyntaxNode initializer) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, params Microsoft.CodeAnalysis.ITypeSymbol[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, params Microsoft.CodeAnalysis.SyntaxNode[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GenericName(string identifier, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ITypeSymbol> typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetAccessor(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Editing.DeclarationKind kind) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetDeclaration(Microsoft.CodeAnalysis.SyntaxNode node) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetDeclaration(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Editing.DeclarationKind kind) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IfStatement(Microsoft.CodeAnalysis.SyntaxNode condition, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> trueStatements, Microsoft.CodeAnalysis.SyntaxNode falseStatement) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IndexerDeclaration(Microsoft.CodeAnalysis.IPropertySymbol indexer, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IndexOf<T>(System.Collections.Generic.IReadOnlyList<T> list, T element) -> int
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertMembers(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] members) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNamespaceImports(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] imports) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertReturnAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration, int index, params Microsoft.CodeAnalysis.SyntaxNode[] attributes) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InvocationExpression(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.IsTypeExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LambdaParameter(string identifier, Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LocalDeclarationStatement(Microsoft.CodeAnalysis.ITypeSymbol type, string name, Microsoft.CodeAnalysis.SyntaxNode initializer = null, bool isConst = false) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.LocalDeclarationStatement(string name, Microsoft.CodeAnalysis.SyntaxNode initializer) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, string memberName) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MethodDeclaration(Microsoft.CodeAnalysis.IMethodSymbol method, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(Microsoft.CodeAnalysis.SyntaxNode name, params Microsoft.CodeAnalysis.SyntaxNode[] declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(string name, params Microsoft.CodeAnalysis.SyntaxNode[] declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceDeclaration(string name, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NamespaceImportDeclaration(string name) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.NullLiteralExpression() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.ITypeSymbol type, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.ITypeSymbol type, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ObjectCreationExpression(Microsoft.CodeAnalysis.SyntaxNode type, params Microsoft.CodeAnalysis.SyntaxNode[] arguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.OperatorDeclaration(Microsoft.CodeAnalysis.IMethodSymbol method, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ParameterDeclaration(Microsoft.CodeAnalysis.IParameterSymbol symbol, Microsoft.CodeAnalysis.SyntaxNode initializer = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PropertyDeclaration(Microsoft.CodeAnalysis.IPropertySymbol property, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveAllAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNodes(Microsoft.CodeAnalysis.SyntaxNode root, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> declarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchSection(Microsoft.CodeAnalysis.SyntaxNode caseExpression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchStatement(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] sections) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SyntaxGenerator() -> void
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TrueLiteralExpression() -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCastExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.ITypeSymbol type) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryCatchStatement(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> tryStatements, params Microsoft.CodeAnalysis.SyntaxNode[] catchClauses) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TryFinallyStatement(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> tryStatements, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> finallyStatements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleElementExpression(Microsoft.CodeAnalysis.ITypeSymbol type, string name = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleTypeExpression(params Microsoft.CodeAnalysis.SyntaxNode[] elements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleTypeExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ITypeSymbol> elementTypes, System.Collections.Generic.IEnumerable<string> elementNames = null) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TupleTypeExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> elements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.TypeExpression(Microsoft.CodeAnalysis.ITypeSymbol typeSymbol, bool addImport) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.UsingStatement(string name, Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(string parameterName, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(string parameterName, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ValueReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(string parameterName, Microsoft.CodeAnalysis.SyntaxNode expression) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(string parameterName, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessorDeclarations(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] accessorDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeArguments(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, params Microsoft.CodeAnalysis.SyntaxNode[] types) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, params Microsoft.CodeAnalysis.SyntaxNode[] types) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, params string[] typeParameters) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.ExtensionOrderAttribute
Microsoft.CodeAnalysis.ExtensionOrderAttribute.After.get -> string
Microsoft.CodeAnalysis.ExtensionOrderAttribute.After.set -> void
Microsoft.CodeAnalysis.ExtensionOrderAttribute.Before.get -> string
Microsoft.CodeAnalysis.ExtensionOrderAttribute.Before.set -> void
Microsoft.CodeAnalysis.ExtensionOrderAttribute.ExtensionOrderAttribute() -> void
Microsoft.CodeAnalysis.FileTextLoader
Microsoft.CodeAnalysis.FileTextLoader.DefaultEncoding.get -> System.Text.Encoding
Microsoft.CodeAnalysis.FileTextLoader.FileTextLoader(string path, System.Text.Encoding defaultEncoding) -> void
Microsoft.CodeAnalysis.FileTextLoader.Path.get -> string
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnCompleted() -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnDefinitionFound(Microsoft.CodeAnalysis.ISymbol symbol) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnFindInDocumentCompleted(Microsoft.CodeAnalysis.Document document) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnFindInDocumentStarted(Microsoft.CodeAnalysis.Document document) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnReferenceFound(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation location) -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.OnStarted() -> void
Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress.ReportProgress(int current, int maximum) -> void
Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol
Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol.Definition.get -> Microsoft.CodeAnalysis.ISymbol
Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol.Locations.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation>
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Alias.get -> Microsoft.CodeAnalysis.IAliasSymbol
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.CandidateReason.get -> Microsoft.CodeAnalysis.CandidateReason
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.CompareTo(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation other) -> int
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Document.get -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Equals(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation other) -> bool
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.IsCandidateLocation.get -> bool
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.IsImplicit.get -> bool
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Location.get -> Microsoft.CodeAnalysis.Location
Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.ReferenceLocation() -> void
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.CalledSymbol.get -> Microsoft.CodeAnalysis.ISymbol
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.CallingSymbol.get -> Microsoft.CodeAnalysis.ISymbol
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.IsDirect.get -> bool
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.Locations.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>
Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo.SymbolCallerInfo() -> void
Microsoft.CodeAnalysis.FindSymbols.SymbolFinder
Microsoft.CodeAnalysis.Formatting.Formatter
Microsoft.CodeAnalysis.Formatting.FormattingOptions
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle.Block = 1 -> Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle.None = 0 -> Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle.Smart = 2 -> Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle
Microsoft.CodeAnalysis.Host.HostLanguageServices
Microsoft.CodeAnalysis.Host.HostLanguageServices.GetRequiredService<TLanguageService>() -> TLanguageService
Microsoft.CodeAnalysis.Host.HostLanguageServices.HostLanguageServices() -> void
Microsoft.CodeAnalysis.Host.HostServices
Microsoft.CodeAnalysis.Host.HostServices.HostServices() -> void
Microsoft.CodeAnalysis.Host.HostWorkspaceServices
Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetRequiredService<TWorkspaceService>() -> TWorkspaceService
Microsoft.CodeAnalysis.Host.HostWorkspaceServices.HostWorkspaceServices() -> void
Microsoft.CodeAnalysis.Host.HostWorkspaceServices.MetadataFilter
Microsoft.CodeAnalysis.Host.IAnalyzerService
Microsoft.CodeAnalysis.Host.IAnalyzerService.GetLoader() -> Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader
Microsoft.CodeAnalysis.Host.ILanguageService
Microsoft.CodeAnalysis.Host.IPersistentStorage
Microsoft.CodeAnalysis.Host.IPersistentStorage.ReadStreamAsync(Microsoft.CodeAnalysis.Document document, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.IPersistentStorage.ReadStreamAsync(Microsoft.CodeAnalysis.Project project, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.IPersistentStorage.ReadStreamAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.IPersistentStorage.WriteStreamAsync(Microsoft.CodeAnalysis.Document document, string name, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>
Microsoft.CodeAnalysis.Host.IPersistentStorage.WriteStreamAsync(Microsoft.CodeAnalysis.Project project, string name, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>
Microsoft.CodeAnalysis.Host.IPersistentStorage.WriteStreamAsync(string name, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>
Microsoft.CodeAnalysis.Host.IPersistentStorageService
Microsoft.CodeAnalysis.Host.IPersistentStorageService.GetStorage(Microsoft.CodeAnalysis.Solution solution) -> Microsoft.CodeAnalysis.Host.IPersistentStorage
Microsoft.CodeAnalysis.Host.ITemporaryStorageService
Microsoft.CodeAnalysis.Host.ITemporaryStorageService.CreateTemporaryStreamStorage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage
Microsoft.CodeAnalysis.Host.ITemporaryStorageService.CreateTemporaryTextStorage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Host.ITemporaryTextStorage
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.ReadStream(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.IO.Stream
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.ReadStreamAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.IO.Stream>
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.WriteStream(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void
Microsoft.CodeAnalysis.Host.ITemporaryStreamStorage.WriteStreamAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.ReadText(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Text.SourceText
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.ReadTextAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Text.SourceText>
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.WriteText(Microsoft.CodeAnalysis.Text.SourceText text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.WriteTextAsync(Microsoft.CodeAnalysis.Text.SourceText text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Host.IWorkspaceService
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.ExportLanguageServiceAttribute(System.Type type, string language, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.Language.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.ExportLanguageServiceFactoryAttribute(System.Type type, string language, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.Language.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceFactoryAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute.ExportWorkspaceServiceAttribute(System.Type serviceType, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute.ExportWorkspaceServiceFactoryAttribute(System.Type serviceType, string layer = "Default") -> void
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute.Layer.get -> string
Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactoryAttribute.ServiceType.get -> string
Microsoft.CodeAnalysis.Host.Mef.ILanguageServiceFactory
Microsoft.CodeAnalysis.Host.Mef.ILanguageServiceFactory.CreateLanguageService(Microsoft.CodeAnalysis.Host.HostLanguageServices languageServices) -> Microsoft.CodeAnalysis.Host.ILanguageService
Microsoft.CodeAnalysis.Host.Mef.IWorkspaceServiceFactory
Microsoft.CodeAnalysis.Host.Mef.IWorkspaceServiceFactory.CreateService(Microsoft.CodeAnalysis.Host.HostWorkspaceServices workspaceServices) -> Microsoft.CodeAnalysis.Host.IWorkspaceService
Microsoft.CodeAnalysis.Host.Mef.MefHostServices
Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefHostServices(System.Composition.CompositionContext compositionContext) -> void
Microsoft.CodeAnalysis.Host.Mef.ServiceLayer
Microsoft.CodeAnalysis.Options.DocumentOptionSet
Microsoft.CodeAnalysis.Options.DocumentOptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option) -> T
Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, T value) -> Microsoft.CodeAnalysis.Options.DocumentOptionSet
Microsoft.CodeAnalysis.Options.IOption
Microsoft.CodeAnalysis.Options.IOption.DefaultValue.get -> object
Microsoft.CodeAnalysis.Options.IOption.Feature.get -> string
Microsoft.CodeAnalysis.Options.IOption.IsPerLanguage.get -> bool
Microsoft.CodeAnalysis.Options.IOption.Name.get -> string
Microsoft.CodeAnalysis.Options.IOption.StorageLocations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Options.OptionStorageLocation>
Microsoft.CodeAnalysis.Options.IOption.Type.get -> System.Type
Microsoft.CodeAnalysis.Options.Option<T>
Microsoft.CodeAnalysis.Options.Option<T>.DefaultValue.get -> T
Microsoft.CodeAnalysis.Options.Option<T>.Feature.get -> string
Microsoft.CodeAnalysis.Options.Option<T>.Name.get -> string
Microsoft.CodeAnalysis.Options.Option<T>.Option(string feature, string name) -> void
Microsoft.CodeAnalysis.Options.Option<T>.Option(string feature, string name, T defaultValue) -> void
Microsoft.CodeAnalysis.Options.Option<T>.Option(string feature, string name, T defaultValue, params Microsoft.CodeAnalysis.Options.OptionStorageLocation[] storageLocations) -> void
Microsoft.CodeAnalysis.Options.Option<T>.StorageLocations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Options.OptionStorageLocation>
Microsoft.CodeAnalysis.Options.Option<T>.Type.get -> System.Type
Microsoft.CodeAnalysis.Options.OptionKey
Microsoft.CodeAnalysis.Options.OptionKey.Equals(Microsoft.CodeAnalysis.Options.OptionKey other) -> bool
Microsoft.CodeAnalysis.Options.OptionKey.Language.get -> string
Microsoft.CodeAnalysis.Options.OptionKey.Option.get -> Microsoft.CodeAnalysis.Options.IOption
Microsoft.CodeAnalysis.Options.OptionKey.OptionKey() -> void
Microsoft.CodeAnalysis.Options.OptionKey.OptionKey(Microsoft.CodeAnalysis.Options.IOption option, string language = null) -> void
Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Options.OptionSet.GetOption(Microsoft.CodeAnalysis.Options.OptionKey optionKey) -> object
Microsoft.CodeAnalysis.Options.OptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.Option<T> option) -> T
Microsoft.CodeAnalysis.Options.OptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.OptionKey optionKey) -> T
Microsoft.CodeAnalysis.Options.OptionSet.GetOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, string language) -> T
Microsoft.CodeAnalysis.Options.OptionSet.OptionSet() -> void
Microsoft.CodeAnalysis.Options.OptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.Option<T> option, T value) -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Options.OptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, string language, T value) -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Options.OptionStorageLocation
Microsoft.CodeAnalysis.Options.OptionStorageLocation.OptionStorageLocation() -> void
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.DefaultValue.get -> T
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Feature.get -> string
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Name.get -> string
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.PerLanguageOption(string feature, string name, T defaultValue) -> void
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.PerLanguageOption(string feature, string name, T defaultValue, params Microsoft.CodeAnalysis.Options.OptionStorageLocation[] storageLocations) -> void
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.StorageLocations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Options.OptionStorageLocation>
Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Type.get -> System.Type
Microsoft.CodeAnalysis.PreservationMode
Microsoft.CodeAnalysis.PreservationMode.PreserveIdentity = 1 -> Microsoft.CodeAnalysis.PreservationMode
Microsoft.CodeAnalysis.PreservationMode.PreserveValue = 0 -> Microsoft.CodeAnalysis.PreservationMode
Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddAdditionalDocument(string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.AddAdditionalDocument(string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.AddAnalyzerConfigDocument(string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.AddAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddDocument(string name, Microsoft.CodeAnalysis.SyntaxNode syntaxRoot, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.AddDocument(string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.AddDocument(string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.AdditionalDocumentIds.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Project.AdditionalDocuments.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.TextDocument>
Microsoft.CodeAnalysis.Project.AddMetadataReference(Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddMetadataReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddProjectReference(Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AddProjectReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.AllProjectReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.Project.AnalyzerConfigDocuments.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.AnalyzerConfigDocument>
Microsoft.CodeAnalysis.Project.AnalyzerOptions.get -> Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions
Microsoft.CodeAnalysis.Project.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.Project.AssemblyName.get -> string
Microsoft.CodeAnalysis.Project.CompilationOptions.get -> Microsoft.CodeAnalysis.CompilationOptions
Microsoft.CodeAnalysis.Project.CompilationOutputInfo.get -> Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.Project.ContainsAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Project.ContainsAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Project.ContainsDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Project.DefaultNamespace.get -> string
Microsoft.CodeAnalysis.Project.DocumentIds.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Project.Documents.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Document>
Microsoft.CodeAnalysis.Project.FilePath.get -> string
Microsoft.CodeAnalysis.Project.GetAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Project.GetAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.AnalyzerConfigDocument
Microsoft.CodeAnalysis.Project.GetChanges(Microsoft.CodeAnalysis.Project oldProject) -> Microsoft.CodeAnalysis.ProjectChanges
Microsoft.CodeAnalysis.Project.GetCompilationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Compilation>
Microsoft.CodeAnalysis.Project.GetDependentSemanticVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.GetDependentVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.GetDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.GetDocument(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Project.GetDocumentId(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.Project.GetLatestDocumentVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.GetSemanticVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.Project.HasDocuments.get -> bool
Microsoft.CodeAnalysis.Project.Id.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.Project.IsSubmission.get -> bool
Microsoft.CodeAnalysis.Project.Language.get -> string
Microsoft.CodeAnalysis.Project.LanguageServices.get -> Microsoft.CodeAnalysis.Host.HostLanguageServices
Microsoft.CodeAnalysis.Project.MetadataReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.Project.Name.get -> string
Microsoft.CodeAnalysis.Project.OutputFilePath.get -> string
Microsoft.CodeAnalysis.Project.OutputRefFilePath.get -> string
Microsoft.CodeAnalysis.Project.ParseOptions.get -> Microsoft.CodeAnalysis.ParseOptions
Microsoft.CodeAnalysis.Project.ProjectReferences.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.Project.RemoveAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAdditionalDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAnalyzerConfigDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveMetadataReference(Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.RemoveProjectReference(Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.Solution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Project.SupportsCompilation.get -> bool
Microsoft.CodeAnalysis.Project.TryGetCompilation(out Microsoft.CodeAnalysis.Compilation compilation) -> bool
Microsoft.CodeAnalysis.Project.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Project.WithAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferencs) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithAssemblyName(string assemblyName) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithCompilationOptions(Microsoft.CodeAnalysis.CompilationOptions options) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithDefaultNamespace(string defaultNamespace) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithMetadataReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithParseOptions(Microsoft.CodeAnalysis.ParseOptions options) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Project.WithProjectReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.ProjectChanges
Microsoft.CodeAnalysis.ProjectChanges.GetAddedAdditionalDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedAnalyzerConfigDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedMetadataReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.ProjectChanges.GetAddedProjectReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedAdditionalDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedAnalyzerConfigDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetChangedDocuments(bool onlyGetDocumentsWithTextChanges) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedAdditionalDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedAnalyzerConfigDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedDocuments() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedMetadataReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.ProjectChanges.GetRemovedProjectReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.ProjectChanges.NewProject.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.ProjectChanges.OldProject.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.ProjectChanges.ProjectChanges() -> void
Microsoft.CodeAnalysis.ProjectChanges.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectDependencyGraph
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetDependencySets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectId>>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatDirectlyDependOnThisProject(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatThisProjectDirectlyDependsOn(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(Microsoft.CodeAnalysis.ProjectId projectId) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDependencyGraph.GetTopologicallySortedProjects(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.ProjectDiagnostic
Microsoft.CodeAnalysis.ProjectDiagnostic.ProjectDiagnostic(Microsoft.CodeAnalysis.WorkspaceDiagnosticKind kind, string message, Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.ProjectDiagnostic.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectId.Equals(Microsoft.CodeAnalysis.ProjectId other) -> bool
Microsoft.CodeAnalysis.ProjectId.Id.get -> System.Guid
Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.AdditionalDocuments.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentInfo>
Microsoft.CodeAnalysis.ProjectInfo.AnalyzerConfigDocuments.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentInfo>
Microsoft.CodeAnalysis.ProjectInfo.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.ProjectInfo.AssemblyName.get -> string
Microsoft.CodeAnalysis.ProjectInfo.CompilationOptions.get -> Microsoft.CodeAnalysis.CompilationOptions
Microsoft.CodeAnalysis.ProjectInfo.CompilationOutputInfo.get -> Microsoft.CodeAnalysis.CompilationOutputInfo
Microsoft.CodeAnalysis.ProjectInfo.Documents.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.DocumentInfo>
Microsoft.CodeAnalysis.ProjectInfo.FilePath.get -> string
Microsoft.CodeAnalysis.ProjectInfo.HostObjectType.get -> System.Type
Microsoft.CodeAnalysis.ProjectInfo.Id.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectInfo.IsSubmission.get -> bool
Microsoft.CodeAnalysis.ProjectInfo.Language.get -> string
Microsoft.CodeAnalysis.ProjectInfo.MetadataReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.MetadataReference>
Microsoft.CodeAnalysis.ProjectInfo.Name.get -> string
Microsoft.CodeAnalysis.ProjectInfo.OutputFilePath.get -> string
Microsoft.CodeAnalysis.ProjectInfo.OutputRefFilePath.get -> string
Microsoft.CodeAnalysis.ProjectInfo.ParseOptions.get -> Microsoft.CodeAnalysis.ParseOptions
Microsoft.CodeAnalysis.ProjectInfo.ProjectReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectReference>
Microsoft.CodeAnalysis.ProjectInfo.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.ProjectInfo.WithAdditionalDocuments(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> additionalDocuments) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithAnalyzerConfigDocuments(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> analyzerConfigDocuments) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithAssemblyName(string assemblyName) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithCompilationOptions(Microsoft.CodeAnalysis.CompilationOptions compilationOptions) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithCompilationOutputInfo(in Microsoft.CodeAnalysis.CompilationOutputInfo info) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithDefaultNamespace(string defaultNamespace) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithDocuments(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> documents) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithFilePath(string filePath) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithMetadataReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithName(string name) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithOutputFilePath(string outputFilePath) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithOutputRefFilePath(string outputRefFilePath) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithParseOptions(Microsoft.CodeAnalysis.ParseOptions parseOptions) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithProjectReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectInfo.WithVersion(Microsoft.CodeAnalysis.VersionStamp version) -> Microsoft.CodeAnalysis.ProjectInfo
Microsoft.CodeAnalysis.ProjectReference
Microsoft.CodeAnalysis.ProjectReference.Aliases.get -> System.Collections.Immutable.ImmutableArray<string>
Microsoft.CodeAnalysis.ProjectReference.EmbedInteropTypes.get -> bool
Microsoft.CodeAnalysis.ProjectReference.Equals(Microsoft.CodeAnalysis.ProjectReference reference) -> bool
Microsoft.CodeAnalysis.ProjectReference.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.ProjectReference.ProjectReference(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Immutable.ImmutableArray<string> aliases = default(System.Collections.Immutable.ImmutableArray<string>), bool embedInteropTypes = false) -> void
Microsoft.CodeAnalysis.Recommendations.RecommendationOptions
Microsoft.CodeAnalysis.Recommendations.Recommender
Microsoft.CodeAnalysis.Rename.RenameEntityKind
Microsoft.CodeAnalysis.Rename.RenameEntityKind.BaseSymbol = 0 -> Microsoft.CodeAnalysis.Rename.RenameEntityKind
Microsoft.CodeAnalysis.Rename.RenameEntityKind.OverloadedSymbols = 1 -> Microsoft.CodeAnalysis.Rename.RenameEntityKind
Microsoft.CodeAnalysis.Rename.RenameOptions
Microsoft.CodeAnalysis.Rename.Renamer
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction.GetErrors(System.Globalization.CultureInfo culture = null) -> System.Collections.Immutable.ImmutableArray<string>
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.ApplicableActions.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction>
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.UpdateSolutionAsync(Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAction> actions, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.UpdateSolutionAsync(Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
Microsoft.CodeAnalysis.Simplification.SimplificationOptions
Microsoft.CodeAnalysis.Simplification.Simplifier
Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocument(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAdditionalDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerConfigDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.SyntaxNode syntaxRoot, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null, bool isGenerated = false, Microsoft.CodeAnalysis.PreservationMode preservationMode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.Text.SourceText text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null, bool isGenerated = false) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, Microsoft.CodeAnalysis.TextLoader loader, System.Collections.Generic.IEnumerable<string> folders = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentId documentId, string name, string text, System.Collections.Generic.IEnumerable<string> folders = null, string filePath = null) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocument(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddMetadataReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProject(Microsoft.CodeAnalysis.ProjectId projectId, string name, string assemblyName, string language) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProject(Microsoft.CodeAnalysis.ProjectInfo projectInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProject(string name, string assemblyName, string language) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.AddProjectReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AddProjectReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.Solution.ContainsAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Solution.ContainsAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Solution.ContainsDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
Microsoft.CodeAnalysis.Solution.ContainsProject(Microsoft.CodeAnalysis.ProjectId projectId) -> bool
Microsoft.CodeAnalysis.Solution.FilePath.get -> string
Microsoft.CodeAnalysis.Solution.GetAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.Solution.GetAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.AnalyzerConfigDocument
Microsoft.CodeAnalysis.Solution.GetChanges(Microsoft.CodeAnalysis.Solution oldSolution) -> Microsoft.CodeAnalysis.SolutionChanges
Microsoft.CodeAnalysis.Solution.GetDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Solution.GetDocument(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.Document
Microsoft.CodeAnalysis.Solution.GetDocumentId(Microsoft.CodeAnalysis.SyntaxTree syntaxTree) -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.Solution.GetDocumentId(Microsoft.CodeAnalysis.SyntaxTree syntaxTree, Microsoft.CodeAnalysis.ProjectId projectId) -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.Solution.GetDocumentIdsWithFilePath(string filePath) -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId>
Microsoft.CodeAnalysis.Solution.GetIsolatedSolution() -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.GetLatestProjectVersion() -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Solution.GetProject(Microsoft.CodeAnalysis.IAssemblySymbol assemblySymbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.GetProject(Microsoft.CodeAnalysis.ProjectId projectId) -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.Solution.GetProjectDependencyGraph() -> Microsoft.CodeAnalysis.ProjectDependencyGraph
Microsoft.CodeAnalysis.Solution.Id.get -> Microsoft.CodeAnalysis.SolutionId
Microsoft.CodeAnalysis.Solution.Options.get -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Solution.ProjectIds.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectId>
Microsoft.CodeAnalysis.Solution.Projects.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>
Microsoft.CodeAnalysis.Solution.RemoveAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAdditionalDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerConfigDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveDocuments(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveProject(Microsoft.CodeAnalysis.ProjectId projectId) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.RemoveProjectReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Solution.WithAdditionalDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAdditionalDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAdditionalDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerReferences(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentFilePath(Microsoft.CodeAnalysis.DocumentId documentId, string filePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentFolders(Microsoft.CodeAnalysis.DocumentId documentId, System.Collections.Generic.IEnumerable<string> folders) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentName(Microsoft.CodeAnalysis.DocumentId documentId, string name) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentSourceCodeKind(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.SourceCodeKind sourceCodeKind) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentSyntaxRoot(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentText(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId> documentIds, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithOptions(Microsoft.CodeAnalysis.Options.OptionSet options) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectAnalyzerReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectAssemblyName(Microsoft.CodeAnalysis.ProjectId projectId, string assemblyName) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectCompilationOptions(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.CompilationOptions options) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectCompilationOutputInfo(Microsoft.CodeAnalysis.ProjectId projectId, in Microsoft.CodeAnalysis.CompilationOutputInfo info) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectDefaultNamespace(Microsoft.CodeAnalysis.ProjectId projectId, string defaultNamespace) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectDocumentsOrder(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Immutable.ImmutableList<Microsoft.CodeAnalysis.DocumentId> documentIds) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectFilePath(Microsoft.CodeAnalysis.ProjectId projectId, string filePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectMetadataReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectName(Microsoft.CodeAnalysis.ProjectId projectId, string name) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectOutputFilePath(Microsoft.CodeAnalysis.ProjectId projectId, string outputFilePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectOutputRefFilePath(Microsoft.CodeAnalysis.ProjectId projectId, string outputRefFilePath) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectParseOptions(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ParseOptions options) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithProjectReferences(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.Workspace.get -> Microsoft.CodeAnalysis.Workspace
Microsoft.CodeAnalysis.SolutionChanges
Microsoft.CodeAnalysis.SolutionChanges.GetAddedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.SolutionChanges.GetAddedProjects() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>
Microsoft.CodeAnalysis.SolutionChanges.GetProjectChanges() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectChanges>
Microsoft.CodeAnalysis.SolutionChanges.GetRemovedAnalyzerReferences() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.SolutionChanges.GetRemovedProjects() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>
Microsoft.CodeAnalysis.SolutionChanges.SolutionChanges() -> void
Microsoft.CodeAnalysis.SolutionId
Microsoft.CodeAnalysis.SolutionId.Equals(Microsoft.CodeAnalysis.SolutionId other) -> bool
Microsoft.CodeAnalysis.SolutionId.Id.get -> System.Guid
Microsoft.CodeAnalysis.SolutionInfo
Microsoft.CodeAnalysis.SolutionInfo.AnalyzerReferences.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference>
Microsoft.CodeAnalysis.SolutionInfo.FilePath.get -> string
Microsoft.CodeAnalysis.SolutionInfo.Id.get -> Microsoft.CodeAnalysis.SolutionId
Microsoft.CodeAnalysis.SolutionInfo.Projects.get -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ProjectInfo>
Microsoft.CodeAnalysis.SolutionInfo.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.Tags.WellKnownTags
Microsoft.CodeAnalysis.TextAndVersion
Microsoft.CodeAnalysis.TextAndVersion.FilePath.get -> string
Microsoft.CodeAnalysis.TextAndVersion.Text.get -> Microsoft.CodeAnalysis.Text.SourceText
Microsoft.CodeAnalysis.TextAndVersion.Version.get -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.TextDocument
Microsoft.CodeAnalysis.TextDocument.FilePath.get -> string
Microsoft.CodeAnalysis.TextDocument.Folders.get -> System.Collections.Generic.IReadOnlyList<string>
Microsoft.CodeAnalysis.TextDocument.GetTextAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Text.SourceText>
Microsoft.CodeAnalysis.TextDocument.GetTextVersionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.VersionStamp>
Microsoft.CodeAnalysis.TextDocument.Id.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.TextDocument.Name.get -> string
Microsoft.CodeAnalysis.TextDocument.Project.get -> Microsoft.CodeAnalysis.Project
Microsoft.CodeAnalysis.TextDocument.TryGetText(out Microsoft.CodeAnalysis.Text.SourceText text) -> bool
Microsoft.CodeAnalysis.TextDocument.TryGetTextVersion(out Microsoft.CodeAnalysis.VersionStamp version) -> bool
Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.AdditionalDocument = 1 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.AnalyzerConfigDocument = 2 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.Document = 0 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextLoader
Microsoft.CodeAnalysis.TextLoader.TextLoader() -> void
Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.VersionStamp.Equals(Microsoft.CodeAnalysis.VersionStamp version) -> bool
Microsoft.CodeAnalysis.VersionStamp.GetNewerVersion() -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.VersionStamp.GetNewerVersion(Microsoft.CodeAnalysis.VersionStamp version) -> Microsoft.CodeAnalysis.VersionStamp
Microsoft.CodeAnalysis.VersionStamp.VersionStamp() -> void
Microsoft.CodeAnalysis.Workspace
Microsoft.CodeAnalysis.Workspace.CheckAdditionalDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAdditionalDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAnalyzerConfigDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAnalyzerConfigDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckCanOpenDocuments() -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsClosed(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckDocumentIsOpen(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotContainOpenDocuments(Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveProjectReference(Microsoft.CodeAnalysis.ProjectId fromProjectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectDoesNotHaveTransitiveProjectReference(Microsoft.CodeAnalysis.ProjectId fromProjectId, Microsoft.CodeAnalysis.ProjectId toProjectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectHasAnalyzerReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectHasMetadataReference(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectHasProjectReference(Microsoft.CodeAnalysis.ProjectId fromProjectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectIsInCurrentSolution(Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckProjectIsNotInCurrentSolution(Microsoft.CodeAnalysis.ProjectId projectId) -> void
Microsoft.CodeAnalysis.Workspace.CheckSolutionIsEmpty() -> void
Microsoft.CodeAnalysis.Workspace.ClearOpenDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.ClearOpenDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool isSolutionClosing) -> void
Microsoft.CodeAnalysis.Workspace.ClearSolution() -> void
Microsoft.CodeAnalysis.Workspace.CreateSolution(Microsoft.CodeAnalysis.SolutionId id) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.CreateSolution(Microsoft.CodeAnalysis.SolutionInfo solutionInfo) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.CurrentSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.Dispose() -> void
Microsoft.CodeAnalysis.Workspace.DocumentActiveContextChanged -> System.EventHandler<Microsoft.CodeAnalysis.DocumentActiveContextChangedEventArgs>
Microsoft.CodeAnalysis.Workspace.DocumentClosed -> System.EventHandler<Microsoft.CodeAnalysis.DocumentEventArgs>
Microsoft.CodeAnalysis.Workspace.DocumentOpened -> System.EventHandler<Microsoft.CodeAnalysis.DocumentEventArgs>
Microsoft.CodeAnalysis.Workspace.Kind.get -> string
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentClosed(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader reloader) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentOpened(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, bool isCurrentContext = true) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText newText, Microsoft.CodeAnalysis.PreservationMode mode) -> void
Microsoft.CodeAnalysis.Workspace.OnAdditionalDocumentTextLoaderChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentClosed(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader reloader) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentOpened(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, bool isCurrentContext = true) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText newText, Microsoft.CodeAnalysis.PreservationMode mode) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentTextLoaderChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
Microsoft.CodeAnalysis.Workspace.OnAssemblyNameChanged(Microsoft.CodeAnalysis.ProjectId projectId, string assemblyName) -> void
Microsoft.CodeAnalysis.Workspace.OnCompilationOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.CompilationOptions options) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentClosed(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader reloader, bool updateActiveContext = false) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentContextUpdated(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentInfoChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.DocumentInfo newInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentOpened(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, bool isCurrentContext = true) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentReloaded(Microsoft.CodeAnalysis.DocumentInfo newDocumentInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentsAdded(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentInfos) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentSourceCodeKindChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.SourceCodeKind sourceCodeKind) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText newText, Microsoft.CodeAnalysis.PreservationMode mode) -> void
Microsoft.CodeAnalysis.Workspace.OnDocumentTextLoaderChanged(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader) -> void
Microsoft.CodeAnalysis.Workspace.OnMetadataReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.OnMetadataReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
Microsoft.CodeAnalysis.Workspace.OnOutputFilePathChanged(Microsoft.CodeAnalysis.ProjectId projectId, string outputFilePath) -> void
Microsoft.CodeAnalysis.Workspace.OnOutputRefFilePathChanged(Microsoft.CodeAnalysis.ProjectId projectId, string outputFilePath) -> void
Microsoft.CodeAnalysis.Workspace.OnParseOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ParseOptions options) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectAdded(Microsoft.CodeAnalysis.ProjectInfo projectInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectNameChanged(Microsoft.CodeAnalysis.ProjectId projectId, string name, string filePath) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.OnProjectReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
Microsoft.CodeAnalysis.Workspace.OnSolutionAdded(Microsoft.CodeAnalysis.SolutionInfo solutionInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnSolutionReloaded(Microsoft.CodeAnalysis.SolutionInfo reloadedSolutionInfo) -> void
Microsoft.CodeAnalysis.Workspace.OnSolutionRemoved() -> void
Microsoft.CodeAnalysis.Workspace.Options.get -> Microsoft.CodeAnalysis.Options.OptionSet
Microsoft.CodeAnalysis.Workspace.Options.set -> void
Microsoft.CodeAnalysis.Workspace.RaiseDocumentActiveContextChangedEventAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseDocumentActiveContextChangedEventAsync(Microsoft.CodeAnalysis.Text.SourceTextContainer sourceTextContainer, Microsoft.CodeAnalysis.DocumentId oldActiveContextDocumentId, Microsoft.CodeAnalysis.DocumentId newActiveContextDocumentId) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseDocumentClosedEventAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseDocumentOpenedEventAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RaiseWorkspaceChangedEventAsync(Microsoft.CodeAnalysis.WorkspaceChangeKind kind, Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution newSolution, Microsoft.CodeAnalysis.ProjectId projectId = null, Microsoft.CodeAnalysis.DocumentId documentId = null) -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.RegisterText(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer) -> void
Microsoft.CodeAnalysis.Workspace.ScheduleTask(System.Action action, string taskName = "Workspace.Task") -> System.Threading.Tasks.Task
Microsoft.CodeAnalysis.Workspace.ScheduleTask<T>(System.Func<T> func, string taskName = "Workspace.Task") -> System.Threading.Tasks.Task<T>
Microsoft.CodeAnalysis.Workspace.Services.get -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
Microsoft.CodeAnalysis.Workspace.SetCurrentSolution(Microsoft.CodeAnalysis.Solution solution) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Workspace.UnregisterText(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer) -> void
Microsoft.CodeAnalysis.Workspace.UpdateReferencesAfterAdd() -> void
Microsoft.CodeAnalysis.Workspace.Workspace(Microsoft.CodeAnalysis.Host.HostServices host, string workspaceKind) -> void
Microsoft.CodeAnalysis.Workspace.WorkspaceChanged -> System.EventHandler<Microsoft.CodeAnalysis.WorkspaceChangeEventArgs>
Microsoft.CodeAnalysis.Workspace.WorkspaceFailed -> System.EventHandler<Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs>
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.DocumentId.get -> Microsoft.CodeAnalysis.DocumentId
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.Kind.get -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.NewSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.OldSolution.get -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.ProjectId.get -> Microsoft.CodeAnalysis.ProjectId
Microsoft.CodeAnalysis.WorkspaceChangeEventArgs.WorkspaceChangeEventArgs(Microsoft.CodeAnalysis.WorkspaceChangeKind kind, Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution newSolution, Microsoft.CodeAnalysis.ProjectId projectId = null, Microsoft.CodeAnalysis.DocumentId documentId = null) -> void
Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentAdded = 13 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentChanged = 16 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentReloaded = 15 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AdditionalDocumentRemoved = 14 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentAdded = 18 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentChanged = 21 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentReloaded = 20 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.AnalyzerConfigDocumentRemoved = 19 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentAdded = 9 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentChanged = 12 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentInfoChanged = 17 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentReloaded = 11 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.DocumentRemoved = 10 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectAdded = 5 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectChanged = 7 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectReloaded = 8 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.ProjectRemoved = 6 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionAdded = 1 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionChanged = 0 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionCleared = 3 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionReloaded = 4 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceChangeKind.SolutionRemoved = 2 -> Microsoft.CodeAnalysis.WorkspaceChangeKind
Microsoft.CodeAnalysis.WorkspaceDiagnostic
Microsoft.CodeAnalysis.WorkspaceDiagnostic.Kind.get -> Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceDiagnostic.Message.get -> string
Microsoft.CodeAnalysis.WorkspaceDiagnostic.WorkspaceDiagnostic(Microsoft.CodeAnalysis.WorkspaceDiagnosticKind kind, string message) -> void
Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs
Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs.Diagnostic.get -> Microsoft.CodeAnalysis.WorkspaceDiagnostic
Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs.WorkspaceDiagnosticEventArgs(Microsoft.CodeAnalysis.WorkspaceDiagnostic diagnostic) -> void
Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceDiagnosticKind.Failure = 0 -> Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceDiagnosticKind.Warning = 1 -> Microsoft.CodeAnalysis.WorkspaceDiagnosticKind
Microsoft.CodeAnalysis.WorkspaceKind
Microsoft.CodeAnalysis.WorkspaceRegistration
Microsoft.CodeAnalysis.WorkspaceRegistration.Workspace.get -> Microsoft.CodeAnalysis.Workspace
Microsoft.CodeAnalysis.WorkspaceRegistration.WorkspaceChanged -> System.EventHandler
Microsoft.CodeAnalysis.XmlDocumentationProvider
Microsoft.CodeAnalysis.XmlDocumentationProvider.XmlDocumentationProvider() -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.CanApplyChange(Microsoft.CodeAnalysis.ApplyChangesKind feature) -> bool
override Microsoft.CodeAnalysis.AdhocWorkspace.CanOpenDocuments.get -> bool
override Microsoft.CodeAnalysis.AdhocWorkspace.CloseAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.CloseAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.CloseDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.OpenAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.OpenAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
override Microsoft.CodeAnalysis.AdhocWorkspace.OpenDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
override Microsoft.CodeAnalysis.Classification.ClassifiedSpan.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Classification.ClassifiedSpan.GetHashCode() -> int
override Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void
override Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
override Microsoft.CodeAnalysis.CodeActions.OpenDocumentOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void
override Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.GetHashCode() -> int
override Microsoft.CodeAnalysis.CodeStyle.NotificationOption.ToString() -> string
override Microsoft.CodeAnalysis.CompilationOutputInfo.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.CompilationOutputInfo.GetHashCode() -> int
override Microsoft.CodeAnalysis.Differencing.Edit<TNode>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Differencing.Edit<TNode>.GetHashCode() -> int
override Microsoft.CodeAnalysis.DocumentId.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.DocumentId.GetHashCode() -> int
override Microsoft.CodeAnalysis.DocumentId.ToString() -> string
override Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Editing.DeclarationModifiers.GetHashCode() -> int
override Microsoft.CodeAnalysis.Editing.DeclarationModifiers.ToString() -> string
override Microsoft.CodeAnalysis.FileTextLoader.LoadTextAndVersionAsync(Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.DocumentId documentId, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.TextAndVersion>
override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.GetHashCode() -> int
override Microsoft.CodeAnalysis.Host.Mef.MefHostServices.CreateWorkspaceServices(Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices
override Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption(Microsoft.CodeAnalysis.Options.OptionKey optionAndLanguage, object value) -> Microsoft.CodeAnalysis.Options.OptionSet
override Microsoft.CodeAnalysis.Options.Option<T>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Options.Option<T>.GetHashCode() -> int
override Microsoft.CodeAnalysis.Options.Option<T>.ToString() -> string
override Microsoft.CodeAnalysis.Options.OptionKey.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Options.OptionKey.GetHashCode() -> int
override Microsoft.CodeAnalysis.Options.OptionKey.ToString() -> string
override Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.GetHashCode() -> int
override Microsoft.CodeAnalysis.Options.PerLanguageOption<T>.ToString() -> string
override Microsoft.CodeAnalysis.ProjectId.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.ProjectId.GetHashCode() -> int
override Microsoft.CodeAnalysis.ProjectId.ToString() -> string
override Microsoft.CodeAnalysis.ProjectReference.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.ProjectReference.GetHashCode() -> int
override Microsoft.CodeAnalysis.SolutionId.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.SolutionId.GetHashCode() -> int
override Microsoft.CodeAnalysis.VersionStamp.Equals(object obj) -> bool
override Microsoft.CodeAnalysis.VersionStamp.GetHashCode() -> int
override Microsoft.CodeAnalysis.VersionStamp.ToString() -> string
override Microsoft.CodeAnalysis.WorkspaceDiagnostic.ToString() -> string
override Microsoft.CodeAnalysis.XmlDocumentationProvider.GetDocumentationForSymbol(string documentationMemberID, System.Globalization.CultureInfo preferredCulture, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> string
static Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.AdditiveTypeNames.get -> System.Collections.Immutable.ImmutableArray<string>
static Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpans(Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Text.TextSpan textSpan, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Classification.ClassifiedSpan>
static Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpansAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Classification.ClassifiedSpan>>
static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeAction> nestedActions, bool isInlinable) -> Microsoft.CodeAnalysis.CodeActions.CodeAction
static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>> createChangedDocument, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction
static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>> createChangedSolution, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction
static Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.Create(string description) -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.GetDescription(Microsoft.CodeAnalysis.SyntaxAnnotation annotation) -> string
static Microsoft.CodeAnalysis.CodeActions.RenameAnnotation.Create() -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.Create(string description) -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.GetDescription(Microsoft.CodeAnalysis.SyntaxAnnotation annotation) -> string
static Microsoft.CodeAnalysis.CodeFixes.WellKnownFixAllProviders.BatchFixer.get -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider
static Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Default.get -> Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
static Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.FromXElement(System.Xml.Linq.XElement element) -> Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
static Microsoft.CodeAnalysis.CompilationOutputInfo.operator !=(in Microsoft.CodeAnalysis.CompilationOutputInfo left, in Microsoft.CodeAnalysis.CompilationOutputInfo right) -> bool
static Microsoft.CodeAnalysis.CompilationOutputInfo.operator ==(in Microsoft.CodeAnalysis.CompilationOutputInfo left, in Microsoft.CodeAnalysis.CompilationOutputInfo right) -> bool
static Microsoft.CodeAnalysis.DocumentId.CreateFromSerialized(Microsoft.CodeAnalysis.ProjectId projectId, System.Guid id, string debugName = null) -> Microsoft.CodeAnalysis.DocumentId
static Microsoft.CodeAnalysis.DocumentId.CreateNewId(Microsoft.CodeAnalysis.ProjectId projectId, string debugName = null) -> Microsoft.CodeAnalysis.DocumentId
static Microsoft.CodeAnalysis.DocumentId.operator !=(Microsoft.CodeAnalysis.DocumentId left, Microsoft.CodeAnalysis.DocumentId right) -> bool
static Microsoft.CodeAnalysis.DocumentId.operator ==(Microsoft.CodeAnalysis.DocumentId left, Microsoft.CodeAnalysis.DocumentId right) -> bool
static Microsoft.CodeAnalysis.DocumentInfo.Create(Microsoft.CodeAnalysis.DocumentId id, string name, System.Collections.Generic.IEnumerable<string> folders = null, Microsoft.CodeAnalysis.SourceCodeKind sourceCodeKind = Microsoft.CodeAnalysis.SourceCodeKind.Regular, Microsoft.CodeAnalysis.TextLoader loader = null, string filePath = null, bool isGenerated = false) -> Microsoft.CodeAnalysis.DocumentInfo
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Abstract.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Async.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Const.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Extern.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.From(Microsoft.CodeAnalysis.ISymbol symbol) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.New.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.None.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator !=(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> bool
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator &(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator +(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator -(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator ==(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> bool
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator |(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Override.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Partial.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.ReadOnly.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Ref.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Sealed.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Static.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.TryParse(string value, out Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Unsafe.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Virtual.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Volatile.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WithEvents.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.WriteOnly.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers
static Microsoft.CodeAnalysis.Editing.DocumentEditor.CreateAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Editing.DocumentEditor>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.ImportAdder.AddImportsAsync(Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Editing.SymbolEditor.Create(Microsoft.CodeAnalysis.Document document) -> Microsoft.CodeAnalysis.Editing.SymbolEditor
static Microsoft.CodeAnalysis.Editing.SymbolEditor.Create(Microsoft.CodeAnalysis.Solution solution) -> Microsoft.CodeAnalysis.Editing.SymbolEditor
static Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions.GetBaseOrInterfaceDeclarationReferenceAsync(this Microsoft.CodeAnalysis.Editing.SymbolEditor editor, Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.ITypeSymbol baseOrInterfaceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxNode>
static Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions.SetBaseTypeAsync(this Microsoft.CodeAnalysis.Editing.SymbolEditor editor, Microsoft.CodeAnalysis.INamedTypeSymbol symbol, Microsoft.CodeAnalysis.ITypeSymbol newBaseType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Editing.SymbolEditorExtensions.SetBaseTypeAsync(this Microsoft.CodeAnalysis.Editing.SymbolEditor editor, Microsoft.CodeAnalysis.INamedTypeSymbol symbol, System.Func<Microsoft.CodeAnalysis.Editing.SyntaxGenerator, Microsoft.CodeAnalysis.SyntaxNode> getNewBaseType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddAttribute(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode attribute) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddAttributeArgument(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode attributeDeclaration, Microsoft.CodeAnalysis.SyntaxNode attributeArgument) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddBaseType(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode baseType) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddInterfaceType(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode interfaceType) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddMember(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode member) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddParameter(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode parameter) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.AddReturnAttribute(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode attribute) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.InsertMembers(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, int index, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> members) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.InsertParameter(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, int index, Microsoft.CodeAnalysis.SyntaxNode parameter) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetAccessibility(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Accessibility accessibility) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetExpression(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode expression) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetGetAccessorStatements(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetModifiers(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetName(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, string name) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetSetAccessorStatements(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetStatements(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetType(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode type) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetTypeConstraint(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kind, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> types) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxEditorExtensions.SetTypeParameters(this Microsoft.CodeAnalysis.Editing.SyntaxEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable<string> typeParameters) -> void
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultRemoveOptions -> Microsoft.CodeAnalysis.SyntaxRemoveOptions
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGenerator(Microsoft.CodeAnalysis.Document document) -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGenerator(Microsoft.CodeAnalysis.Project project) -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.GetGenerator(Microsoft.CodeAnalysis.Workspace workspace, string language) -> Microsoft.CodeAnalysis.Editing.SyntaxGenerator
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PreserveTrivia<TNode>(TNode node, System.Func<TNode, Microsoft.CodeAnalysis.SyntaxNode> nodeChanger) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveRange<TNode>(Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode> list, int offset, int count) -> Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode>
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveRange<TNode>(Microsoft.CodeAnalysis.SyntaxList<TNode> list, int offset, int count) -> Microsoft.CodeAnalysis.SyntaxList<TNode>
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceRange(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> replacements) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceWithTrivia(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode original, Microsoft.CodeAnalysis.SyntaxNode replacement) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceWithTrivia(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxToken original, Microsoft.CodeAnalysis.SyntaxToken replacement) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceWithTrivia<TNode>(Microsoft.CodeAnalysis.SyntaxNode root, TNode original, System.Func<TNode, Microsoft.CodeAnalysis.SyntaxNode> replacer) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.operator !=(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation left, Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation right) -> bool
static Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.operator ==(Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation left, Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation right) -> bool
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindCallersAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Document> documents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindCallersAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.SymbolCallerInfo>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDerivedClassesAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, bool transitive = true, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDerivedClassesAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDerivedInterfacesAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, bool transitive = true, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindImplementationsAsync(Microsoft.CodeAnalysis.INamedTypeSymbol type, Microsoft.CodeAnalysis.Solution solution, bool transitive = true, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.INamedTypeSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindImplementationsAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindImplementedInterfaceMembersAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindOverridesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Project> projects = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindReferencesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.FindSymbols.IFindReferencesProgress progress, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Document> documents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindReferencesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.IImmutableSet<Microsoft.CodeAnalysis.Document> documents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindReferencesAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.FindSymbols.ReferencedSymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSimilarSymbols<TSymbol>(TSymbol symbol, Microsoft.CodeAnalysis.Compilation compilation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<TSymbol>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, string name, bool ignoreCase, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, System.Func<string, bool> predicate, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Project project, System.Func<string, bool> predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, string name, bool ignoreCase, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, string name, bool ignoreCase, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, System.Func<string, bool> predicate, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(Microsoft.CodeAnalysis.Solution solution, System.Func<string, bool> predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Project project, string pattern, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Project project, string pattern, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Solution solution, string pattern, Microsoft.CodeAnalysis.SymbolFilter filter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsWithPatternAsync(Microsoft.CodeAnalysis.Solution solution, string pattern, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDefinitionAsync(Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSymbolAtPosition(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSymbolAtPositionAsync(Microsoft.CodeAnalysis.Document document, int position, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSymbolAtPositionAsync(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Formatting.Formatter.Annotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.Format(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxNode
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IList<Microsoft.CodeAnalysis.Text.TextChange>
static Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IList<Microsoft.CodeAnalysis.Text.TextChange>
static Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IList<Microsoft.CodeAnalysis.Text.TextChange>
static Microsoft.CodeAnalysis.Formatting.Formatter.OrganizeImportsAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentationSize.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<int>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.NewLine.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<string>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.SmartIndent.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<int>
static Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies) -> Microsoft.CodeAnalysis.Host.Mef.MefHostServices
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create(System.Composition.CompositionContext compositionContext) -> Microsoft.CodeAnalysis.Host.Mef.MefHostServices
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.DefaultAssemblies.get -> System.Collections.Immutable.ImmutableArray<System.Reflection.Assembly>
static Microsoft.CodeAnalysis.Host.Mef.MefHostServices.DefaultHost.get -> Microsoft.CodeAnalysis.Host.Mef.MefHostServices
static Microsoft.CodeAnalysis.Options.Option<T>.implicit operator Microsoft.CodeAnalysis.Options.OptionKey(Microsoft.CodeAnalysis.Options.Option<T> option) -> Microsoft.CodeAnalysis.Options.OptionKey
static Microsoft.CodeAnalysis.Options.OptionKey.operator !=(Microsoft.CodeAnalysis.Options.OptionKey left, Microsoft.CodeAnalysis.Options.OptionKey right) -> bool
static Microsoft.CodeAnalysis.Options.OptionKey.operator ==(Microsoft.CodeAnalysis.Options.OptionKey left, Microsoft.CodeAnalysis.Options.OptionKey right) -> bool
static Microsoft.CodeAnalysis.ProjectId.CreateFromSerialized(System.Guid id, string debugName = null) -> Microsoft.CodeAnalysis.ProjectId
static Microsoft.CodeAnalysis.ProjectId.CreateNewId(string debugName = null) -> Microsoft.CodeAnalysis.ProjectId
static Microsoft.CodeAnalysis.ProjectId.operator !=(Microsoft.CodeAnalysis.ProjectId left, Microsoft.CodeAnalysis.ProjectId right) -> bool
static Microsoft.CodeAnalysis.ProjectId.operator ==(Microsoft.CodeAnalysis.ProjectId left, Microsoft.CodeAnalysis.ProjectId right) -> bool
static Microsoft.CodeAnalysis.ProjectInfo.Create(Microsoft.CodeAnalysis.ProjectId id, Microsoft.CodeAnalysis.VersionStamp version, string name, string assemblyName, string language, string filePath = null, string outputFilePath = null, Microsoft.CodeAnalysis.CompilationOptions compilationOptions = null, Microsoft.CodeAnalysis.ParseOptions parseOptions = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> documents = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> additionalDocuments = null, bool isSubmission = false, System.Type hostObjectType = null, string outputRefFilePath = null) -> Microsoft.CodeAnalysis.ProjectInfo
static Microsoft.CodeAnalysis.ProjectInfo.Create(Microsoft.CodeAnalysis.ProjectId id, Microsoft.CodeAnalysis.VersionStamp version, string name, string assemblyName, string language, string filePath, string outputFilePath, Microsoft.CodeAnalysis.CompilationOptions compilationOptions, Microsoft.CodeAnalysis.ParseOptions parseOptions, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> documents, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.MetadataReference> metadataReferences, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentInfo> additionalDocuments, bool isSubmission, System.Type hostObjectType) -> Microsoft.CodeAnalysis.ProjectInfo
static Microsoft.CodeAnalysis.ProjectReference.operator !=(Microsoft.CodeAnalysis.ProjectReference left, Microsoft.CodeAnalysis.ProjectReference right) -> bool
static Microsoft.CodeAnalysis.ProjectReference.operator ==(Microsoft.CodeAnalysis.ProjectReference left, Microsoft.CodeAnalysis.ProjectReference right) -> bool
static Microsoft.CodeAnalysis.Recommendations.RecommendationOptions.FilterOutOfScopeLocals.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Recommendations.RecommendationOptions.HideAdvancedMembers.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPosition(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPositionAsync(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ISymbol>>
static Microsoft.CodeAnalysis.Rename.RenameOptions.PreviewChanges.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameInComments.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameInStrings.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameOverloads.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAsync(Microsoft.CodeAnalysis.Document document, string newDocumentName, System.Collections.Generic.IReadOnlyList<string> newDocumentFolders = null, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet>
static Microsoft.CodeAnalysis.Rename.Renamer.RenameSymbolAsync(Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.ISymbol symbol, string newName, Microsoft.CodeAnalysis.Options.OptionSet optionSet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.AllowSimplificationToBaseType.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.AllowSimplificationToGenericType.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferAliasToQualification.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferImplicitTypeInference.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferImplicitTypeInLocalDeclaration.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferOmittingModuleNamesInQualification.get -> Microsoft.CodeAnalysis.Options.Option<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyEventAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyFieldAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyMemberAccessWithThisOrMe.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyMethodAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyPropertyAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.Simplifier.AddImportsAnnotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.Simplification.Simplifier.Annotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.Simplification.Simplifier.Expand(Microsoft.CodeAnalysis.SyntaxToken token, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Workspace workspace, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SyntaxToken
static Microsoft.CodeAnalysis.Simplification.Simplifier.Expand<TNode>(TNode node, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Workspace workspace, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, bool expandParameter = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> TNode
static Microsoft.CodeAnalysis.Simplification.Simplifier.ExpandAsync(Microsoft.CodeAnalysis.SyntaxToken token, Microsoft.CodeAnalysis.Document document, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxToken>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ExpandAsync<TNode>(TNode node, Microsoft.CodeAnalysis.Document document, System.Func<Microsoft.CodeAnalysis.SyntaxNode, bool> expandInsideNode = null, bool expandParameter = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<TNode>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
static Microsoft.CodeAnalysis.Simplification.Simplifier.SpecialTypeAnnotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation
static Microsoft.CodeAnalysis.SolutionId.CreateFromSerialized(System.Guid id, string debugName = null) -> Microsoft.CodeAnalysis.SolutionId
static Microsoft.CodeAnalysis.SolutionId.CreateNewId(string debugName = null) -> Microsoft.CodeAnalysis.SolutionId
static Microsoft.CodeAnalysis.SolutionId.operator !=(Microsoft.CodeAnalysis.SolutionId left, Microsoft.CodeAnalysis.SolutionId right) -> bool
static Microsoft.CodeAnalysis.SolutionId.operator ==(Microsoft.CodeAnalysis.SolutionId left, Microsoft.CodeAnalysis.SolutionId right) -> bool
static Microsoft.CodeAnalysis.SolutionInfo.Create(Microsoft.CodeAnalysis.SolutionId id, Microsoft.CodeAnalysis.VersionStamp version, string filePath = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectInfo> projects = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference> analyzerReferences = null) -> Microsoft.CodeAnalysis.SolutionInfo
static Microsoft.CodeAnalysis.SolutionInfo.Create(Microsoft.CodeAnalysis.SolutionId id, Microsoft.CodeAnalysis.VersionStamp version, string filePath, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectInfo> projects) -> Microsoft.CodeAnalysis.SolutionInfo
static Microsoft.CodeAnalysis.TextAndVersion.Create(Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.VersionStamp version, string filePath = null) -> Microsoft.CodeAnalysis.TextAndVersion
static Microsoft.CodeAnalysis.TextLoader.From(Microsoft.CodeAnalysis.Text.SourceTextContainer container, Microsoft.CodeAnalysis.VersionStamp version, string filePath = null) -> Microsoft.CodeAnalysis.TextLoader
static Microsoft.CodeAnalysis.TextLoader.From(Microsoft.CodeAnalysis.TextAndVersion textAndVersion) -> Microsoft.CodeAnalysis.TextLoader
static Microsoft.CodeAnalysis.VersionStamp.Create() -> Microsoft.CodeAnalysis.VersionStamp
static Microsoft.CodeAnalysis.VersionStamp.Create(System.DateTime utcTimeLastModified) -> Microsoft.CodeAnalysis.VersionStamp
static Microsoft.CodeAnalysis.VersionStamp.Default.get -> Microsoft.CodeAnalysis.VersionStamp
static Microsoft.CodeAnalysis.VersionStamp.operator !=(Microsoft.CodeAnalysis.VersionStamp left, Microsoft.CodeAnalysis.VersionStamp right) -> bool
static Microsoft.CodeAnalysis.VersionStamp.operator ==(Microsoft.CodeAnalysis.VersionStamp left, Microsoft.CodeAnalysis.VersionStamp right) -> bool
static Microsoft.CodeAnalysis.Workspace.GetWorkspaceRegistration(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer) -> Microsoft.CodeAnalysis.WorkspaceRegistration
static Microsoft.CodeAnalysis.Workspace.TryGetWorkspace(Microsoft.CodeAnalysis.Text.SourceTextContainer textContainer, out Microsoft.CodeAnalysis.Workspace workspace) -> bool
static Microsoft.CodeAnalysis.XmlDocumentationProvider.CreateFromBytes(byte[] xmlDocCommentBytes) -> Microsoft.CodeAnalysis.XmlDocumentationProvider
static Microsoft.CodeAnalysis.XmlDocumentationProvider.CreateFromFile(string xmlDocCommentFilePath) -> Microsoft.CodeAnalysis.XmlDocumentationProvider
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyEventAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyFieldAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyMethodAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyPropertyAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<bool>>
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Error -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.None -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Silent -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Suggestion -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Warning -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.EquivalenceKey.get -> string
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedDocumentAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Solution>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.Tags.get -> System.Collections.Immutable.ImmutableArray<string>
virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void
virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Title.get -> string
virtual Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.GetFixAllProvider() -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider
virtual Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetSupportedFixAllDiagnosticIds(Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider originalCodeFixProvider) -> System.Collections.Generic.IEnumerable<string>
virtual Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetSupportedFixAllScopes() -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.CodeFixes.FixAllScope>
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNodesAfter(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNodesBefore(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> newDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode memberName) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.OperatorDeclaration(Microsoft.CodeAnalysis.Editing.OperatorKind kind, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> parameters = null, Microsoft.CodeAnalysis.SyntaxNode returnType = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> statements = null) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNode(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxRemoveOptions options) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceNode(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newDeclaration) -> Microsoft.CodeAnalysis.SyntaxNode
virtual Microsoft.CodeAnalysis.FileTextLoader.CreateText(System.IO.Stream stream, Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Text.SourceText
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetLanguageServices(string languageName) -> Microsoft.CodeAnalysis.Host.HostLanguageServices
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.IsSupported(string languageName) -> bool
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.PersistentStorage.get -> Microsoft.CodeAnalysis.Host.IPersistentStorageService
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.SupportedLanguages.get -> System.Collections.Generic.IEnumerable<string>
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.TemporaryStorage.get -> Microsoft.CodeAnalysis.Host.ITemporaryStorageService
virtual Microsoft.CodeAnalysis.Workspace.AdjustReloadedProject(Microsoft.CodeAnalysis.Project oldProject, Microsoft.CodeAnalysis.Project reloadedProject) -> Microsoft.CodeAnalysis.Project
virtual Microsoft.CodeAnalysis.Workspace.AdjustReloadedSolution(Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution reloadedSolution) -> Microsoft.CodeAnalysis.Solution
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerConfigDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerConfigDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerConfigDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyAnalyzerReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference analyzerReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyCompilationOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.CompilationOptions options) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentInfoChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.DocumentInfo info) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyDocumentTextChanged(Microsoft.CodeAnalysis.DocumentId id, Microsoft.CodeAnalysis.Text.SourceText text) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyMetadataReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyMetadataReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.MetadataReference metadataReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyParseOptionsChanged(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ParseOptions options) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectAdded(Microsoft.CodeAnalysis.ProjectInfo project) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectChanges(Microsoft.CodeAnalysis.ProjectChanges projectChanges) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectReferenceAdded(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectReferenceRemoved(Microsoft.CodeAnalysis.ProjectId projectId, Microsoft.CodeAnalysis.ProjectReference projectReference) -> void
virtual Microsoft.CodeAnalysis.Workspace.ApplyProjectRemoved(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CanApplyChange(Microsoft.CodeAnalysis.ApplyChangesKind feature) -> bool
virtual Microsoft.CodeAnalysis.Workspace.CanApplyCompilationOptionChange(Microsoft.CodeAnalysis.CompilationOptions oldOptions, Microsoft.CodeAnalysis.CompilationOptions newOptions, Microsoft.CodeAnalysis.Project project) -> bool
virtual Microsoft.CodeAnalysis.Workspace.CanApplyParseOptionChange(Microsoft.CodeAnalysis.ParseOptions oldOptions, Microsoft.CodeAnalysis.ParseOptions newOptions, Microsoft.CodeAnalysis.Project project) -> bool
virtual Microsoft.CodeAnalysis.Workspace.CanOpenDocuments.get -> bool
virtual Microsoft.CodeAnalysis.Workspace.CheckDocumentCanBeRemoved(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CheckProjectCanBeRemoved(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ClearDocumentData(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ClearProjectData(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.ClearSolutionData() -> void
virtual Microsoft.CodeAnalysis.Workspace.CloseAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CloseAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.CloseDocument(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.Dispose(bool finalize) -> void
virtual Microsoft.CodeAnalysis.Workspace.GetAdditionalDocumentName(Microsoft.CodeAnalysis.DocumentId documentId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetAnalyzerConfigDocumentName(Microsoft.CodeAnalysis.DocumentId documentId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetDocumentIdInCurrentContext(Microsoft.CodeAnalysis.Text.SourceTextContainer container) -> Microsoft.CodeAnalysis.DocumentId
virtual Microsoft.CodeAnalysis.Workspace.GetDocumentName(Microsoft.CodeAnalysis.DocumentId documentId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetOpenDocumentIds(Microsoft.CodeAnalysis.ProjectId projectId = null) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
virtual Microsoft.CodeAnalysis.Workspace.GetProjectName(Microsoft.CodeAnalysis.ProjectId projectId) -> string
virtual Microsoft.CodeAnalysis.Workspace.GetRelatedDocumentIds(Microsoft.CodeAnalysis.Text.SourceTextContainer container) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.DocumentId>
virtual Microsoft.CodeAnalysis.Workspace.IsDocumentOpen(Microsoft.CodeAnalysis.DocumentId documentId) -> bool
virtual Microsoft.CodeAnalysis.Workspace.OnDocumentClosing(Microsoft.CodeAnalysis.DocumentId documentId) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnDocumentTextChanged(Microsoft.CodeAnalysis.Document document) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnProjectReloaded(Microsoft.CodeAnalysis.ProjectInfo reloadedProjectInfo) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnProjectRemoved(Microsoft.CodeAnalysis.ProjectId projectId) -> void
virtual Microsoft.CodeAnalysis.Workspace.OnWorkspaceFailed(Microsoft.CodeAnalysis.WorkspaceDiagnostic diagnostic) -> void
virtual Microsoft.CodeAnalysis.Workspace.OpenAdditionalDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
virtual Microsoft.CodeAnalysis.Workspace.OpenAnalyzerConfigDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
virtual Microsoft.CodeAnalysis.Workspace.OpenDocument(Microsoft.CodeAnalysis.DocumentId documentId, bool activate = true) -> void
virtual Microsoft.CodeAnalysis.Workspace.PartialSemanticsEnabled.get -> bool
virtual Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Microsoft.CodeAnalysis.Solution newSolution) -> bool
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/VisualStudio/Core/Test/CodeModel/AbstractCodeModelObjectTests.AttributeData.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Partial Public MustInherit Class AbstractCodeModelObjectTests(Of TCodeModelObject As Class)
Protected Class AttributeData
Public Property Name As String
Public Property Value As String
Public Property Position As Object = 0
End Class
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Partial Public MustInherit Class AbstractCodeModelObjectTests(Of TCodeModelObject As Class)
Protected Class AttributeData
Public Property Name As String
Public Property Value As String
Public Property Position As Object = 0
End Class
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./docs/wiki/VS-2015-CTP-6-API-Changes.md | #API changes between VS 2015 CTP5 and VS 2015 CTP6
##Diagnostics and CodeFix API Changes
- DiagnosticAnalyzerAttribute's parameterless constructor has been removed. When no language was passed in, we were treating that to mean the analyzer works for any language which is not a guarantee anyone can make.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis.Diagnostics {
public sealed class DiagnosticAnalyzerAttribute : Attribute {
- public DiagnosticAnalyzerAttribute();
- public DiagnosticAnalyzerAttribute(string supportedLanguage);
+ public DiagnosticAnalyzerAttribute(string firstLanguage, params string[] additionalLanguages);
+ public string[] Languages { get; }
- public string SupportedLanguage { get; }
}
}
}
```
- The CodeFixes\CodeRefactoring APIs were cleaned up for consistency. `CodeAction.Create`'s overloads which took Document\Solution were removed because they lead to poor performance in the lightbulb.
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis.CodeActions {
public abstract class CodeAction {
+ public virtual string EquivalenceKey { get; }
- public virtual string Id { get; }
- public static CodeAction Create(string description, Document changedDocument, string id=null);
- public static CodeAction Create(string description, Solution changedSolution, string id=null);
public static CodeAction Create(string descriptiontitle, Func<CancellationToken, Task<Document>> createChangedDocument, string idequivalenceKey=null);
public static CodeAction Create(string descriptiontitle, Func<CancellationToken, Task<Solution>> createChangedSolution, string idequivalenceKey=null);
- public Task<IEnumerable<CodeActionOperation>> GetOperationsAsync(CancellationToken cancellationToken);
+ public Task<ImmutableArray<CodeActionOperation>> GetOperationsAsync(CancellationToken cancellationToken);
- public Task<IEnumerable<CodeActionOperation>> GetPreviewOperationsAsync(CancellationToken cancellationToken);
+ public Task<ImmutableArray<CodeActionOperation>> GetPreviewOperationsAsync(CancellationToken cancellationToken);
- protected Task<IEnumerable<CodeActionOperation>> PostProcessAsync(IEnumerable<CodeActionOperation> operations, CancellationToken cancellationToken);
+ protected Task<ImmutableArray<CodeActionOperation>> PostProcessAsync(IEnumerable<CodeActionOperation> operations, CancellationToken cancellationToken);
}
public abstract class CodeActionWithOptions : CodeAction {
+ protected override Task<IEnumerable<CodeActionOperation>> ComputeOperationsAsync(CancellationToken cancellationToken);
}
}
namespace Microsoft.CodeAnalysis.CodeFixes {
public struct CodeFixContext {
public CodeFixContext(Document document, Diagnostic diagnostic, Action<CodeAction, ImmutableArray<Diagnostic>> registerFixregisterCodeFix, CancellationToken cancellationToken);
public CodeFixContext(Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, Action<CodeAction, ImmutableArray<Diagnostic>> registerFixregisterCodeFix, CancellationToken cancellationToken);
+ public void RegisterCodeFix(CodeAction action, Diagnostic diagnostic);
+ public void RegisterCodeFix(CodeAction action, IEnumerable<Diagnostic> diagnostics);
+ public void RegisterCodeFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics);
- public void RegisterFix(CodeAction action, Diagnostic diagnostic);
- public void RegisterFix(CodeAction action, IEnumerable<Diagnostic> diagnostics);
- public void RegisterFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics);
}
public abstract class CodeFixProvider {
+ public abstract ImmutableArray<string> FixableDiagnosticIds { get; }
- public abstract Task ComputeFixesAsync(CodeFixContext context);
- public abstract ImmutableArray<string> GetFixableDiagnosticIds();
+ public abstract Task RegisterCodeFixesAsync(CodeFixContext context);
}
public sealed class ExportCodeFixProviderAttribute : ExportAttribute {
public ExportCodeFixProviderAttribute(string namefirstLanguage, params string[] languagesadditionalLanguages);
- public ExportCodeFixProviderAttribute(params string[] languages);
public string Name { get; set; }
}
public class FixAllContext {
+ public string CodeActionEquivalenceKey { get; }
- public string CodeActionId { get; }
+ public Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync(Project project);
- public Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync(Document document);
- public Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync(Project project);
+ public Task<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document);
+ public Task<ImmutableArray<Diagnostic>> GetProjectDiagnosticsAsync(Project project);
}
namespace Microsoft.CodeAnalysis.CodeRefactorings {
public sealed class ExportCodeRefactoringProviderAttribute : ExportAttribute {
- public ExportCodeRefactoringProviderAttribute(string name, string language);
+ public ExportCodeRefactoringProviderAttribute(string firstLanguage, params string[] additionalLanguages);
- public string Language { get; }
+ public string[] Languages { get; }
public string Name { get; set; }
}
}
}
```
- Additional documents are represented as `SourceText` instead of streams in the API now as only text files were being handed out as additional documents anyway. AnalyzerOptions has been cleaned up to only have properties which are supported. Also `DiagnosticDescriptor`'s HelpLink was renamed to make it clearer.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
- public abstract class AdditionalStream {
- protected AdditionalStream();
- public abstract string Path { get; }
- public abstract Stream OpenRead(CancellationToken cancellationToken=null);
}
+ public abstract class AdditionalText {
+ protected AdditionalText();
+ public abstract string Path { get; }
+ public abstract SourceText GetText(CancellationToken cancellationToken=null);
}
public class AnalyzerOptions {
- public AnalyzerOptions(ImmutableArray<AdditionalStream> additionalStreams, ImmutableDictionary<string, string> globalOptions, CultureInfo culture=null);
+ public AnalyzerOptions(ImmutableArray<AdditionalText> additionalFiles);
+ public ImmutableArray<AdditionalText> AdditionalFiles { get; }
- public ImmutableArray<AdditionalStream> AdditionalStreams { get; }
- public CultureInfo Culture { get; }
- public ImmutableDictionary<string, string> GlobalOptions { get; }
+ public AnalyzerOptions WithAdditionalFiles(ImmutableArray<AdditionalText> additionalFiles);
- public AnalyzerOptions WithAdditionalStreams(ImmutableArray<AdditionalStream> additionalStreams);
- public AnalyzerOptions WithCulture(CultureInfo culture);
- public AnalyzerOptions WithGlobalOptions(ImmutableDictionary<string, string> globalOptions);
}
public class DiagnosticDescriptor : IEquatable<DiagnosticDescriptor> {
- public string HelpLink { get; }
+ public string HelpLinkUri { get; }
+ public bool Equals(DiagnosticDescriptor other);
}
```
- `AnalyzerDriver` is the type that hosts used to run analyzers and produce diagnostics. However this API leaked a bunch of implementation details and was confusing. The entire type and its friends are all internal now and instead new type called `CompilationWithAnalyzers` has been added for hosts to compute diagnostics from analyzers. As part of this change `SemanticModel.GetDeclarationsInSpan` was removed as well as that method wasn't complete and was very specific to what the AnalyzerDriver needed.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis.Diagnostics {
+ public class CompilationWithAnalyzers {
+ public CompilationWithAnalyzers(Compilation compilation, ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerOptions options, CancellationToken cancellationToken);
+ public Compilation Compilation { get; }
+ public Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync();
+ public Task<ImmutableArray<Diagnostic>> GetAnalyzerDiagnosticsAsync();
+ public static IEnumerable<Diagnostic> GetEffectiveDiagnostics(IEnumerable<Diagnostic> diagnostics, Compilation compilation);
+ public static bool IsDiagnosticAnalyzerSuppressed(DiagnosticAnalyzer analyzer, CompilationOptions options, Func<Exception, DiagnosticAnalyzer, bool> continueOnAnalyzerException);
}
+ public static class DiagnosticAnalyzerExtensions {
+ public static CompilationWithAnalyzers WithAnalyzers(this Compilation compilation, ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerOptions options=null, CancellationToken cancellationToken=null);
}
- public sealed class AnalyzerActions { ... }
- public abstract class AnalyzerDriver : IDisposable { ... }
- public class AnalyzerDriver<TLanguageKindEnum> : AnalyzerDriver { ... }
- public sealed class AsyncQueue<TElement> { ... }
- public abstract class CompilationEvent { ... }
- public sealed class CompilationCompletedEvent : CompilationEvent { ... }
- public sealed class CompilationStartedEvent : CompilationEvent { ... }
- public sealed class CompilationUnitCompletedEvent : CompilationEvent { ... }
- public sealed class SymbolDeclaredCompilationEvent : CompilationEvent { ... }
}
namespace Microsoft.CodeAnalysis {
public abstract class Compilation {
- public abstract Compilation WithEventQueue(AsyncQueue<CompilationEvent> eventQueue);
}
public struct DeclarationInfo {
- public SyntaxNode DeclaredNode { get; }
- public ISymbol DeclaredSymbol { get; }
- public ImmutableArray<SyntaxNode> ExecutableCodeBlocks { get; }
}
public abstract class SemanticModel {
- protected internal abstract ImmutableArray<DeclarationInfo> GetDeclarationsInNode(SyntaxNode node, bool getSymbol, CancellationToken cancellationToken, Nullable<int> levelsToCompute=null);
- public abstract ImmutableArray<DeclarationInfo> GetDeclarationsInSpan(TextSpan span, bool getSymbol, CancellationToken cancellationToken);
}
}
```
- Context objects got public constructors so that they can be unit tested. `RegisterCodeBlockEndAction` became non-generic since the generic parameter wasn't being used.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis.Diagnostics {
public abstract class AnalysisContext {
+ protected AnalysisContext();
+ public abstract void RegisterCodeBlockEndAction(Action<CodeBlockEndAnalysisContext> action);
- public void RegisterCodeBlockEndAction<TLanguageKindEnum>(Action<CodeBlockEndAnalysisContext> action) where TLanguageKindEnum : struct, ValueType;
}
public struct CodeBlockEndAnalysisContext {
+ public CodeBlockEndAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public abstract class CodeBlockStartAnalysisContext<TLanguageKindEnum> where TLanguageKindEnum : struct, ValueType {
+ protected CodeBlockStartAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, CancellationToken cancellationToken);
}
public struct CompilationEndAnalysisContext {
+ public CompilationEndAnalysisContext(Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public abstract class CompilationStartAnalysisContext {
+ protected CompilationStartAnalysisContext(Compilation compilation, AnalyzerOptions options, CancellationToken cancellationToken);
+ public abstract void RegisterCodeBlockEndAction(Action<CodeBlockEndAnalysisContext> action);
- public void RegisterCodeBlockEndAction<TLanguageKindEnum>(Action<CodeBlockEndAnalysisContext> action) where TLanguageKindEnum : struct, ValueType;
}
public struct SemanticModelAnalysisContext {
+ public SemanticModelAnalysisContext(SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public struct SymbolAnalysisContext {
+ public SymbolAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public struct SyntaxNodeAnalysisContext {
+ public SyntaxNodeAnalysisContext(SyntaxNode node, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public struct SyntaxTreeAnalysisContext {
+ public SyntaxTreeAnalysisContext(SyntaxTree tree, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
}
}
```
- **Code Editing**: CTP5 introduced a `SyntaxGenerator` type which made it easy to generate code in fixes or refactorings in a language independent manner. More functionality has been added to that type. Also, all types related to editing code were moved into a new namespace and types like `SyntaxEditor`, `DocumentEditor` and `SolutionEditor` have been introduced to enable writing language independent (between C#\VB) codeactions.
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
- namespace Microsoft.CodeAnalysis.CodeGeneration {
+ namespace Microsoft.CodeAnalysis.Editing {
+ public class DocumentEditor : SyntaxEditor {
+ public Document OriginalDocument { get; }
+ public SemanticModel SemanticModel { get; }
+ public static Task<DocumentEditor> CreateAsync(Document document, CancellationToken cancellationToken=null);
+ public Document GetChangedDocument();
}
+ public class SolutionEditor {
+ public SolutionEditor(Solution solution);
+ public Solution OriginalSolution { get; }
+ public Solution GetChangedSolution();
+ public Task<DocumentEditor> GetDocumentEditorAsync(DocumentId id, CancellationToken cancellationToken=null);
}
+ public sealed class SymbolEditor {
- public SymbolEditor(Document document);
- public SymbolEditor(Solution solution);
- public Solution CurrentSolution { get; }
+ public Solution ChangedSolution { get; }
+ public Solution OriginalSolution { get; }
+ public static SymbolEditor Create(Document document);
+ public static SymbolEditor Create(Solution solution);
- public Task<ISymbol> EditAllDeclarationsAsync(ISymbol symbol, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditAllDeclarationsAsync(ISymbol symbol, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditAllDeclarationsAsync(ISymbol symbol, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
- public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
- public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, ISymbol member, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, ISymbol member, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, ISymbol member, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
- public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Location location, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Location location, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Location location, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public IEnumerable<Document> GetChangedDocuments();
+ public Task<IReadOnlyList<SyntaxNode>> GetCurrentDeclarationsAsync(ISymbol symbol, CancellationToken cancellationToken=null);
+ public Task<ISymbol> GetCurrentSymbolAsync(ISymbol symbol, CancellationToken cancellationToken=null);
+ public delegate Task AsyncDeclarationEditAction(DocumentEditor editor, SyntaxNode declaration, CancellationToken cancellationToken);
+ public delegate void DeclarationEditAction(DocumentEditor editor, SyntaxNode declaration);
}
+ public static class SymbolEditorExtensions {
+ public static Task<SyntaxNode> GetBaseOrInterfaceDeclarationReferenceAsync(this SymbolEditor editor, ISymbol symbol, ITypeSymbol baseOrInterfaceType, CancellationToken cancellationToken=null);
+ public static Task<ISymbol> SetBaseTypeAsync(this SymbolEditor editor, INamedTypeSymbol symbol, ITypeSymbol newBaseType, CancellationToken cancellationToken=null);
+ public static Task<ISymbol> SetBaseTypeAsync(this SymbolEditor editor, INamedTypeSymbol symbol, Func<SyntaxGenerator, SyntaxNode> getNewBaseType, CancellationToken cancellationToken=null);
}
+ public class SyntaxEditor {
+ public SyntaxEditor(SyntaxNode root, Workspace workspace);
+ public SyntaxGenerator Generator { get; }
+ public SyntaxNode OriginalRoot { get; }
+ public SyntaxNode GetChangedRoot();
+ public void InsertAfter(SyntaxNode node, SyntaxNode newNode);
+ public void InsertAfter(SyntaxNode node, IEnumerable<SyntaxNode> newNodes);
+ public void InsertBefore(SyntaxNode node, SyntaxNode newNode);
+ public void InsertBefore(SyntaxNode node, IEnumerable<SyntaxNode> newNodes);
+ public void RemoveNode(SyntaxNode node);
+ public void ReplaceNode(SyntaxNode node, SyntaxNode newNode);
+ public void ReplaceNode(SyntaxNode node, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> computeReplacement);
+ public void TrackNode(SyntaxNode node);
}
+ public static class SyntaxEditorExtensions {
+ public static void AddAttribute(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode attribute);
+ public static void AddAttributeArgument(this SyntaxEditor editor, SyntaxNode attributeDeclaration, SyntaxNode attributeArgument);
+ public static void AddBaseType(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode baseType);
+ public static void AddInterfaceType(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode interfaceType);
+ public static void AddMember(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode member);
+ public static void AddParameter(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode parameter);
+ public static void AddReturnAttribute(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode attribute);
+ public static void InsertMembers(this SyntaxEditor editor, SyntaxNode declaration, int index, IEnumerable<SyntaxNode> members);
+ public static void SetAccessibility(this SyntaxEditor editor, SyntaxNode declaration, Accessibility accessibility);
+ public static void SetExpression(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode expression);
+ public static void SetGetAccessorStatements(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<SyntaxNode> statements);
+ public static void SetModifiers(this SyntaxEditor editor, SyntaxNode declaration, DeclarationModifiers modifiers);
+ public static void SetName(this SyntaxEditor editor, SyntaxNode declaration, string name);
+ public static void SetSetAccessorStatements(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<SyntaxNode> statements);
+ public static void SetStatements(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<SyntaxNode> statements);
+ public static void SetType(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode type);
+ public static void SetTypeConstraint(this SyntaxEditor editor, SyntaxNode declaration, string typeParameterName, SpecialTypeConstraintKind kind, IEnumerable<SyntaxNode> types);
+ public static void SetTypeParameters(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<string> typeParameters);
}
public abstract class SyntaxGenerator : ILanguageService {
+ public SyntaxNode AddAttributeArguments(SyntaxNode attributeDeclaration, IEnumerable<SyntaxNode> attributeArguments);
+ public abstract SyntaxNode AddBaseType(SyntaxNode declaration, SyntaxNode baseType);
+ public abstract SyntaxNode AddInterfaceType(SyntaxNode declaration, SyntaxNode interfaceType);
+ public abstract IReadOnlyList<SyntaxNode> GetAttributeArguments(SyntaxNode attributeDeclaration);
+ public abstract IReadOnlyList<SyntaxNode> GetBaseAndInterfaceTypes(SyntaxNode declaration);
+ public abstract SyntaxNode InsertAttributeArguments(SyntaxNode attributeDeclaration, int index, IEnumerable<SyntaxNode> attributeArguments);
+ public virtual SyntaxNode InsertNodesAfter(SyntaxNode root, SyntaxNode node, IEnumerable<SyntaxNode> newDeclarations);
+ public virtual SyntaxNode InsertNodesBefore(SyntaxNode root, SyntaxNode node, IEnumerable<SyntaxNode> newDeclarations);
- public abstract SyntaxNode RemoveAttributes(SyntaxNode declaration, IEnumerable<SyntaxNode> attributes);
- public SyntaxNode RemoveMembers(SyntaxNode declaration, params SyntaxNode[] members);
- public SyntaxNode RemoveMembers(SyntaxNode declaration, IEnumerable<SyntaxNode> members);
- public SyntaxNode RemoveNamespaceImports(SyntaxNode declaration, params SyntaxNode[] imports);
- public SyntaxNode RemoveNamespaceImports(SyntaxNode declaration, IEnumerable<SyntaxNode> imports);
- public SyntaxNode RemoveParameters(SyntaxNode declaration, IEnumerable<SyntaxNode> parameters);
- public abstract SyntaxNode RemoveReturnAttributes(SyntaxNode declaration, IEnumerable<SyntaxNode> attributes);
+ public virtual SyntaxNode RemoveNode(SyntaxNode root, SyntaxNode node);
+ public SyntaxNode RemoveNodes(SyntaxNode root, IEnumerable<SyntaxNode> declarations);
+ public virtual SyntaxNode ReplaceNode(SyntaxNode root, SyntaxNode node, SyntaxNode newDeclaration);
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
public abstract class SyntaxNode {
+ public bool Contains(SyntaxNode node);
}
public static class SyntaxNodeExtensions {
+ public static TSyntax WithoutTrivia<TSyntax>(this TSyntax syntax) where TSyntax : SyntaxNode;
+ public static TSyntax WithTriviaFrom<TSyntax>(this TSyntax syntax, SyntaxNode node) where TSyntax : SyntaxNode;
}
public struct SyntaxToken : IEquatable<SyntaxToken> {
+ public SyntaxToken WithTriviaFrom(SyntaxToken token);
}
}
}
```
##Workspace and hosting API Changes
- `CustomWorkspace` has been renamed to `AdhocWorkspace`. The name CustomWorkspace led people to think that this was the type to use to build their own custom workspaces. However this type is simply a quick-and-dirty workspace that's useful for very simple scenarios. To really have a fully functional workspace, one should derive from Workspace.
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis {
- public class CustomWorkspace : Workspace {
+ public sealed class AdhocWorkspace : Workspace {
+ public AdhocWorkspace();
+ public override bool CanOpenDocuments { get; }
+ public override void CloseAdditionalDocument(DocumentId documentId);
+ public override void CloseDocument(DocumentId documentId);
+ public override void OpenAdditionalDocument(DocumentId documentId, bool activate=true);
+ public override void OpenDocument(DocumentId documentId, bool activate=true);
}
}
```
- Workspace's method names were a bit misleading. A bunch of methods which were simply named with action verbs like `AddDocument` led people to believe those methods would take the action. However those methods are actually called by `ApplyChanges` and that's where an extender would implement the logic to add the document. So all such methods got an "Apply" prefix:
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis {
public abstract class Workspace : IDisposable {
- protected virtual void AddAdditionalDocument(DocumentInfo info, SourceText text);
- protected virtual void AddAnalyzerReference(ProjectId projectId, AnalyzerReference analyzerReference);
- protected virtual void AddDocument(DocumentInfo info, SourceText text);
- protected virtual void AddMetadataReference(ProjectId projectId, MetadataReference metadataReference);
- protected virtual void AddProjectReference(ProjectId projectId, ProjectReference projectReference);
+ protected virtual void ApplyAdditionalDocumentAdded(DocumentInfo info, SourceText text);
+ protected virtual void ApplyAdditionalDocumentRemoved(DocumentId documentId);
+ protected virtual void ApplyAdditionalDocumentTextChanged(DocumentId id, SourceText text);
+ protected virtual void ApplyAnalyzerReferenceAdded(ProjectId projectId, AnalyzerReference analyzerReference);
+ protected virtual void ApplyAnalyzerReferenceRemoved(ProjectId projectId, AnalyzerReference analyzerReference);
+ protected virtual void ApplyCompilationOptionsChanged(ProjectId projectId, CompilationOptions options);
+ protected virtual void ApplyDocumentAdded(DocumentInfo info, SourceText text);
+ protected virtual void ApplyDocumentRemoved(DocumentId documentId);
+ protected virtual void ApplyDocumentTextChanged(DocumentId id, SourceText text);
+ protected virtual void ApplyMetadataReferenceAdded(ProjectId projectId, MetadataReference metadataReference);
+ protected virtual void ApplyMetadataReferenceRemoved(ProjectId projectId, MetadataReference metadataReference);
+ protected virtual void ApplyParseOptionsChanged(ProjectId projectId, ParseOptions options);
+ protected virtual void ApplyProjectAdded(ProjectInfo project);
+ protected virtual void ApplyProjectReferenceAdded(ProjectId projectId, ProjectReference projectReference);
+ protected virtual void ApplyProjectReferenceRemoved(ProjectId projectId, ProjectReference projectReference);
+ protected virtual void ApplyProjectRemoved(ProjectId projectId);
- protected virtual void ChangedAdditionalDocumentText(DocumentId id, SourceText text);
- protected virtual void ChangedDocumentText(DocumentId id, SourceText text);
+ protected void CheckCanOpenDocuments();
- protected virtual void RemoveAdditionalDocument(DocumentId documentId);
- protected virtual void RemoveAnalyzerReference(ProjectId projectId, AnalyzerReference analyzerReference);
- protected virtual void RemoveDocument(DocumentId documentId);
- protected virtual void RemoveMetadataReference(ProjectId projectId, MetadataReference metadataReference);
- protected virtual void RemoveProjectReference(ProjectId projectId, ProjectReference projectReference);
}
}
}
```
- Some more cleanup where APIs were either missing a parameter or had a parameter that wasn't doing what users expected
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis {
public sealed class DocumentInfo {
+ public static DocumentInfo Create(DocumentId id, string name, IEnumerable<string> folders=null, SourceCodeKind sourceCodeKind=(SourceCodeKind)(0), TextLoader loader=null, string filePath=null, bool isGenerated=false);
- public static DocumentInfo Create(DocumentId id, string name, IEnumerable<string> folders=null, SourceCodeKind sourceCodeKind=(SourceCodeKind)(0), TextLoader loader=null, string filePath=null, Encoding defaultEncoding=null, bool isGenerated=false);
- public DocumentInfo WithDefaultEncoding(Encoding encoding);
}
public class Project {
- public TextDocument AddAdditionalDocument(string name, SourceText text, IEnumerable<string> folders=null);
+ public TextDocument AddAdditionalDocument(string name, SourceText text, IEnumerable<string> folders=null, string filePath=null);
- public TextDocument AddAdditionalDocument(string name, string text, IEnumerable<string> folders=null);
+ public TextDocument AddAdditionalDocument(string name, string text, IEnumerable<string> folders=null, string filePath=null);
- public Document AddDocument(string name, SyntaxNode syntaxRoot, IEnumerable<string> folders=null);
+ public Document AddDocument(string name, SyntaxNode syntaxRoot, IEnumerable<string> folders=null, string filePath=null);
- public Document AddDocument(string name, SourceText text, IEnumerable<string> folders=null);
+ public Document AddDocument(string name, SourceText text, IEnumerable<string> folders=null, string filePath=null);
- public Document AddDocument(string name, string text, IEnumerable<string> folders=null);
+ public Document AddDocument(string name, string text, IEnumerable<string> folders=null, string filePath=null);
}
}
}
```
##Changes resulting from language features
- **C#**
- Most of the changes were from changes to String Interpolation.
- CSharpKind() has been renamed to Kind().
```diff
assembly Microsoft.CodeAnalysis.CSharp {
namespace Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
public static class CSharpExtensions {
- public static SyntaxKind CSharpContextualKind(this SyntaxToken token);
- public static SyntaxKind CSharpKind(this SyntaxNode node);
- public static SyntaxKind CSharpKind(this SyntaxNodeOrToken nodeOrToken);
- public static SyntaxKind CSharpKind(this SyntaxToken token);
- public static SyntaxKind CSharpKind(this SyntaxTrivia trivia);
- public static bool IsContextualKind(this SyntaxToken token, SyntaxKind kind);
}
}
namespace Microsoft.CodeAnalysis.CSharp {
public struct Conversion : IEquatable<Conversion> {
+ public bool IsInterpolatedString { get; }
}
public static class CSharpExtensions {
+ public static SyntaxKind Kind(this SyntaxNode node);
+ public static SyntaxKind Kind(this SyntaxNodeOrToken nodeOrToken);
+ public static SyntaxKind Kind(this SyntaxToken token);
+ public static SyntaxKind Kind(this SyntaxTrivia trivia);
}
public abstract class CSharpSyntaxNode : SyntaxNode {
- public SyntaxKind CSharpKind();
+ public SyntaxKind Kind();
}
public abstract class CSharpSyntaxRewriter : CSharpSyntaxVisitor<SyntaxNode> {
- public override SyntaxNode VisitInterpolatedString(InterpolatedStringSyntax node);
+ public override SyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
- public override SyntaxNode VisitInterpolatedStringInsert(InterpolatedStringInsertSyntax node);
+ public override SyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public override SyntaxNode VisitInterpolation(InterpolationSyntax node);
+ public override SyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public override SyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class CSharpSyntaxVisitor {
- public virtual void VisitInterpolatedString(InterpolatedStringSyntax node);
+ public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
- public virtual void VisitInterpolatedStringInsert(InterpolatedStringInsertSyntax node);
+ public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual void VisitInterpolation(InterpolationSyntax node);
+ public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class CSharpSyntaxVisitor<TResult> {
- public virtual TResult VisitInterpolatedString(InterpolatedStringSyntax node);
+ public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
- public virtual TResult VisitInterpolatedStringInsert(InterpolatedStringInsertSyntax node);
+ public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual TResult VisitInterpolation(InterpolationSyntax node);
+ public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public static class SyntaxFactory {
public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken ifKeywordwhenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken);
- public static InterpolatedStringSyntax InterpolatedString(SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts=null);
- public static InterpolatedStringSyntax InterpolatedString(SyntaxToken stringStart, SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts, SyntaxToken stringEnd);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxList<InterpolatedStringContentSyntax> contents);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken);
- public static InterpolatedStringInsertSyntax InterpolatedStringInsert(ExpressionSyntax expression);
- public static InterpolatedStringInsertSyntax InterpolatedStringInsert(ExpressionSyntax expression, SyntaxToken comma, ExpressionSyntax alignment, SyntaxToken format);
+ public static InterpolatedStringTextSyntax InterpolatedStringText();
+ public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause);
+ public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value);
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken);
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken);
}
public enum SyntaxKind : ushort {
- InterpolatedString = (ushort)8655,
InterpolatedStringEndToken = (ushort)85188483,
+ InterpolatedStringExpression = (ushort)8655,
- InterpolatedStringInsert = (ushort)8918,
- InterpolatedStringMidToken = (ushort)8517,
InterpolatedStringStartToken = (ushort)85168482,
+ InterpolatedStringText = (ushort)8919,
+ InterpolatedStringTextToken = (ushort)8517,
+ InterpolatedVerbatimStringStartToken = (ushort)8484,
+ Interpolation = (ushort)8918,
+ InterpolationAlignmentClause = (ushort)8920,
+ InterpolationFormatClause = (ushort)8921,
+ WhenKeyword = (ushort)8437,
}
}
namespace Microsoft.CodeAnalysis.CSharp.Syntax {
public sealed class CatchFilterClauseSyntax : CSharpSyntaxNode {
- public SyntaxToken IfKeyword { get; }
+ public SyntaxToken WhenKeyword { get; }
public CatchFilterClauseSyntax Update(SyntaxToken ifKeywordwhenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken);
- public CatchFilterClauseSyntax WithIfKeyword(SyntaxToken ifKeyword);
+ public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword);
}
+ public abstract class InterpolatedStringContentSyntax : CSharpSyntaxNode {
}
+ public sealed class InterpolatedStringExpressionSyntax : ExpressionSyntax {
+ public SyntaxList<InterpolatedStringContentSyntax> Contents { get; }
+ public SyntaxToken StringEndToken { get; }
+ public SyntaxToken StringStartToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items);
+ public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken);
+ public InterpolatedStringExpressionSyntax WithContents(SyntaxList<InterpolatedStringContentSyntax> contents);
+ public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken);
+ public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken);
}
- public sealed class InterpolatedStringInsertSyntax : CSharpSyntaxNode {
- public ExpressionSyntax Alignment { get; }
- public SyntaxToken Comma { get; }
- public ExpressionSyntax Expression { get; }
- public SyntaxToken Format { get; }
- public override void Accept(CSharpSyntaxVisitor visitor);
- public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
- public InterpolatedStringInsertSyntax Update(ExpressionSyntax expression, SyntaxToken comma, ExpressionSyntax alignment, SyntaxToken format);
- public InterpolatedStringInsertSyntax WithAlignment(ExpressionSyntax alignment);
- public InterpolatedStringInsertSyntax WithComma(SyntaxToken comma);
- public InterpolatedStringInsertSyntax WithExpression(ExpressionSyntax expression);
- public InterpolatedStringInsertSyntax WithFormat(SyntaxToken format);
}
- public sealed class InterpolatedStringSyntax : ExpressionSyntax {
- public SeparatedSyntaxList<InterpolatedStringInsertSyntax> InterpolatedInserts { get; }
- public SyntaxToken StringEnd { get; }
- public SyntaxToken StringStart { get; }
- public override void Accept(CSharpSyntaxVisitor visitor);
- public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
- public InterpolatedStringSyntax AddInterpolatedInserts(params InterpolatedStringInsertSyntax[] items);
- public InterpolatedStringSyntax Update(SyntaxToken stringStart, SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts, SyntaxToken stringEnd);
- public InterpolatedStringSyntax WithInterpolatedInserts(SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts);
- public InterpolatedStringSyntax WithStringEnd(SyntaxToken stringEnd);
- public InterpolatedStringSyntax WithStringStart(SyntaxToken stringStart);
}
+ public sealed class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax {
+ public SyntaxToken TextToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringTextSyntax Update(SyntaxToken textToken);
+ public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken);
}
+ public sealed class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode {
+ public SyntaxToken CommaToken { get; }
+ public ExpressionSyntax Value { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value);
+ public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken);
+ public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value);
}
+ public sealed class InterpolationFormatClauseSyntax : CSharpSyntaxNode {
+ public SyntaxToken ColonToken { get; }
+ public SyntaxToken FormatStringToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken);
+ public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken);
+ public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken);
}
+ public sealed class InterpolationSyntax : InterpolatedStringContentSyntax {
+ public InterpolationAlignmentClauseSyntax AlignmentClause { get; }
+ public SyntaxToken CloseBraceToken { get; }
+ public ExpressionSyntax Expression { get; }
+ public InterpolationFormatClauseSyntax FormatClause { get; }
+ public SyntaxToken OpenBraceToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax alignmentClause);
+ public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithExpression(ExpressionSyntax expression);
+ public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax formatClause);
+ public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken);
}
}
}
```
- **VB**
- String Interpolation work resulted in a bunch of new syntax APIs.
- VBKind() has been renamed to Kind()
- Syntax nodes for block declarations (e.g. ClassBlockSyntax, ConstructorBlockSyntax) have been changed to have block specific child names (e.g. SubNewStatement, EndSubStatement) instead of generic ones (e.g. Begin/End). This was done to make these members consistent with the rest of the API.
- Syntax nodes for various statements (e.g. MethodStatementSyntax) have been changed to have statement specific child names (e.g. SubOrFunctionKeyword) instead of generic ones (e.g. Keyword). This was done to make these members consistent with the rest of the API.
```diff
assembly Microsoft.CodeAnalysis.VisualBasic {
namespace Microsoft.CodeAnalysis {
public sealed class VisualBasicExtensions {
- public static bool IsContextualKind(this SyntaxToken token, SyntaxKind kind);
- public static SyntaxKind VBKind(this SyntaxNode node);
- public static SyntaxKind VBKind(this SyntaxNodeOrToken nodeOrToken);
- public static SyntaxKind VBKind(this SyntaxToken token);
- public static SyntaxKind VBKind(this SyntaxTrivia trivia);
- public static SyntaxKind VisualBasicContextualKind(this SyntaxToken token);
}
}
namespace Microsoft.CodeAnalysis.VisualBasic {
public class SyntaxFactory {
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxList<InterpolatedStringContentSyntax> contents);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken dollarSignDoubleQuoteToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken doubleQuoteToken);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(params InterpolatedStringContentSyntax[] contents);
+ public static InterpolatedStringTextSyntax InterpolatedStringText();
+ public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken);
+ public static SyntaxToken InterpolatedStringTextToken(SyntaxTriviaList leadingTrivia, string text, string value, SyntaxTriviaList trailingTrivia);
+ public static SyntaxToken InterpolatedStringTextToken(string text, string value);
+ public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause);
+ public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value);
+ public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(ExpressionSyntax value);
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause();
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken);
}
public class SyntaxFacts {
+ public static bool IsAccessorStatementAccessorKeyword(SyntaxKind kind);
+ public static bool IsDeclareStatementSubOrFunctionKeyword(SyntaxKind kind);
+ public static bool IsDelegateStatementSubOrFunctionKeyword(SyntaxKind kind);
+ public static bool IsLambdaHeaderSubOrFunctionKeyword(SyntaxKind kind);
+ public static bool IsMethodStatementSubOrFunctionKeyword(SyntaxKind kind);
}
public enum SyntaxKind : ushort {
+ DollarSignDoubleQuoteToken = (ushort)785,
+ EndOfInterpolatedStringToken = (ushort)787,
+ InterpolatedStringExpression = (ushort)780,
+ InterpolatedStringText = (ushort)781,
+ InterpolatedStringTextToken = (ushort)786,
+ Interpolation = (ushort)782,
+ InterpolationAlignmentClause = (ushort)783,
+ InterpolationFormatClause = (ushort)784,
}
public sealed class VisualBasicExtensions {
+ public static SyntaxKind Kind(this SyntaxNode node);
+ public static SyntaxKind Kind(this SyntaxNodeOrToken nodeOrToken);
+ public static SyntaxKind Kind(this SyntaxToken token);
+ public static SyntaxKind Kind(this SyntaxTrivia trivia);
}
public abstract class VisualBasicSyntaxNode : SyntaxNode {
+ public SyntaxKind Kind();
- public SyntaxKind VBKind();
}
public abstract class VisualBasicSyntaxRewriter : VisualBasicSyntaxVisitor<SyntaxNode> {
+ public override SyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
+ public override SyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public override SyntaxNode VisitInterpolation(InterpolationSyntax node);
+ public override SyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public override SyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class VisualBasicSyntaxVisitor {
+ public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
+ public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual void VisitInterpolation(InterpolationSyntax node);
+ public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class VisualBasicSyntaxVisitor<TResult> {
+ public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
+ public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual TResult VisitInterpolation(InterpolationSyntax node);
+ public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
}
namespace Microsoft.CodeAnalysis.VisualBasic.Syntax {
public sealed class AccessorBlockSyntax : MethodBlockBaseSyntax {
+ public AccessorStatementSyntax AccessorStatement { get; }
+ public override MethodBaseSyntax BlockStatement { get; }
+ public EndBlockStatementSyntax EndAccessorStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public AccessorBlockSyntax WithAccessorStatement(AccessorStatementSyntax accessorStatement);
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public AccessorBlockSyntax WithEndAccessorStatement(EndBlockStatementSyntax endAccessorStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
}
public sealed class AccessorStatementSyntax : MethodBaseSyntax {
+ public SyntaxToken AccessorKeyword { get; }
+ public override SyntaxToken DeclarationKeyword { get; }
+ public AccessorStatementSyntax WithAccessorKeyword(SyntaxToken accessorKeyword);
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
}
public sealed class CaseBlockSyntax : VisualBasicSyntaxNode {
+ public CaseStatementSyntax CaseStatement { get; }
+ public CaseBlockSyntax AddCaseStatementCases(params CaseClauseSyntax[] items);
+ public CaseBlockSyntax WithCaseStatement(CaseStatementSyntax caseStatement);
}
public sealed class ClassBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public ClassStatementSyntax ClassStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndClassStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public ClassBlockSyntax WithClassStatement(ClassStatementSyntax classStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public ClassBlockSyntax WithEndClassStatement(EndBlockStatementSyntax endClassStatement);
}
public sealed class ClassStatementSyntax : TypeStatementSyntax {
+ public SyntaxToken ClassKeyword { get; }
+ public override SyntaxToken DeclarationKeyword { get; }
+ public ClassStatementSyntax WithClassKeyword(SyntaxToken classKeyword);
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
}
public sealed class ConstructorBlockSyntax : MethodBlockBaseSyntax {
+ public override MethodBaseSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndSubStatement { get; }
+ public SubNewStatementSyntax SubNewStatement { get; }
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public ConstructorBlockSyntax WithEndSubStatement(EndBlockStatementSyntax endSubStatement);
+ public ConstructorBlockSyntax WithSubNewStatement(SubNewStatementSyntax subNewStatement);
}
public sealed class CrefOperatorReferenceSyntax : NameSyntax {
+ public SyntaxToken OperatorKeyword { get; }
+ public CrefOperatorReferenceSyntax WithOperatorKeyword(SyntaxToken operatorKeyword);
}
public sealed class DeclareStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public DeclareStatementSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public sealed class DelegateStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public DelegateStatementSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public sealed class EventStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken EventKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public EventStatementSyntax WithEventKeyword(SyntaxToken eventKeyword);
}
public sealed class InterfaceBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndInterfaceStatement { get; }
+ public InterfaceStatementSyntax InterfaceStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public InterfaceBlockSyntax WithEndInterfaceStatement(EndBlockStatementSyntax endInterfaceStatement);
+ public InterfaceBlockSyntax WithInterfaceStatement(InterfaceStatementSyntax interfaceStatement);
}
public sealed class InterfaceStatementSyntax : TypeStatementSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken InterfaceKeyword { get; }
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public InterfaceStatementSyntax WithInterfaceKeyword(SyntaxToken interfaceKeyword);
}
+ public abstract class InterpolatedStringContentSyntax : VisualBasicSyntaxNode {
}
+ public sealed class InterpolatedStringExpressionSyntax : ExpressionSyntax {
+ public SyntaxList<InterpolatedStringContentSyntax> Contents { get; }
+ public SyntaxToken DollarSignDoubleQuoteToken { get; }
+ public SyntaxToken DoubleQuoteToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items);
+ public InterpolatedStringExpressionSyntax Update(SyntaxToken dollarSignDoubleQuoteToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken doubleQuoteToken);
+ public InterpolatedStringExpressionSyntax WithContents(SyntaxList<InterpolatedStringContentSyntax> contents);
+ public InterpolatedStringExpressionSyntax WithDollarSignDoubleQuoteToken(SyntaxToken dollarSignDoubleQuoteToken);
+ public InterpolatedStringExpressionSyntax WithDoubleQuoteToken(SyntaxToken doubleQuoteToken);
}
+ public sealed class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax {
+ public SyntaxToken TextToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringTextSyntax Update(SyntaxToken textToken);
+ public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken);
}
+ public sealed class InterpolationAlignmentClauseSyntax : VisualBasicSyntaxNode {
+ public SyntaxToken CommaToken { get; }
+ public ExpressionSyntax Value { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value);
+ public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken);
+ public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value);
}
+ public sealed class InterpolationFormatClauseSyntax : VisualBasicSyntaxNode {
+ public SyntaxToken ColonToken { get; }
+ public SyntaxToken FormatStringToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken);
+ public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken);
+ public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken);
}
+ public sealed class InterpolationSyntax : InterpolatedStringContentSyntax {
+ public InterpolationAlignmentClauseSyntax AlignmentClause { get; }
+ public SyntaxToken CloseBraceToken { get; }
+ public ExpressionSyntax Expression { get; }
+ public InterpolationFormatClauseSyntax FormatClause { get; }
+ public SyntaxToken OpenBraceToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax alignmentClause);
+ public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithExpression(ExpressionSyntax expression);
+ public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax formatClause);
+ public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken);
}
public abstract class LambdaExpressionSyntax : ExpressionSyntax {
+ public LambdaHeaderSyntax SubOrFunctionHeader { get; }
}
public sealed class LambdaHeaderSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public LambdaHeaderSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public abstract class MethodBaseSyntax : DeclarationStatementSyntax {
+ public abstract SyntaxToken DeclarationKeyword { get; }
+ public abstract MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public MethodBaseSyntax WithKeyword(SyntaxToken keyword);
}
public abstract class MethodBlockBaseSyntax : DeclarationStatementSyntax {
+ public abstract MethodBaseSyntax BlockStatement { get; }
+ public abstract EndBlockStatementSyntax EndBlockStatement { get; }
+ public MethodBlockBaseSyntax WithBegin(MethodBaseSyntax begin);
+ public abstract MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public MethodBlockBaseSyntax WithEnd(EndBlockStatementSyntax end);
+ public abstract MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
}
public sealed class MethodBlockSyntax : MethodBlockBaseSyntax {
+ public override MethodBaseSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndSubOrFunctionStatement { get; }
+ public MethodStatementSyntax SubOrFunctionStatement { get; }
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public MethodBlockSyntax WithEndSubOrFunctionStatement(EndBlockStatementSyntax endSubOrFunctionStatement);
+ public MethodBlockSyntax WithSubOrFunctionStatement(MethodStatementSyntax subOrFunctionStatement);
}
public sealed class MethodStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public MethodStatementSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public sealed class ModuleBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndModuleStatement { get; }
+ public ModuleStatementSyntax ModuleStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public ModuleBlockSyntax WithEndModuleStatement(EndBlockStatementSyntax endModuleStatement);
+ public ModuleBlockSyntax WithModuleStatement(ModuleStatementSyntax moduleStatement);
}
public sealed class ModuleStatementSyntax : TypeStatementSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken ModuleKeyword { get; }
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public ModuleStatementSyntax WithModuleKeyword(SyntaxToken moduleKeyword);
}
public sealed class MultiLineLambdaExpressionSyntax : LambdaExpressionSyntax {
+ public EndBlockStatementSyntax EndSubOrFunctionStatement { get; }
+ public new LambdaHeaderSyntax SubOrFunctionHeader { get; }
+ public MultiLineLambdaExpressionSyntax WithEndSubOrFunctionStatement(EndBlockStatementSyntax endSubOrFunctionStatement);
+ public MultiLineLambdaExpressionSyntax WithSubOrFunctionHeader(LambdaHeaderSyntax subOrFunctionHeader);
}
public sealed class OperatorBlockSyntax : MethodBlockBaseSyntax {
+ public override MethodBaseSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndOperatorStatement { get; }
+ public OperatorStatementSyntax OperatorStatement { get; }
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public OperatorBlockSyntax WithEndOperatorStatement(EndBlockStatementSyntax endOperatorStatement);
+ public OperatorBlockSyntax WithOperatorStatement(OperatorStatementSyntax operatorStatement);
}
public sealed class OperatorStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken OperatorKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public OperatorStatementSyntax WithOperatorKeyword(SyntaxToken operatorKeyword);
}
public sealed class PropertyStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken PropertyKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public PropertyStatementSyntax WithPropertyKeyword(SyntaxToken propertyKeyword);
}
public sealed class SingleLineLambdaExpressionSyntax : LambdaExpressionSyntax {
+ public new LambdaHeaderSyntax SubOrFunctionHeader { get; }
public SingleLineLambdaExpressionSyntax Update(SyntaxKind kind, LambdaHeaderSyntax beginsubOrFunctionHeader, VisualBasicSyntaxNode body);
+ public SingleLineLambdaExpressionSyntax WithSubOrFunctionHeader(LambdaHeaderSyntax subOrFunctionHeader);
}
public sealed class StructureBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndStructureStatement { get; }
+ public StructureStatementSyntax StructureStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public StructureBlockSyntax WithEndStructureStatement(EndBlockStatementSyntax endStructureStatement);
+ public StructureBlockSyntax WithStructureStatement(StructureStatementSyntax structureStatement);
}
public sealed class StructureStatementSyntax : TypeStatementSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken StructureKeyword { get; }
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public StructureStatementSyntax WithStructureKeyword(SyntaxToken structureKeyword);
}
public sealed class SubNewStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public SubNewStatementSyntax WithSubKeyword(SyntaxToken subKeyword);
}
public abstract class TypeBlockSyntax : DeclarationStatementSyntax {
+ public abstract TypeStatementSyntax BlockStatement { get; }
+ public abstract EndBlockStatementSyntax EndBlockStatement { get; }
+ public TypeBlockSyntax WithBegin(TypeStatementSyntax begin);
+ public abstract TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public TypeBlockSyntax WithEnd(EndBlockStatementSyntax end);
+ public abstract TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
}
public abstract class TypeStatementSyntax : DeclarationStatementSyntax {
+ public abstract SyntaxToken DeclarationKeyword { get; }
+ public abstract TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public TypeStatementSyntax WithKeyword(SyntaxToken keyword);
}
}
}
```
## Miscellaneous
APIs that weren't meant to be public or that were already deprecated have been removed.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
- public enum CommonMemberResolutionKind {
- Applicable = 0,
- TypeInferenceFailed = 2,
- UseSiteError = 1,
- Worse = 3,
}
public struct CommonMemberResolutionResult<TMember> where TMember : ISymbol {
- public bool IsValid { get; }
- public TMember Member { get; }
- public CommonMemberResolutionKind Resolution { get; }
}
public struct CommonOverloadResolutionResult<TMember> where TMember : ISymbol {
- public Nullable<CommonMemberResolutionResult<TMember>> BestResult { get; }
- public ImmutableArray<CommonMemberResolutionResult<TMember>> Results { get; }
- public bool Succeeded { get; }
- public Nullable<CommonMemberResolutionResult<TMember>> ValidResult { get; }
}
- public static class ImmutableArrayExtensions {
- public static void AddRange<T, U>(this List<T> list, ImmutableArray<U> items) where U : T;
- public static ImmutableArray<T> AsImmutable<T>(this IEnumerable<T> items);
- public static ImmutableArray<T> AsImmutable<T>(this T[] items);
- public static ImmutableArray<T> AsImmutableOrEmpty<T>(this IEnumerable<T> items);
- public static ImmutableArray<T> AsImmutableOrEmpty<T>(this T[] items);
- public static ImmutableArray<T> AsImmutableOrNull<T>(this IEnumerable<T> items);
- public static ImmutableArray<T> AsImmutableOrNull<T>(this T[] items);
- [MethodImpl(AggressiveInlining)]public static ImmutableArray<TBase> Cast<TDerived, TBase>(this ImmutableArray<TDerived> items) where TDerived : class, TBase;
- public static ImmutableArray<T> Distinct<T>(this ImmutableArray<T> array, IEqualityComparer<T> comparer=null);
- public static ImmutableArray<T> NullToEmpty<T>(this ImmutableArray<T> array);
- public static ImmutableArray<TResult> SelectAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> items, Func<TItem, int, TArg, TResult> map, TArg arg);
- public static ImmutableArray<TResult> SelectAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> items, Func<TItem, TArg, TResult> map, TArg arg);
- public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map);
- public static bool SetEquals<T>(this ImmutableArray<T> array1, ImmutableArray<T> array2, IEqualityComparer<T> comparer);
- public static ImmutableArray<byte> ToImmutable(this MemoryStream stream);
- public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate);
}
public enum TypeKind : byte {
- ArrayType = (byte)1,
- DynamicType = (byte)4,
- PointerType = (byte)9,
}
}
assembly Microsoft.CodeAnalysis.Workspaces.Desktop {
namespace Microsoft.CodeAnalysis.Host.Mef {
public class MefV1HostServices : HostServices {
- public static MefV1HostServices DefaultHost { get; }
}
}
}
``` | #API changes between VS 2015 CTP5 and VS 2015 CTP6
##Diagnostics and CodeFix API Changes
- DiagnosticAnalyzerAttribute's parameterless constructor has been removed. When no language was passed in, we were treating that to mean the analyzer works for any language which is not a guarantee anyone can make.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis.Diagnostics {
public sealed class DiagnosticAnalyzerAttribute : Attribute {
- public DiagnosticAnalyzerAttribute();
- public DiagnosticAnalyzerAttribute(string supportedLanguage);
+ public DiagnosticAnalyzerAttribute(string firstLanguage, params string[] additionalLanguages);
+ public string[] Languages { get; }
- public string SupportedLanguage { get; }
}
}
}
```
- The CodeFixes\CodeRefactoring APIs were cleaned up for consistency. `CodeAction.Create`'s overloads which took Document\Solution were removed because they lead to poor performance in the lightbulb.
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis.CodeActions {
public abstract class CodeAction {
+ public virtual string EquivalenceKey { get; }
- public virtual string Id { get; }
- public static CodeAction Create(string description, Document changedDocument, string id=null);
- public static CodeAction Create(string description, Solution changedSolution, string id=null);
public static CodeAction Create(string descriptiontitle, Func<CancellationToken, Task<Document>> createChangedDocument, string idequivalenceKey=null);
public static CodeAction Create(string descriptiontitle, Func<CancellationToken, Task<Solution>> createChangedSolution, string idequivalenceKey=null);
- public Task<IEnumerable<CodeActionOperation>> GetOperationsAsync(CancellationToken cancellationToken);
+ public Task<ImmutableArray<CodeActionOperation>> GetOperationsAsync(CancellationToken cancellationToken);
- public Task<IEnumerable<CodeActionOperation>> GetPreviewOperationsAsync(CancellationToken cancellationToken);
+ public Task<ImmutableArray<CodeActionOperation>> GetPreviewOperationsAsync(CancellationToken cancellationToken);
- protected Task<IEnumerable<CodeActionOperation>> PostProcessAsync(IEnumerable<CodeActionOperation> operations, CancellationToken cancellationToken);
+ protected Task<ImmutableArray<CodeActionOperation>> PostProcessAsync(IEnumerable<CodeActionOperation> operations, CancellationToken cancellationToken);
}
public abstract class CodeActionWithOptions : CodeAction {
+ protected override Task<IEnumerable<CodeActionOperation>> ComputeOperationsAsync(CancellationToken cancellationToken);
}
}
namespace Microsoft.CodeAnalysis.CodeFixes {
public struct CodeFixContext {
public CodeFixContext(Document document, Diagnostic diagnostic, Action<CodeAction, ImmutableArray<Diagnostic>> registerFixregisterCodeFix, CancellationToken cancellationToken);
public CodeFixContext(Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, Action<CodeAction, ImmutableArray<Diagnostic>> registerFixregisterCodeFix, CancellationToken cancellationToken);
+ public void RegisterCodeFix(CodeAction action, Diagnostic diagnostic);
+ public void RegisterCodeFix(CodeAction action, IEnumerable<Diagnostic> diagnostics);
+ public void RegisterCodeFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics);
- public void RegisterFix(CodeAction action, Diagnostic diagnostic);
- public void RegisterFix(CodeAction action, IEnumerable<Diagnostic> diagnostics);
- public void RegisterFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics);
}
public abstract class CodeFixProvider {
+ public abstract ImmutableArray<string> FixableDiagnosticIds { get; }
- public abstract Task ComputeFixesAsync(CodeFixContext context);
- public abstract ImmutableArray<string> GetFixableDiagnosticIds();
+ public abstract Task RegisterCodeFixesAsync(CodeFixContext context);
}
public sealed class ExportCodeFixProviderAttribute : ExportAttribute {
public ExportCodeFixProviderAttribute(string namefirstLanguage, params string[] languagesadditionalLanguages);
- public ExportCodeFixProviderAttribute(params string[] languages);
public string Name { get; set; }
}
public class FixAllContext {
+ public string CodeActionEquivalenceKey { get; }
- public string CodeActionId { get; }
+ public Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync(Project project);
- public Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync(Document document);
- public Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync(Project project);
+ public Task<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document);
+ public Task<ImmutableArray<Diagnostic>> GetProjectDiagnosticsAsync(Project project);
}
namespace Microsoft.CodeAnalysis.CodeRefactorings {
public sealed class ExportCodeRefactoringProviderAttribute : ExportAttribute {
- public ExportCodeRefactoringProviderAttribute(string name, string language);
+ public ExportCodeRefactoringProviderAttribute(string firstLanguage, params string[] additionalLanguages);
- public string Language { get; }
+ public string[] Languages { get; }
public string Name { get; set; }
}
}
}
```
- Additional documents are represented as `SourceText` instead of streams in the API now as only text files were being handed out as additional documents anyway. AnalyzerOptions has been cleaned up to only have properties which are supported. Also `DiagnosticDescriptor`'s HelpLink was renamed to make it clearer.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
- public abstract class AdditionalStream {
- protected AdditionalStream();
- public abstract string Path { get; }
- public abstract Stream OpenRead(CancellationToken cancellationToken=null);
}
+ public abstract class AdditionalText {
+ protected AdditionalText();
+ public abstract string Path { get; }
+ public abstract SourceText GetText(CancellationToken cancellationToken=null);
}
public class AnalyzerOptions {
- public AnalyzerOptions(ImmutableArray<AdditionalStream> additionalStreams, ImmutableDictionary<string, string> globalOptions, CultureInfo culture=null);
+ public AnalyzerOptions(ImmutableArray<AdditionalText> additionalFiles);
+ public ImmutableArray<AdditionalText> AdditionalFiles { get; }
- public ImmutableArray<AdditionalStream> AdditionalStreams { get; }
- public CultureInfo Culture { get; }
- public ImmutableDictionary<string, string> GlobalOptions { get; }
+ public AnalyzerOptions WithAdditionalFiles(ImmutableArray<AdditionalText> additionalFiles);
- public AnalyzerOptions WithAdditionalStreams(ImmutableArray<AdditionalStream> additionalStreams);
- public AnalyzerOptions WithCulture(CultureInfo culture);
- public AnalyzerOptions WithGlobalOptions(ImmutableDictionary<string, string> globalOptions);
}
public class DiagnosticDescriptor : IEquatable<DiagnosticDescriptor> {
- public string HelpLink { get; }
+ public string HelpLinkUri { get; }
+ public bool Equals(DiagnosticDescriptor other);
}
```
- `AnalyzerDriver` is the type that hosts used to run analyzers and produce diagnostics. However this API leaked a bunch of implementation details and was confusing. The entire type and its friends are all internal now and instead new type called `CompilationWithAnalyzers` has been added for hosts to compute diagnostics from analyzers. As part of this change `SemanticModel.GetDeclarationsInSpan` was removed as well as that method wasn't complete and was very specific to what the AnalyzerDriver needed.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis.Diagnostics {
+ public class CompilationWithAnalyzers {
+ public CompilationWithAnalyzers(Compilation compilation, ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerOptions options, CancellationToken cancellationToken);
+ public Compilation Compilation { get; }
+ public Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync();
+ public Task<ImmutableArray<Diagnostic>> GetAnalyzerDiagnosticsAsync();
+ public static IEnumerable<Diagnostic> GetEffectiveDiagnostics(IEnumerable<Diagnostic> diagnostics, Compilation compilation);
+ public static bool IsDiagnosticAnalyzerSuppressed(DiagnosticAnalyzer analyzer, CompilationOptions options, Func<Exception, DiagnosticAnalyzer, bool> continueOnAnalyzerException);
}
+ public static class DiagnosticAnalyzerExtensions {
+ public static CompilationWithAnalyzers WithAnalyzers(this Compilation compilation, ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerOptions options=null, CancellationToken cancellationToken=null);
}
- public sealed class AnalyzerActions { ... }
- public abstract class AnalyzerDriver : IDisposable { ... }
- public class AnalyzerDriver<TLanguageKindEnum> : AnalyzerDriver { ... }
- public sealed class AsyncQueue<TElement> { ... }
- public abstract class CompilationEvent { ... }
- public sealed class CompilationCompletedEvent : CompilationEvent { ... }
- public sealed class CompilationStartedEvent : CompilationEvent { ... }
- public sealed class CompilationUnitCompletedEvent : CompilationEvent { ... }
- public sealed class SymbolDeclaredCompilationEvent : CompilationEvent { ... }
}
namespace Microsoft.CodeAnalysis {
public abstract class Compilation {
- public abstract Compilation WithEventQueue(AsyncQueue<CompilationEvent> eventQueue);
}
public struct DeclarationInfo {
- public SyntaxNode DeclaredNode { get; }
- public ISymbol DeclaredSymbol { get; }
- public ImmutableArray<SyntaxNode> ExecutableCodeBlocks { get; }
}
public abstract class SemanticModel {
- protected internal abstract ImmutableArray<DeclarationInfo> GetDeclarationsInNode(SyntaxNode node, bool getSymbol, CancellationToken cancellationToken, Nullable<int> levelsToCompute=null);
- public abstract ImmutableArray<DeclarationInfo> GetDeclarationsInSpan(TextSpan span, bool getSymbol, CancellationToken cancellationToken);
}
}
```
- Context objects got public constructors so that they can be unit tested. `RegisterCodeBlockEndAction` became non-generic since the generic parameter wasn't being used.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis.Diagnostics {
public abstract class AnalysisContext {
+ protected AnalysisContext();
+ public abstract void RegisterCodeBlockEndAction(Action<CodeBlockEndAnalysisContext> action);
- public void RegisterCodeBlockEndAction<TLanguageKindEnum>(Action<CodeBlockEndAnalysisContext> action) where TLanguageKindEnum : struct, ValueType;
}
public struct CodeBlockEndAnalysisContext {
+ public CodeBlockEndAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public abstract class CodeBlockStartAnalysisContext<TLanguageKindEnum> where TLanguageKindEnum : struct, ValueType {
+ protected CodeBlockStartAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, CancellationToken cancellationToken);
}
public struct CompilationEndAnalysisContext {
+ public CompilationEndAnalysisContext(Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public abstract class CompilationStartAnalysisContext {
+ protected CompilationStartAnalysisContext(Compilation compilation, AnalyzerOptions options, CancellationToken cancellationToken);
+ public abstract void RegisterCodeBlockEndAction(Action<CodeBlockEndAnalysisContext> action);
- public void RegisterCodeBlockEndAction<TLanguageKindEnum>(Action<CodeBlockEndAnalysisContext> action) where TLanguageKindEnum : struct, ValueType;
}
public struct SemanticModelAnalysisContext {
+ public SemanticModelAnalysisContext(SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public struct SymbolAnalysisContext {
+ public SymbolAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public struct SyntaxNodeAnalysisContext {
+ public SyntaxNodeAnalysisContext(SyntaxNode node, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
public struct SyntaxTreeAnalysisContext {
+ public SyntaxTreeAnalysisContext(SyntaxTree tree, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken);
}
}
}
```
- **Code Editing**: CTP5 introduced a `SyntaxGenerator` type which made it easy to generate code in fixes or refactorings in a language independent manner. More functionality has been added to that type. Also, all types related to editing code were moved into a new namespace and types like `SyntaxEditor`, `DocumentEditor` and `SolutionEditor` have been introduced to enable writing language independent (between C#\VB) codeactions.
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
- namespace Microsoft.CodeAnalysis.CodeGeneration {
+ namespace Microsoft.CodeAnalysis.Editing {
+ public class DocumentEditor : SyntaxEditor {
+ public Document OriginalDocument { get; }
+ public SemanticModel SemanticModel { get; }
+ public static Task<DocumentEditor> CreateAsync(Document document, CancellationToken cancellationToken=null);
+ public Document GetChangedDocument();
}
+ public class SolutionEditor {
+ public SolutionEditor(Solution solution);
+ public Solution OriginalSolution { get; }
+ public Solution GetChangedSolution();
+ public Task<DocumentEditor> GetDocumentEditorAsync(DocumentId id, CancellationToken cancellationToken=null);
}
+ public sealed class SymbolEditor {
- public SymbolEditor(Document document);
- public SymbolEditor(Solution solution);
- public Solution CurrentSolution { get; }
+ public Solution ChangedSolution { get; }
+ public Solution OriginalSolution { get; }
+ public static SymbolEditor Create(Document document);
+ public static SymbolEditor Create(Solution solution);
- public Task<ISymbol> EditAllDeclarationsAsync(ISymbol symbol, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditAllDeclarationsAsync(ISymbol symbol, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditAllDeclarationsAsync(ISymbol symbol, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
- public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
- public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, ISymbol member, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, ISymbol member, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, ISymbol member, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
- public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Location location, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> declarationEditor, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Location location, SymbolEditor.AsyncDeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public Task<ISymbol> EditOneDeclarationAsync(ISymbol symbol, Location location, SymbolEditor.DeclarationEditAction editAction, CancellationToken cancellationToken=null);
+ public IEnumerable<Document> GetChangedDocuments();
+ public Task<IReadOnlyList<SyntaxNode>> GetCurrentDeclarationsAsync(ISymbol symbol, CancellationToken cancellationToken=null);
+ public Task<ISymbol> GetCurrentSymbolAsync(ISymbol symbol, CancellationToken cancellationToken=null);
+ public delegate Task AsyncDeclarationEditAction(DocumentEditor editor, SyntaxNode declaration, CancellationToken cancellationToken);
+ public delegate void DeclarationEditAction(DocumentEditor editor, SyntaxNode declaration);
}
+ public static class SymbolEditorExtensions {
+ public static Task<SyntaxNode> GetBaseOrInterfaceDeclarationReferenceAsync(this SymbolEditor editor, ISymbol symbol, ITypeSymbol baseOrInterfaceType, CancellationToken cancellationToken=null);
+ public static Task<ISymbol> SetBaseTypeAsync(this SymbolEditor editor, INamedTypeSymbol symbol, ITypeSymbol newBaseType, CancellationToken cancellationToken=null);
+ public static Task<ISymbol> SetBaseTypeAsync(this SymbolEditor editor, INamedTypeSymbol symbol, Func<SyntaxGenerator, SyntaxNode> getNewBaseType, CancellationToken cancellationToken=null);
}
+ public class SyntaxEditor {
+ public SyntaxEditor(SyntaxNode root, Workspace workspace);
+ public SyntaxGenerator Generator { get; }
+ public SyntaxNode OriginalRoot { get; }
+ public SyntaxNode GetChangedRoot();
+ public void InsertAfter(SyntaxNode node, SyntaxNode newNode);
+ public void InsertAfter(SyntaxNode node, IEnumerable<SyntaxNode> newNodes);
+ public void InsertBefore(SyntaxNode node, SyntaxNode newNode);
+ public void InsertBefore(SyntaxNode node, IEnumerable<SyntaxNode> newNodes);
+ public void RemoveNode(SyntaxNode node);
+ public void ReplaceNode(SyntaxNode node, SyntaxNode newNode);
+ public void ReplaceNode(SyntaxNode node, Func<SyntaxNode, SyntaxGenerator, SyntaxNode> computeReplacement);
+ public void TrackNode(SyntaxNode node);
}
+ public static class SyntaxEditorExtensions {
+ public static void AddAttribute(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode attribute);
+ public static void AddAttributeArgument(this SyntaxEditor editor, SyntaxNode attributeDeclaration, SyntaxNode attributeArgument);
+ public static void AddBaseType(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode baseType);
+ public static void AddInterfaceType(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode interfaceType);
+ public static void AddMember(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode member);
+ public static void AddParameter(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode parameter);
+ public static void AddReturnAttribute(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode attribute);
+ public static void InsertMembers(this SyntaxEditor editor, SyntaxNode declaration, int index, IEnumerable<SyntaxNode> members);
+ public static void SetAccessibility(this SyntaxEditor editor, SyntaxNode declaration, Accessibility accessibility);
+ public static void SetExpression(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode expression);
+ public static void SetGetAccessorStatements(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<SyntaxNode> statements);
+ public static void SetModifiers(this SyntaxEditor editor, SyntaxNode declaration, DeclarationModifiers modifiers);
+ public static void SetName(this SyntaxEditor editor, SyntaxNode declaration, string name);
+ public static void SetSetAccessorStatements(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<SyntaxNode> statements);
+ public static void SetStatements(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<SyntaxNode> statements);
+ public static void SetType(this SyntaxEditor editor, SyntaxNode declaration, SyntaxNode type);
+ public static void SetTypeConstraint(this SyntaxEditor editor, SyntaxNode declaration, string typeParameterName, SpecialTypeConstraintKind kind, IEnumerable<SyntaxNode> types);
+ public static void SetTypeParameters(this SyntaxEditor editor, SyntaxNode declaration, IEnumerable<string> typeParameters);
}
public abstract class SyntaxGenerator : ILanguageService {
+ public SyntaxNode AddAttributeArguments(SyntaxNode attributeDeclaration, IEnumerable<SyntaxNode> attributeArguments);
+ public abstract SyntaxNode AddBaseType(SyntaxNode declaration, SyntaxNode baseType);
+ public abstract SyntaxNode AddInterfaceType(SyntaxNode declaration, SyntaxNode interfaceType);
+ public abstract IReadOnlyList<SyntaxNode> GetAttributeArguments(SyntaxNode attributeDeclaration);
+ public abstract IReadOnlyList<SyntaxNode> GetBaseAndInterfaceTypes(SyntaxNode declaration);
+ public abstract SyntaxNode InsertAttributeArguments(SyntaxNode attributeDeclaration, int index, IEnumerable<SyntaxNode> attributeArguments);
+ public virtual SyntaxNode InsertNodesAfter(SyntaxNode root, SyntaxNode node, IEnumerable<SyntaxNode> newDeclarations);
+ public virtual SyntaxNode InsertNodesBefore(SyntaxNode root, SyntaxNode node, IEnumerable<SyntaxNode> newDeclarations);
- public abstract SyntaxNode RemoveAttributes(SyntaxNode declaration, IEnumerable<SyntaxNode> attributes);
- public SyntaxNode RemoveMembers(SyntaxNode declaration, params SyntaxNode[] members);
- public SyntaxNode RemoveMembers(SyntaxNode declaration, IEnumerable<SyntaxNode> members);
- public SyntaxNode RemoveNamespaceImports(SyntaxNode declaration, params SyntaxNode[] imports);
- public SyntaxNode RemoveNamespaceImports(SyntaxNode declaration, IEnumerable<SyntaxNode> imports);
- public SyntaxNode RemoveParameters(SyntaxNode declaration, IEnumerable<SyntaxNode> parameters);
- public abstract SyntaxNode RemoveReturnAttributes(SyntaxNode declaration, IEnumerable<SyntaxNode> attributes);
+ public virtual SyntaxNode RemoveNode(SyntaxNode root, SyntaxNode node);
+ public SyntaxNode RemoveNodes(SyntaxNode root, IEnumerable<SyntaxNode> declarations);
+ public virtual SyntaxNode ReplaceNode(SyntaxNode root, SyntaxNode node, SyntaxNode newDeclaration);
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
public abstract class SyntaxNode {
+ public bool Contains(SyntaxNode node);
}
public static class SyntaxNodeExtensions {
+ public static TSyntax WithoutTrivia<TSyntax>(this TSyntax syntax) where TSyntax : SyntaxNode;
+ public static TSyntax WithTriviaFrom<TSyntax>(this TSyntax syntax, SyntaxNode node) where TSyntax : SyntaxNode;
}
public struct SyntaxToken : IEquatable<SyntaxToken> {
+ public SyntaxToken WithTriviaFrom(SyntaxToken token);
}
}
}
```
##Workspace and hosting API Changes
- `CustomWorkspace` has been renamed to `AdhocWorkspace`. The name CustomWorkspace led people to think that this was the type to use to build their own custom workspaces. However this type is simply a quick-and-dirty workspace that's useful for very simple scenarios. To really have a fully functional workspace, one should derive from Workspace.
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis {
- public class CustomWorkspace : Workspace {
+ public sealed class AdhocWorkspace : Workspace {
+ public AdhocWorkspace();
+ public override bool CanOpenDocuments { get; }
+ public override void CloseAdditionalDocument(DocumentId documentId);
+ public override void CloseDocument(DocumentId documentId);
+ public override void OpenAdditionalDocument(DocumentId documentId, bool activate=true);
+ public override void OpenDocument(DocumentId documentId, bool activate=true);
}
}
```
- Workspace's method names were a bit misleading. A bunch of methods which were simply named with action verbs like `AddDocument` led people to believe those methods would take the action. However those methods are actually called by `ApplyChanges` and that's where an extender would implement the logic to add the document. So all such methods got an "Apply" prefix:
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis {
public abstract class Workspace : IDisposable {
- protected virtual void AddAdditionalDocument(DocumentInfo info, SourceText text);
- protected virtual void AddAnalyzerReference(ProjectId projectId, AnalyzerReference analyzerReference);
- protected virtual void AddDocument(DocumentInfo info, SourceText text);
- protected virtual void AddMetadataReference(ProjectId projectId, MetadataReference metadataReference);
- protected virtual void AddProjectReference(ProjectId projectId, ProjectReference projectReference);
+ protected virtual void ApplyAdditionalDocumentAdded(DocumentInfo info, SourceText text);
+ protected virtual void ApplyAdditionalDocumentRemoved(DocumentId documentId);
+ protected virtual void ApplyAdditionalDocumentTextChanged(DocumentId id, SourceText text);
+ protected virtual void ApplyAnalyzerReferenceAdded(ProjectId projectId, AnalyzerReference analyzerReference);
+ protected virtual void ApplyAnalyzerReferenceRemoved(ProjectId projectId, AnalyzerReference analyzerReference);
+ protected virtual void ApplyCompilationOptionsChanged(ProjectId projectId, CompilationOptions options);
+ protected virtual void ApplyDocumentAdded(DocumentInfo info, SourceText text);
+ protected virtual void ApplyDocumentRemoved(DocumentId documentId);
+ protected virtual void ApplyDocumentTextChanged(DocumentId id, SourceText text);
+ protected virtual void ApplyMetadataReferenceAdded(ProjectId projectId, MetadataReference metadataReference);
+ protected virtual void ApplyMetadataReferenceRemoved(ProjectId projectId, MetadataReference metadataReference);
+ protected virtual void ApplyParseOptionsChanged(ProjectId projectId, ParseOptions options);
+ protected virtual void ApplyProjectAdded(ProjectInfo project);
+ protected virtual void ApplyProjectReferenceAdded(ProjectId projectId, ProjectReference projectReference);
+ protected virtual void ApplyProjectReferenceRemoved(ProjectId projectId, ProjectReference projectReference);
+ protected virtual void ApplyProjectRemoved(ProjectId projectId);
- protected virtual void ChangedAdditionalDocumentText(DocumentId id, SourceText text);
- protected virtual void ChangedDocumentText(DocumentId id, SourceText text);
+ protected void CheckCanOpenDocuments();
- protected virtual void RemoveAdditionalDocument(DocumentId documentId);
- protected virtual void RemoveAnalyzerReference(ProjectId projectId, AnalyzerReference analyzerReference);
- protected virtual void RemoveDocument(DocumentId documentId);
- protected virtual void RemoveMetadataReference(ProjectId projectId, MetadataReference metadataReference);
- protected virtual void RemoveProjectReference(ProjectId projectId, ProjectReference projectReference);
}
}
}
```
- Some more cleanup where APIs were either missing a parameter or had a parameter that wasn't doing what users expected
```diff
assembly Microsoft.CodeAnalysis.Workspaces {
namespace Microsoft.CodeAnalysis {
public sealed class DocumentInfo {
+ public static DocumentInfo Create(DocumentId id, string name, IEnumerable<string> folders=null, SourceCodeKind sourceCodeKind=(SourceCodeKind)(0), TextLoader loader=null, string filePath=null, bool isGenerated=false);
- public static DocumentInfo Create(DocumentId id, string name, IEnumerable<string> folders=null, SourceCodeKind sourceCodeKind=(SourceCodeKind)(0), TextLoader loader=null, string filePath=null, Encoding defaultEncoding=null, bool isGenerated=false);
- public DocumentInfo WithDefaultEncoding(Encoding encoding);
}
public class Project {
- public TextDocument AddAdditionalDocument(string name, SourceText text, IEnumerable<string> folders=null);
+ public TextDocument AddAdditionalDocument(string name, SourceText text, IEnumerable<string> folders=null, string filePath=null);
- public TextDocument AddAdditionalDocument(string name, string text, IEnumerable<string> folders=null);
+ public TextDocument AddAdditionalDocument(string name, string text, IEnumerable<string> folders=null, string filePath=null);
- public Document AddDocument(string name, SyntaxNode syntaxRoot, IEnumerable<string> folders=null);
+ public Document AddDocument(string name, SyntaxNode syntaxRoot, IEnumerable<string> folders=null, string filePath=null);
- public Document AddDocument(string name, SourceText text, IEnumerable<string> folders=null);
+ public Document AddDocument(string name, SourceText text, IEnumerable<string> folders=null, string filePath=null);
- public Document AddDocument(string name, string text, IEnumerable<string> folders=null);
+ public Document AddDocument(string name, string text, IEnumerable<string> folders=null, string filePath=null);
}
}
}
```
##Changes resulting from language features
- **C#**
- Most of the changes were from changes to String Interpolation.
- CSharpKind() has been renamed to Kind().
```diff
assembly Microsoft.CodeAnalysis.CSharp {
namespace Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
public static class CSharpExtensions {
- public static SyntaxKind CSharpContextualKind(this SyntaxToken token);
- public static SyntaxKind CSharpKind(this SyntaxNode node);
- public static SyntaxKind CSharpKind(this SyntaxNodeOrToken nodeOrToken);
- public static SyntaxKind CSharpKind(this SyntaxToken token);
- public static SyntaxKind CSharpKind(this SyntaxTrivia trivia);
- public static bool IsContextualKind(this SyntaxToken token, SyntaxKind kind);
}
}
namespace Microsoft.CodeAnalysis.CSharp {
public struct Conversion : IEquatable<Conversion> {
+ public bool IsInterpolatedString { get; }
}
public static class CSharpExtensions {
+ public static SyntaxKind Kind(this SyntaxNode node);
+ public static SyntaxKind Kind(this SyntaxNodeOrToken nodeOrToken);
+ public static SyntaxKind Kind(this SyntaxToken token);
+ public static SyntaxKind Kind(this SyntaxTrivia trivia);
}
public abstract class CSharpSyntaxNode : SyntaxNode {
- public SyntaxKind CSharpKind();
+ public SyntaxKind Kind();
}
public abstract class CSharpSyntaxRewriter : CSharpSyntaxVisitor<SyntaxNode> {
- public override SyntaxNode VisitInterpolatedString(InterpolatedStringSyntax node);
+ public override SyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
- public override SyntaxNode VisitInterpolatedStringInsert(InterpolatedStringInsertSyntax node);
+ public override SyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public override SyntaxNode VisitInterpolation(InterpolationSyntax node);
+ public override SyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public override SyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class CSharpSyntaxVisitor {
- public virtual void VisitInterpolatedString(InterpolatedStringSyntax node);
+ public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
- public virtual void VisitInterpolatedStringInsert(InterpolatedStringInsertSyntax node);
+ public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual void VisitInterpolation(InterpolationSyntax node);
+ public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class CSharpSyntaxVisitor<TResult> {
- public virtual TResult VisitInterpolatedString(InterpolatedStringSyntax node);
+ public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
- public virtual TResult VisitInterpolatedStringInsert(InterpolatedStringInsertSyntax node);
+ public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual TResult VisitInterpolation(InterpolationSyntax node);
+ public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public static class SyntaxFactory {
public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken ifKeywordwhenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken);
- public static InterpolatedStringSyntax InterpolatedString(SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts=null);
- public static InterpolatedStringSyntax InterpolatedString(SyntaxToken stringStart, SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts, SyntaxToken stringEnd);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxList<InterpolatedStringContentSyntax> contents);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken);
- public static InterpolatedStringInsertSyntax InterpolatedStringInsert(ExpressionSyntax expression);
- public static InterpolatedStringInsertSyntax InterpolatedStringInsert(ExpressionSyntax expression, SyntaxToken comma, ExpressionSyntax alignment, SyntaxToken format);
+ public static InterpolatedStringTextSyntax InterpolatedStringText();
+ public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause);
+ public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value);
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken);
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken);
}
public enum SyntaxKind : ushort {
- InterpolatedString = (ushort)8655,
InterpolatedStringEndToken = (ushort)85188483,
+ InterpolatedStringExpression = (ushort)8655,
- InterpolatedStringInsert = (ushort)8918,
- InterpolatedStringMidToken = (ushort)8517,
InterpolatedStringStartToken = (ushort)85168482,
+ InterpolatedStringText = (ushort)8919,
+ InterpolatedStringTextToken = (ushort)8517,
+ InterpolatedVerbatimStringStartToken = (ushort)8484,
+ Interpolation = (ushort)8918,
+ InterpolationAlignmentClause = (ushort)8920,
+ InterpolationFormatClause = (ushort)8921,
+ WhenKeyword = (ushort)8437,
}
}
namespace Microsoft.CodeAnalysis.CSharp.Syntax {
public sealed class CatchFilterClauseSyntax : CSharpSyntaxNode {
- public SyntaxToken IfKeyword { get; }
+ public SyntaxToken WhenKeyword { get; }
public CatchFilterClauseSyntax Update(SyntaxToken ifKeywordwhenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken);
- public CatchFilterClauseSyntax WithIfKeyword(SyntaxToken ifKeyword);
+ public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword);
}
+ public abstract class InterpolatedStringContentSyntax : CSharpSyntaxNode {
}
+ public sealed class InterpolatedStringExpressionSyntax : ExpressionSyntax {
+ public SyntaxList<InterpolatedStringContentSyntax> Contents { get; }
+ public SyntaxToken StringEndToken { get; }
+ public SyntaxToken StringStartToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items);
+ public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken);
+ public InterpolatedStringExpressionSyntax WithContents(SyntaxList<InterpolatedStringContentSyntax> contents);
+ public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken);
+ public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken);
}
- public sealed class InterpolatedStringInsertSyntax : CSharpSyntaxNode {
- public ExpressionSyntax Alignment { get; }
- public SyntaxToken Comma { get; }
- public ExpressionSyntax Expression { get; }
- public SyntaxToken Format { get; }
- public override void Accept(CSharpSyntaxVisitor visitor);
- public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
- public InterpolatedStringInsertSyntax Update(ExpressionSyntax expression, SyntaxToken comma, ExpressionSyntax alignment, SyntaxToken format);
- public InterpolatedStringInsertSyntax WithAlignment(ExpressionSyntax alignment);
- public InterpolatedStringInsertSyntax WithComma(SyntaxToken comma);
- public InterpolatedStringInsertSyntax WithExpression(ExpressionSyntax expression);
- public InterpolatedStringInsertSyntax WithFormat(SyntaxToken format);
}
- public sealed class InterpolatedStringSyntax : ExpressionSyntax {
- public SeparatedSyntaxList<InterpolatedStringInsertSyntax> InterpolatedInserts { get; }
- public SyntaxToken StringEnd { get; }
- public SyntaxToken StringStart { get; }
- public override void Accept(CSharpSyntaxVisitor visitor);
- public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
- public InterpolatedStringSyntax AddInterpolatedInserts(params InterpolatedStringInsertSyntax[] items);
- public InterpolatedStringSyntax Update(SyntaxToken stringStart, SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts, SyntaxToken stringEnd);
- public InterpolatedStringSyntax WithInterpolatedInserts(SeparatedSyntaxList<InterpolatedStringInsertSyntax> interpolatedInserts);
- public InterpolatedStringSyntax WithStringEnd(SyntaxToken stringEnd);
- public InterpolatedStringSyntax WithStringStart(SyntaxToken stringStart);
}
+ public sealed class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax {
+ public SyntaxToken TextToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringTextSyntax Update(SyntaxToken textToken);
+ public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken);
}
+ public sealed class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode {
+ public SyntaxToken CommaToken { get; }
+ public ExpressionSyntax Value { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value);
+ public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken);
+ public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value);
}
+ public sealed class InterpolationFormatClauseSyntax : CSharpSyntaxNode {
+ public SyntaxToken ColonToken { get; }
+ public SyntaxToken FormatStringToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken);
+ public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken);
+ public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken);
}
+ public sealed class InterpolationSyntax : InterpolatedStringContentSyntax {
+ public InterpolationAlignmentClauseSyntax AlignmentClause { get; }
+ public SyntaxToken CloseBraceToken { get; }
+ public ExpressionSyntax Expression { get; }
+ public InterpolationFormatClauseSyntax FormatClause { get; }
+ public SyntaxToken OpenBraceToken { get; }
+ public override void Accept(CSharpSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor);
+ public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax alignmentClause);
+ public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithExpression(ExpressionSyntax expression);
+ public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax formatClause);
+ public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken);
}
}
}
```
- **VB**
- String Interpolation work resulted in a bunch of new syntax APIs.
- VBKind() has been renamed to Kind()
- Syntax nodes for block declarations (e.g. ClassBlockSyntax, ConstructorBlockSyntax) have been changed to have block specific child names (e.g. SubNewStatement, EndSubStatement) instead of generic ones (e.g. Begin/End). This was done to make these members consistent with the rest of the API.
- Syntax nodes for various statements (e.g. MethodStatementSyntax) have been changed to have statement specific child names (e.g. SubOrFunctionKeyword) instead of generic ones (e.g. Keyword). This was done to make these members consistent with the rest of the API.
```diff
assembly Microsoft.CodeAnalysis.VisualBasic {
namespace Microsoft.CodeAnalysis {
public sealed class VisualBasicExtensions {
- public static bool IsContextualKind(this SyntaxToken token, SyntaxKind kind);
- public static SyntaxKind VBKind(this SyntaxNode node);
- public static SyntaxKind VBKind(this SyntaxNodeOrToken nodeOrToken);
- public static SyntaxKind VBKind(this SyntaxToken token);
- public static SyntaxKind VBKind(this SyntaxTrivia trivia);
- public static SyntaxKind VisualBasicContextualKind(this SyntaxToken token);
}
}
namespace Microsoft.CodeAnalysis.VisualBasic {
public class SyntaxFactory {
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxList<InterpolatedStringContentSyntax> contents);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken dollarSignDoubleQuoteToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken doubleQuoteToken);
+ public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(params InterpolatedStringContentSyntax[] contents);
+ public static InterpolatedStringTextSyntax InterpolatedStringText();
+ public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken);
+ public static SyntaxToken InterpolatedStringTextToken(SyntaxTriviaList leadingTrivia, string text, string value, SyntaxTriviaList trailingTrivia);
+ public static SyntaxToken InterpolatedStringTextToken(string text, string value);
+ public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression);
+ public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause);
+ public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value);
+ public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(ExpressionSyntax value);
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause();
+ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken);
}
public class SyntaxFacts {
+ public static bool IsAccessorStatementAccessorKeyword(SyntaxKind kind);
+ public static bool IsDeclareStatementSubOrFunctionKeyword(SyntaxKind kind);
+ public static bool IsDelegateStatementSubOrFunctionKeyword(SyntaxKind kind);
+ public static bool IsLambdaHeaderSubOrFunctionKeyword(SyntaxKind kind);
+ public static bool IsMethodStatementSubOrFunctionKeyword(SyntaxKind kind);
}
public enum SyntaxKind : ushort {
+ DollarSignDoubleQuoteToken = (ushort)785,
+ EndOfInterpolatedStringToken = (ushort)787,
+ InterpolatedStringExpression = (ushort)780,
+ InterpolatedStringText = (ushort)781,
+ InterpolatedStringTextToken = (ushort)786,
+ Interpolation = (ushort)782,
+ InterpolationAlignmentClause = (ushort)783,
+ InterpolationFormatClause = (ushort)784,
}
public sealed class VisualBasicExtensions {
+ public static SyntaxKind Kind(this SyntaxNode node);
+ public static SyntaxKind Kind(this SyntaxNodeOrToken nodeOrToken);
+ public static SyntaxKind Kind(this SyntaxToken token);
+ public static SyntaxKind Kind(this SyntaxTrivia trivia);
}
public abstract class VisualBasicSyntaxNode : SyntaxNode {
+ public SyntaxKind Kind();
- public SyntaxKind VBKind();
}
public abstract class VisualBasicSyntaxRewriter : VisualBasicSyntaxVisitor<SyntaxNode> {
+ public override SyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
+ public override SyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public override SyntaxNode VisitInterpolation(InterpolationSyntax node);
+ public override SyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public override SyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class VisualBasicSyntaxVisitor {
+ public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
+ public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual void VisitInterpolation(InterpolationSyntax node);
+ public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
public abstract class VisualBasicSyntaxVisitor<TResult> {
+ public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node);
+ public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node);
+ public virtual TResult VisitInterpolation(InterpolationSyntax node);
+ public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node);
+ public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node);
}
}
namespace Microsoft.CodeAnalysis.VisualBasic.Syntax {
public sealed class AccessorBlockSyntax : MethodBlockBaseSyntax {
+ public AccessorStatementSyntax AccessorStatement { get; }
+ public override MethodBaseSyntax BlockStatement { get; }
+ public EndBlockStatementSyntax EndAccessorStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public AccessorBlockSyntax WithAccessorStatement(AccessorStatementSyntax accessorStatement);
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public AccessorBlockSyntax WithEndAccessorStatement(EndBlockStatementSyntax endAccessorStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
}
public sealed class AccessorStatementSyntax : MethodBaseSyntax {
+ public SyntaxToken AccessorKeyword { get; }
+ public override SyntaxToken DeclarationKeyword { get; }
+ public AccessorStatementSyntax WithAccessorKeyword(SyntaxToken accessorKeyword);
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
}
public sealed class CaseBlockSyntax : VisualBasicSyntaxNode {
+ public CaseStatementSyntax CaseStatement { get; }
+ public CaseBlockSyntax AddCaseStatementCases(params CaseClauseSyntax[] items);
+ public CaseBlockSyntax WithCaseStatement(CaseStatementSyntax caseStatement);
}
public sealed class ClassBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public ClassStatementSyntax ClassStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndClassStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public ClassBlockSyntax WithClassStatement(ClassStatementSyntax classStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public ClassBlockSyntax WithEndClassStatement(EndBlockStatementSyntax endClassStatement);
}
public sealed class ClassStatementSyntax : TypeStatementSyntax {
+ public SyntaxToken ClassKeyword { get; }
+ public override SyntaxToken DeclarationKeyword { get; }
+ public ClassStatementSyntax WithClassKeyword(SyntaxToken classKeyword);
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
}
public sealed class ConstructorBlockSyntax : MethodBlockBaseSyntax {
+ public override MethodBaseSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndSubStatement { get; }
+ public SubNewStatementSyntax SubNewStatement { get; }
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public ConstructorBlockSyntax WithEndSubStatement(EndBlockStatementSyntax endSubStatement);
+ public ConstructorBlockSyntax WithSubNewStatement(SubNewStatementSyntax subNewStatement);
}
public sealed class CrefOperatorReferenceSyntax : NameSyntax {
+ public SyntaxToken OperatorKeyword { get; }
+ public CrefOperatorReferenceSyntax WithOperatorKeyword(SyntaxToken operatorKeyword);
}
public sealed class DeclareStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public DeclareStatementSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public sealed class DelegateStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public DelegateStatementSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public sealed class EventStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken EventKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public EventStatementSyntax WithEventKeyword(SyntaxToken eventKeyword);
}
public sealed class InterfaceBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndInterfaceStatement { get; }
+ public InterfaceStatementSyntax InterfaceStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public InterfaceBlockSyntax WithEndInterfaceStatement(EndBlockStatementSyntax endInterfaceStatement);
+ public InterfaceBlockSyntax WithInterfaceStatement(InterfaceStatementSyntax interfaceStatement);
}
public sealed class InterfaceStatementSyntax : TypeStatementSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken InterfaceKeyword { get; }
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public InterfaceStatementSyntax WithInterfaceKeyword(SyntaxToken interfaceKeyword);
}
+ public abstract class InterpolatedStringContentSyntax : VisualBasicSyntaxNode {
}
+ public sealed class InterpolatedStringExpressionSyntax : ExpressionSyntax {
+ public SyntaxList<InterpolatedStringContentSyntax> Contents { get; }
+ public SyntaxToken DollarSignDoubleQuoteToken { get; }
+ public SyntaxToken DoubleQuoteToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items);
+ public InterpolatedStringExpressionSyntax Update(SyntaxToken dollarSignDoubleQuoteToken, SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken doubleQuoteToken);
+ public InterpolatedStringExpressionSyntax WithContents(SyntaxList<InterpolatedStringContentSyntax> contents);
+ public InterpolatedStringExpressionSyntax WithDollarSignDoubleQuoteToken(SyntaxToken dollarSignDoubleQuoteToken);
+ public InterpolatedStringExpressionSyntax WithDoubleQuoteToken(SyntaxToken doubleQuoteToken);
}
+ public sealed class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax {
+ public SyntaxToken TextToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolatedStringTextSyntax Update(SyntaxToken textToken);
+ public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken);
}
+ public sealed class InterpolationAlignmentClauseSyntax : VisualBasicSyntaxNode {
+ public SyntaxToken CommaToken { get; }
+ public ExpressionSyntax Value { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value);
+ public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken);
+ public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value);
}
+ public sealed class InterpolationFormatClauseSyntax : VisualBasicSyntaxNode {
+ public SyntaxToken ColonToken { get; }
+ public SyntaxToken FormatStringToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken);
+ public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken);
+ public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken);
}
+ public sealed class InterpolationSyntax : InterpolatedStringContentSyntax {
+ public InterpolationAlignmentClauseSyntax AlignmentClause { get; }
+ public SyntaxToken CloseBraceToken { get; }
+ public ExpressionSyntax Expression { get; }
+ public InterpolationFormatClauseSyntax FormatClause { get; }
+ public SyntaxToken OpenBraceToken { get; }
+ public override void Accept(VisualBasicSyntaxVisitor visitor);
+ public override TResult Accept<TResult>(VisualBasicSyntaxVisitor<TResult> visitor);
+ public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax alignmentClause);
+ public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken);
+ public InterpolationSyntax WithExpression(ExpressionSyntax expression);
+ public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax formatClause);
+ public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken);
}
public abstract class LambdaExpressionSyntax : ExpressionSyntax {
+ public LambdaHeaderSyntax SubOrFunctionHeader { get; }
}
public sealed class LambdaHeaderSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public LambdaHeaderSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public abstract class MethodBaseSyntax : DeclarationStatementSyntax {
+ public abstract SyntaxToken DeclarationKeyword { get; }
+ public abstract MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public MethodBaseSyntax WithKeyword(SyntaxToken keyword);
}
public abstract class MethodBlockBaseSyntax : DeclarationStatementSyntax {
+ public abstract MethodBaseSyntax BlockStatement { get; }
+ public abstract EndBlockStatementSyntax EndBlockStatement { get; }
+ public MethodBlockBaseSyntax WithBegin(MethodBaseSyntax begin);
+ public abstract MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public MethodBlockBaseSyntax WithEnd(EndBlockStatementSyntax end);
+ public abstract MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
}
public sealed class MethodBlockSyntax : MethodBlockBaseSyntax {
+ public override MethodBaseSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndSubOrFunctionStatement { get; }
+ public MethodStatementSyntax SubOrFunctionStatement { get; }
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public MethodBlockSyntax WithEndSubOrFunctionStatement(EndBlockStatementSyntax endSubOrFunctionStatement);
+ public MethodBlockSyntax WithSubOrFunctionStatement(MethodStatementSyntax subOrFunctionStatement);
}
public sealed class MethodStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubOrFunctionKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public MethodStatementSyntax WithSubOrFunctionKeyword(SyntaxToken subOrFunctionKeyword);
}
public sealed class ModuleBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndModuleStatement { get; }
+ public ModuleStatementSyntax ModuleStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public ModuleBlockSyntax WithEndModuleStatement(EndBlockStatementSyntax endModuleStatement);
+ public ModuleBlockSyntax WithModuleStatement(ModuleStatementSyntax moduleStatement);
}
public sealed class ModuleStatementSyntax : TypeStatementSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken ModuleKeyword { get; }
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public ModuleStatementSyntax WithModuleKeyword(SyntaxToken moduleKeyword);
}
public sealed class MultiLineLambdaExpressionSyntax : LambdaExpressionSyntax {
+ public EndBlockStatementSyntax EndSubOrFunctionStatement { get; }
+ public new LambdaHeaderSyntax SubOrFunctionHeader { get; }
+ public MultiLineLambdaExpressionSyntax WithEndSubOrFunctionStatement(EndBlockStatementSyntax endSubOrFunctionStatement);
+ public MultiLineLambdaExpressionSyntax WithSubOrFunctionHeader(LambdaHeaderSyntax subOrFunctionHeader);
}
public sealed class OperatorBlockSyntax : MethodBlockBaseSyntax {
+ public override MethodBaseSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndOperatorStatement { get; }
+ public OperatorStatementSyntax OperatorStatement { get; }
+ public override MethodBlockBaseSyntax WithBlockStatement(MethodBaseSyntax blockStatement);
+ public override MethodBlockBaseSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public OperatorBlockSyntax WithEndOperatorStatement(EndBlockStatementSyntax endOperatorStatement);
+ public OperatorBlockSyntax WithOperatorStatement(OperatorStatementSyntax operatorStatement);
}
public sealed class OperatorStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken OperatorKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public OperatorStatementSyntax WithOperatorKeyword(SyntaxToken operatorKeyword);
}
public sealed class PropertyStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken PropertyKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public PropertyStatementSyntax WithPropertyKeyword(SyntaxToken propertyKeyword);
}
public sealed class SingleLineLambdaExpressionSyntax : LambdaExpressionSyntax {
+ public new LambdaHeaderSyntax SubOrFunctionHeader { get; }
public SingleLineLambdaExpressionSyntax Update(SyntaxKind kind, LambdaHeaderSyntax beginsubOrFunctionHeader, VisualBasicSyntaxNode body);
+ public SingleLineLambdaExpressionSyntax WithSubOrFunctionHeader(LambdaHeaderSyntax subOrFunctionHeader);
}
public sealed class StructureBlockSyntax : TypeBlockSyntax {
+ public override TypeStatementSyntax BlockStatement { get; }
+ public override EndBlockStatementSyntax EndBlockStatement { get; }
+ public EndBlockStatementSyntax EndStructureStatement { get; }
+ public StructureStatementSyntax StructureStatement { get; }
+ public override TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public override TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
+ public StructureBlockSyntax WithEndStructureStatement(EndBlockStatementSyntax endStructureStatement);
+ public StructureBlockSyntax WithStructureStatement(StructureStatementSyntax structureStatement);
}
public sealed class StructureStatementSyntax : TypeStatementSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken StructureKeyword { get; }
+ public override TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public StructureStatementSyntax WithStructureKeyword(SyntaxToken structureKeyword);
}
public sealed class SubNewStatementSyntax : MethodBaseSyntax {
+ public override SyntaxToken DeclarationKeyword { get; }
+ public SyntaxToken SubKeyword { get; }
+ public override MethodBaseSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public SubNewStatementSyntax WithSubKeyword(SyntaxToken subKeyword);
}
public abstract class TypeBlockSyntax : DeclarationStatementSyntax {
+ public abstract TypeStatementSyntax BlockStatement { get; }
+ public abstract EndBlockStatementSyntax EndBlockStatement { get; }
+ public TypeBlockSyntax WithBegin(TypeStatementSyntax begin);
+ public abstract TypeBlockSyntax WithBlockStatement(TypeStatementSyntax blockStatement);
+ public TypeBlockSyntax WithEnd(EndBlockStatementSyntax end);
+ public abstract TypeBlockSyntax WithEndBlockStatement(EndBlockStatementSyntax endBlockStatement);
}
public abstract class TypeStatementSyntax : DeclarationStatementSyntax {
+ public abstract SyntaxToken DeclarationKeyword { get; }
+ public abstract TypeStatementSyntax WithDeclarationKeyword(SyntaxToken keyword);
+ public TypeStatementSyntax WithKeyword(SyntaxToken keyword);
}
}
}
```
## Miscellaneous
APIs that weren't meant to be public or that were already deprecated have been removed.
```diff
assembly Microsoft.CodeAnalysis {
namespace Microsoft.CodeAnalysis {
- public enum CommonMemberResolutionKind {
- Applicable = 0,
- TypeInferenceFailed = 2,
- UseSiteError = 1,
- Worse = 3,
}
public struct CommonMemberResolutionResult<TMember> where TMember : ISymbol {
- public bool IsValid { get; }
- public TMember Member { get; }
- public CommonMemberResolutionKind Resolution { get; }
}
public struct CommonOverloadResolutionResult<TMember> where TMember : ISymbol {
- public Nullable<CommonMemberResolutionResult<TMember>> BestResult { get; }
- public ImmutableArray<CommonMemberResolutionResult<TMember>> Results { get; }
- public bool Succeeded { get; }
- public Nullable<CommonMemberResolutionResult<TMember>> ValidResult { get; }
}
- public static class ImmutableArrayExtensions {
- public static void AddRange<T, U>(this List<T> list, ImmutableArray<U> items) where U : T;
- public static ImmutableArray<T> AsImmutable<T>(this IEnumerable<T> items);
- public static ImmutableArray<T> AsImmutable<T>(this T[] items);
- public static ImmutableArray<T> AsImmutableOrEmpty<T>(this IEnumerable<T> items);
- public static ImmutableArray<T> AsImmutableOrEmpty<T>(this T[] items);
- public static ImmutableArray<T> AsImmutableOrNull<T>(this IEnumerable<T> items);
- public static ImmutableArray<T> AsImmutableOrNull<T>(this T[] items);
- [MethodImpl(AggressiveInlining)]public static ImmutableArray<TBase> Cast<TDerived, TBase>(this ImmutableArray<TDerived> items) where TDerived : class, TBase;
- public static ImmutableArray<T> Distinct<T>(this ImmutableArray<T> array, IEqualityComparer<T> comparer=null);
- public static ImmutableArray<T> NullToEmpty<T>(this ImmutableArray<T> array);
- public static ImmutableArray<TResult> SelectAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> items, Func<TItem, int, TArg, TResult> map, TArg arg);
- public static ImmutableArray<TResult> SelectAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> items, Func<TItem, TArg, TResult> map, TArg arg);
- public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map);
- public static bool SetEquals<T>(this ImmutableArray<T> array1, ImmutableArray<T> array2, IEqualityComparer<T> comparer);
- public static ImmutableArray<byte> ToImmutable(this MemoryStream stream);
- public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate);
}
public enum TypeKind : byte {
- ArrayType = (byte)1,
- DynamicType = (byte)4,
- PointerType = (byte)9,
}
}
assembly Microsoft.CodeAnalysis.Workspaces.Desktop {
namespace Microsoft.CodeAnalysis.Host.Mef {
public class MefV1HostServices : HostServices {
- public static MefV1HostServices DefaultHost { get; }
}
}
}
``` | -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/Core/Portable/Debugging/SourceHashAlgorithms.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Debugging
{
/// <summary>
/// Hash algorithms supported by the debugger used for source file checksums stored in the PDB.
/// </summary>
internal static class SourceHashAlgorithms
{
private static readonly Guid s_guidSha1 = unchecked(new Guid((int)0xff1816ec, (short)0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60));
private static readonly Guid s_guidSha256 = unchecked(new Guid((int)0x8829d00f, 0x11b8, 0x4213, 0x87, 0x8b, 0x77, 0x0e, 0x85, 0x97, 0xac, 0x16));
public static bool IsSupportedAlgorithm(SourceHashAlgorithm algorithm)
=> algorithm switch
{
SourceHashAlgorithm.Sha1 => true,
SourceHashAlgorithm.Sha256 => true,
_ => false
};
public static Guid GetAlgorithmGuid(SourceHashAlgorithm algorithm)
=> algorithm switch
{
SourceHashAlgorithm.Sha1 => s_guidSha1,
SourceHashAlgorithm.Sha256 => s_guidSha256,
_ => throw ExceptionUtilities.UnexpectedValue(algorithm),
};
public static SourceHashAlgorithm GetSourceHashAlgorithm(Guid guid)
=> (guid == s_guidSha256) ? SourceHashAlgorithm.Sha256 :
(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 :
SourceHashAlgorithm.None;
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Debugging
{
/// <summary>
/// Hash algorithms supported by the debugger used for source file checksums stored in the PDB.
/// </summary>
internal static class SourceHashAlgorithms
{
private static readonly Guid s_guidSha1 = unchecked(new Guid((int)0xff1816ec, (short)0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60));
private static readonly Guid s_guidSha256 = unchecked(new Guid((int)0x8829d00f, 0x11b8, 0x4213, 0x87, 0x8b, 0x77, 0x0e, 0x85, 0x97, 0xac, 0x16));
public static bool IsSupportedAlgorithm(SourceHashAlgorithm algorithm)
=> algorithm switch
{
SourceHashAlgorithm.Sha1 => true,
SourceHashAlgorithm.Sha256 => true,
_ => false
};
public static Guid GetAlgorithmGuid(SourceHashAlgorithm algorithm)
=> algorithm switch
{
SourceHashAlgorithm.Sha1 => s_guidSha1,
SourceHashAlgorithm.Sha256 => s_guidSha256,
_ => throw ExceptionUtilities.UnexpectedValue(algorithm),
};
public static SourceHashAlgorithm GetSourceHashAlgorithm(Guid guid)
=> (guid == s_guidSha256) ? SourceHashAlgorithm.Sha256 :
(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 :
SourceHashAlgorithm.None;
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/CSharp/Portable/Emitter/Model/NamedTypeReference.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.Emit;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Emit
{
internal abstract class NamedTypeReference : Cci.INamedTypeReference
{
protected readonly NamedTypeSymbol UnderlyingNamedType;
public NamedTypeReference(NamedTypeSymbol underlyingNamedType)
{
Debug.Assert((object)underlyingNamedType != null);
this.UnderlyingNamedType = underlyingNamedType;
}
ushort Cci.INamedTypeReference.GenericParameterCount
{
get
{
return (ushort)UnderlyingNamedType.Arity;
}
}
bool Cci.INamedTypeReference.MangleName
{
get
{
return UnderlyingNamedType.MangleName;
}
}
string Cci.INamedEntity.Name
{
get
{
return UnderlyingNamedType.MetadataName;
}
}
bool Cci.ITypeReference.IsEnum
{
get
{
return UnderlyingNamedType.IsEnumType();
}
}
bool Cci.ITypeReference.IsValueType
{
get
{
return UnderlyingNamedType.IsValueType;
}
}
Cci.ITypeDefinition Cci.ITypeReference.GetResolvedType(EmitContext context)
{
return null;
}
Cci.PrimitiveTypeCode Cci.ITypeReference.TypeCode
{
get
{
return Cci.PrimitiveTypeCode.NotPrimitive;
}
}
TypeDefinitionHandle Cci.ITypeReference.TypeDef
{
get
{
return default(TypeDefinitionHandle);
}
}
Cci.IGenericMethodParameterReference Cci.ITypeReference.AsGenericMethodParameterReference
{
get
{
return null;
}
}
public abstract Cci.IGenericTypeInstanceReference AsGenericTypeInstanceReference
{
get;
}
Cci.IGenericTypeParameterReference Cci.ITypeReference.AsGenericTypeParameterReference
{
get
{
return null;
}
}
Cci.INamespaceTypeDefinition Cci.ITypeReference.AsNamespaceTypeDefinition(EmitContext context)
{
return null;
}
public abstract Cci.INamespaceTypeReference AsNamespaceTypeReference
{
get;
}
Cci.INestedTypeDefinition Cci.ITypeReference.AsNestedTypeDefinition(EmitContext context)
{
return null;
}
public abstract Cci.INestedTypeReference AsNestedTypeReference
{
get;
}
public abstract Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeReference
{
get;
}
Cci.ITypeDefinition Cci.ITypeReference.AsTypeDefinition(EmitContext context)
{
return null;
}
public override string ToString()
{
return UnderlyingNamedType.ToDisplayString(SymbolDisplayFormat.ILVisualizationFormat);
}
IEnumerable<Cci.ICustomAttribute> Cci.IReference.GetAttributes(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
}
public abstract void Dispatch(Cci.MetadataVisitor visitor);
Cci.IDefinition Cci.IReference.AsDefinition(EmitContext context)
{
return null;
}
CodeAnalysis.Symbols.ISymbolInternal Cci.IReference.GetInternalSymbol() => UnderlyingNamedType;
public sealed override bool Equals(object obj)
{
// It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used.
throw Roslyn.Utilities.ExceptionUtilities.Unreachable;
}
public sealed override int GetHashCode()
{
// It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used.
throw Roslyn.Utilities.ExceptionUtilities.Unreachable;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.Emit;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Emit
{
internal abstract class NamedTypeReference : Cci.INamedTypeReference
{
protected readonly NamedTypeSymbol UnderlyingNamedType;
public NamedTypeReference(NamedTypeSymbol underlyingNamedType)
{
Debug.Assert((object)underlyingNamedType != null);
this.UnderlyingNamedType = underlyingNamedType;
}
ushort Cci.INamedTypeReference.GenericParameterCount
{
get
{
return (ushort)UnderlyingNamedType.Arity;
}
}
bool Cci.INamedTypeReference.MangleName
{
get
{
return UnderlyingNamedType.MangleName;
}
}
string Cci.INamedEntity.Name
{
get
{
return UnderlyingNamedType.MetadataName;
}
}
bool Cci.ITypeReference.IsEnum
{
get
{
return UnderlyingNamedType.IsEnumType();
}
}
bool Cci.ITypeReference.IsValueType
{
get
{
return UnderlyingNamedType.IsValueType;
}
}
Cci.ITypeDefinition Cci.ITypeReference.GetResolvedType(EmitContext context)
{
return null;
}
Cci.PrimitiveTypeCode Cci.ITypeReference.TypeCode
{
get
{
return Cci.PrimitiveTypeCode.NotPrimitive;
}
}
TypeDefinitionHandle Cci.ITypeReference.TypeDef
{
get
{
return default(TypeDefinitionHandle);
}
}
Cci.IGenericMethodParameterReference Cci.ITypeReference.AsGenericMethodParameterReference
{
get
{
return null;
}
}
public abstract Cci.IGenericTypeInstanceReference AsGenericTypeInstanceReference
{
get;
}
Cci.IGenericTypeParameterReference Cci.ITypeReference.AsGenericTypeParameterReference
{
get
{
return null;
}
}
Cci.INamespaceTypeDefinition Cci.ITypeReference.AsNamespaceTypeDefinition(EmitContext context)
{
return null;
}
public abstract Cci.INamespaceTypeReference AsNamespaceTypeReference
{
get;
}
Cci.INestedTypeDefinition Cci.ITypeReference.AsNestedTypeDefinition(EmitContext context)
{
return null;
}
public abstract Cci.INestedTypeReference AsNestedTypeReference
{
get;
}
public abstract Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeReference
{
get;
}
Cci.ITypeDefinition Cci.ITypeReference.AsTypeDefinition(EmitContext context)
{
return null;
}
public override string ToString()
{
return UnderlyingNamedType.ToDisplayString(SymbolDisplayFormat.ILVisualizationFormat);
}
IEnumerable<Cci.ICustomAttribute> Cci.IReference.GetAttributes(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
}
public abstract void Dispatch(Cci.MetadataVisitor visitor);
Cci.IDefinition Cci.IReference.AsDefinition(EmitContext context)
{
return null;
}
CodeAnalysis.Symbols.ISymbolInternal Cci.IReference.GetInternalSymbol() => UnderlyingNamedType;
public sealed override bool Equals(object obj)
{
// It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used.
throw Roslyn.Utilities.ExceptionUtilities.Unreachable;
}
public sealed override int GetHashCode()
{
// It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used.
throw Roslyn.Utilities.ExceptionUtilities.Unreachable;
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Harness;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input;
using Xunit;
using Xunit.Abstractions;
namespace Roslyn.VisualStudio.IntegrationTests
{
[CaptureTestName]
public abstract class AbstractIntegrationTest : IAsyncLifetime, IDisposable
{
protected const string ProjectName = "TestProj";
protected const string SolutionName = "TestSolution";
private readonly MessageFilter _messageFilter;
private readonly VisualStudioInstanceFactory _instanceFactory;
private VisualStudioInstanceContext _visualStudioContext;
protected AbstractIntegrationTest(VisualStudioInstanceFactory instanceFactory)
{
Assert.Equal(ApartmentState.STA, Thread.CurrentThread.GetApartmentState());
// Install a COM message filter to handle retry operations when the first attempt fails
_messageFilter = RegisterMessageFilter();
_instanceFactory = instanceFactory;
try
{
Helper.Automation.TransactionTimeout = 20000;
}
catch
{
_messageFilter.Dispose();
_messageFilter = null;
throw;
}
}
public VisualStudioInstance VisualStudio => _visualStudioContext?.Instance;
public virtual async Task InitializeAsync()
{
try
{
_visualStudioContext = await _instanceFactory.GetNewOrUsedInstanceAsync(SharedIntegrationHostFixture.RequiredPackageIds).ConfigureAwait(false);
_visualStudioContext.Instance.ActivateMainWindow();
}
catch
{
_messageFilter.Dispose();
throw;
}
}
/// <summary>
/// This method implements <see cref="IAsyncLifetime.DisposeAsync"/>, and is used for releasing resources
/// created by <see cref="IAsyncLifetime.InitializeAsync"/>. This method is only called if
/// <see cref="InitializeAsync"/> completes successfully.
/// </summary>
public virtual Task DisposeAsync()
{
if (VisualStudio?.Editor.IsCompletionActive() ?? false)
{
// Make sure completion isn't visible.
// 🐛 Only needed as a workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/801435
VisualStudio.SendKeys.Send(VirtualKey.Escape);
}
_visualStudioContext.Dispose();
return Task.CompletedTask;
}
protected virtual MessageFilter RegisterMessageFilter()
=> new MessageFilter();
protected void Wait(double seconds)
{
var timeout = TimeSpan.FromMilliseconds(seconds * 1000);
Thread.Sleep(timeout);
}
/// <summary>
/// This method provides the implementation for <see cref="IDisposable.Dispose"/>.
/// This method is called via the <see cref="IDisposable"/> interface if the constructor completes successfully.
/// The <see cref="InitializeAsync"/> may or may not have completed successfully.
/// </summary>
public virtual void Dispose()
{
_messageFilter.Dispose();
}
protected KeyPress Ctrl(VirtualKey virtualKey)
=> new KeyPress(virtualKey, ShiftState.Ctrl);
protected KeyPress Shift(VirtualKey virtualKey)
=> new KeyPress(virtualKey, ShiftState.Shift);
protected KeyPress Alt(VirtualKey virtualKey)
=> new KeyPress(virtualKey, ShiftState.Alt);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Harness;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input;
using Xunit;
using Xunit.Abstractions;
namespace Roslyn.VisualStudio.IntegrationTests
{
[CaptureTestName]
public abstract class AbstractIntegrationTest : IAsyncLifetime, IDisposable
{
protected const string ProjectName = "TestProj";
protected const string SolutionName = "TestSolution";
private readonly MessageFilter _messageFilter;
private readonly VisualStudioInstanceFactory _instanceFactory;
private VisualStudioInstanceContext _visualStudioContext;
protected AbstractIntegrationTest(VisualStudioInstanceFactory instanceFactory)
{
Assert.Equal(ApartmentState.STA, Thread.CurrentThread.GetApartmentState());
// Install a COM message filter to handle retry operations when the first attempt fails
_messageFilter = RegisterMessageFilter();
_instanceFactory = instanceFactory;
try
{
Helper.Automation.TransactionTimeout = 20000;
}
catch
{
_messageFilter.Dispose();
_messageFilter = null;
throw;
}
}
public VisualStudioInstance VisualStudio => _visualStudioContext?.Instance;
public virtual async Task InitializeAsync()
{
try
{
_visualStudioContext = await _instanceFactory.GetNewOrUsedInstanceAsync(SharedIntegrationHostFixture.RequiredPackageIds).ConfigureAwait(false);
_visualStudioContext.Instance.ActivateMainWindow();
}
catch
{
_messageFilter.Dispose();
throw;
}
}
/// <summary>
/// This method implements <see cref="IAsyncLifetime.DisposeAsync"/>, and is used for releasing resources
/// created by <see cref="IAsyncLifetime.InitializeAsync"/>. This method is only called if
/// <see cref="InitializeAsync"/> completes successfully.
/// </summary>
public virtual Task DisposeAsync()
{
if (VisualStudio?.Editor.IsCompletionActive() ?? false)
{
// Make sure completion isn't visible.
// 🐛 Only needed as a workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/801435
VisualStudio.SendKeys.Send(VirtualKey.Escape);
}
_visualStudioContext.Dispose();
return Task.CompletedTask;
}
protected virtual MessageFilter RegisterMessageFilter()
=> new MessageFilter();
protected void Wait(double seconds)
{
var timeout = TimeSpan.FromMilliseconds(seconds * 1000);
Thread.Sleep(timeout);
}
/// <summary>
/// This method provides the implementation for <see cref="IDisposable.Dispose"/>.
/// This method is called via the <see cref="IDisposable"/> interface if the constructor completes successfully.
/// The <see cref="InitializeAsync"/> may or may not have completed successfully.
/// </summary>
public virtual void Dispose()
{
_messageFilter.Dispose();
}
protected KeyPress Ctrl(VirtualKey virtualKey)
=> new KeyPress(virtualKey, ShiftState.Ctrl);
protected KeyPress Shift(VirtualKey virtualKey)
=> new KeyPress(virtualKey, ShiftState.Shift);
protected KeyPress Alt(VirtualKey virtualKey)
=> new KeyPress(virtualKey, ShiftState.Alt);
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Workspaces/CoreTest/UtilityTest/SourceTextSerializationTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
[UseExportProvider]
public class SourceTextSerializationTests
{
[Fact]
public void TestSourceTextSerialization()
{
using var workspace = new AdhocWorkspace();
var textService = Assert.IsType<TextFactoryService>(workspace.Services.GetService<ITextFactoryService>());
var maxSize = SourceTextExtensions.SourceTextLengthThreshold * 3;
var sb = new StringBuilder(0, maxSize);
for (var i = 0; i < maxSize; i++)
{
var originalText = CreateSourceText(sb, i);
using var stream = SerializableBytes.CreateWritableStream();
using (var writer = new ObjectWriter(stream, leaveOpen: true))
{
originalText.WriteTo(writer, CancellationToken.None);
}
stream.Position = 0;
using var reader = ObjectReader.TryGetReader(stream);
var recovered = SourceTextExtensions.ReadFrom(textService, reader, originalText.Encoding, CancellationToken.None);
Assert.Equal(originalText.ToString(), recovered.ToString());
}
}
private static SourceText CreateSourceText(StringBuilder sb, int size)
{
for (var i = sb.Length; i < size; i++)
{
sb.Append((char)('0' + (i % 10)));
}
return SourceText.From(sb.ToString());
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
[UseExportProvider]
public class SourceTextSerializationTests
{
[Fact]
public void TestSourceTextSerialization()
{
using var workspace = new AdhocWorkspace();
var textService = Assert.IsType<TextFactoryService>(workspace.Services.GetService<ITextFactoryService>());
var maxSize = SourceTextExtensions.SourceTextLengthThreshold * 3;
var sb = new StringBuilder(0, maxSize);
for (var i = 0; i < maxSize; i++)
{
var originalText = CreateSourceText(sb, i);
using var stream = SerializableBytes.CreateWritableStream();
using (var writer = new ObjectWriter(stream, leaveOpen: true))
{
originalText.WriteTo(writer, CancellationToken.None);
}
stream.Position = 0;
using var reader = ObjectReader.TryGetReader(stream);
var recovered = SourceTextExtensions.ReadFrom(textService, reader, originalText.Encoding, CancellationToken.None);
Assert.Equal(originalText.ToString(), recovered.ToString());
}
}
private static SourceText CreateSourceText(StringBuilder sb, int size)
{
for (var i = sb.Length; i < size; i++)
{
sb.Append((char)('0' + (i % 10)));
}
return SourceText.From(sb.ToString());
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./eng/config/test/Desktop/app.config | <?xml version="1.0" encoding="utf-8"?>
<!-- The default app.config for test projects that do not specify one -->
<configuration>
<system.diagnostics>
<trace>
<listeners>
<remove name="Default" />
<add name="ThrowingTraceListener" type="Microsoft.CodeAnalysis.ThrowingTraceListener, Microsoft.CodeAnalysis.Test.Utilities" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
| <?xml version="1.0" encoding="utf-8"?>
<!-- The default app.config for test projects that do not specify one -->
<configuration>
<system.diagnostics>
<trace>
<listeners>
<remove name="Default" />
<add name="ThrowingTraceListener" type="Microsoft.CodeAnalysis.ThrowingTraceListener, Microsoft.CodeAnalysis.Test.Utilities" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Workspaces/Remote/ServiceHub/Host/TestUtils.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Serialization;
#if DEBUG
using System.Diagnostics;
using System.Text;
using Microsoft.CodeAnalysis.Internal.Log;
#endif
namespace Microsoft.CodeAnalysis.Remote
{
internal static class TestUtils
{
public static void RemoveChecksums(this Dictionary<Checksum, object> map, ChecksumWithChildren checksums)
{
var set = new HashSet<Checksum>();
set.AppendChecksums(checksums);
RemoveChecksums(map, set);
}
public static void RemoveChecksums(this Dictionary<Checksum, object> map, IEnumerable<Checksum> checksums)
{
foreach (var checksum in checksums)
{
map.Remove(checksum);
}
}
internal static async Task AssertChecksumsAsync(
AssetProvider assetService,
Checksum checksumFromRequest,
Solution solutionFromScratch,
Solution incrementalSolutionBuilt)
{
#if DEBUG
var sb = new StringBuilder();
var allChecksumsFromRequest = await GetAllChildrenChecksumsAsync(checksumFromRequest).ConfigureAwait(false);
var assetMapFromNewSolution = await solutionFromScratch.GetAssetMapAsync(includeProjectCones: true, CancellationToken.None).ConfigureAwait(false);
var assetMapFromIncrementalSolution = await incrementalSolutionBuilt.GetAssetMapAsync(includeProjectCones: true, CancellationToken.None).ConfigureAwait(false);
// check 4 things
// 1. first see if we create new solution from scratch, it works as expected (indicating a bug in incremental update)
var mismatch1 = assetMapFromNewSolution.Where(p => !allChecksumsFromRequest.Contains(p.Key)).ToList();
AppendMismatch(mismatch1, "assets only in new solutoin but not in the request", sb);
// 2. second check what items is mismatching for incremental solution
var mismatch2 = assetMapFromIncrementalSolution.Where(p => !allChecksumsFromRequest.Contains(p.Key)).ToList();
AppendMismatch(mismatch2, "assets only in the incremental solution but not in the request", sb);
// 3. check whether solution created from scratch and incremental one have any mismatch
var mismatch3 = assetMapFromNewSolution.Where(p => !assetMapFromIncrementalSolution.ContainsKey(p.Key)).ToList();
AppendMismatch(mismatch3, "assets only in new solution but not in incremental solution", sb);
var mismatch4 = assetMapFromIncrementalSolution.Where(p => !assetMapFromNewSolution.ContainsKey(p.Key)).ToList();
AppendMismatch(mismatch4, "assets only in incremental solution but not in new solution", sb);
// 4. see what item is missing from request
var mismatch5 = await GetAssetFromAssetServiceAsync(allChecksumsFromRequest.Except(assetMapFromNewSolution.Keys)).ConfigureAwait(false);
AppendMismatch(mismatch5, "assets only in the request but not in new solution", sb);
var mismatch6 = await GetAssetFromAssetServiceAsync(allChecksumsFromRequest.Except(assetMapFromIncrementalSolution.Keys)).ConfigureAwait(false);
AppendMismatch(mismatch6, "assets only in the request but not in incremental solution", sb);
var result = sb.ToString();
if (result.Length > 0)
{
Logger.Log(FunctionId.SolutionCreator_AssetDifferences, result);
Debug.Fail("Differences detected in solution checksum: " + result);
}
static void AppendMismatch(List<KeyValuePair<Checksum, object>> items, string title, StringBuilder stringBuilder)
{
if (items.Count == 0)
{
return;
}
stringBuilder.AppendLine(title);
foreach (var kv in items)
{
stringBuilder.AppendLine($"{kv.Key.ToString()}, {kv.Value.ToString()}");
}
stringBuilder.AppendLine();
}
async Task<List<KeyValuePair<Checksum, object>>> GetAssetFromAssetServiceAsync(IEnumerable<Checksum> checksums)
{
var items = new List<KeyValuePair<Checksum, object>>();
foreach (var checksum in checksums)
{
items.Add(new KeyValuePair<Checksum, object>(checksum, await assetService.GetAssetAsync<object>(checksum, CancellationToken.None).ConfigureAwait(false)));
}
return items;
}
async Task<HashSet<Checksum>> GetAllChildrenChecksumsAsync(Checksum solutionChecksum)
{
var set = new HashSet<Checksum>();
var solutionChecksums = await assetService.GetAssetAsync<SolutionStateChecksums>(solutionChecksum, CancellationToken.None).ConfigureAwait(false);
set.AppendChecksums(solutionChecksums);
foreach (var projectChecksum in solutionChecksums.Projects)
{
var projectChecksums = await assetService.GetAssetAsync<ProjectStateChecksums>(projectChecksum, CancellationToken.None).ConfigureAwait(false);
set.AppendChecksums(projectChecksums);
foreach (var documentChecksum in projectChecksums.Documents.Concat(projectChecksums.AdditionalDocuments).Concat(projectChecksums.AnalyzerConfigDocuments))
{
var documentChecksums = await assetService.GetAssetAsync<DocumentStateChecksums>(documentChecksum, CancellationToken.None).ConfigureAwait(false);
set.AppendChecksums(documentChecksums);
}
}
return set;
}
#else
// have this to avoid error on async
await Task.CompletedTask.ConfigureAwait(false);
#endif
}
/// <summary>
/// create checksum to correspoing object map from solution
/// this map should contain every parts of solution that can be used to re-create the solution back
/// </summary>
public static async Task<Dictionary<Checksum, object>> GetAssetMapAsync(this Solution solution, bool includeProjectCones, CancellationToken cancellationToken)
{
var map = new Dictionary<Checksum, object>();
await solution.AppendAssetMapAsync(includeProjectCones, map, cancellationToken).ConfigureAwait(false);
return map;
}
/// <summary>
/// create checksum to correspoing object map from project
/// this map should contain every parts of project that can be used to re-create the project back
/// </summary>
public static async Task<Dictionary<Checksum, object>> GetAssetMapAsync(this Project project, CancellationToken cancellationToken)
{
var map = new Dictionary<Checksum, object>();
await project.AppendAssetMapAsync(map, cancellationToken).ConfigureAwait(false);
return map;
}
public static async Task AppendAssetMapAsync(this Solution solution, bool includeProjectCones, Dictionary<Checksum, object> map, CancellationToken cancellationToken)
{
var solutionChecksums = await solution.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
await solutionChecksums.FindAsync(solution.State, Flatten(solutionChecksums), map, cancellationToken).ConfigureAwait(false);
foreach (var project in solution.Projects)
{
if (includeProjectCones)
{
var projectSubsetChecksums = await solution.State.GetStateChecksumsAsync(project.Id, cancellationToken).ConfigureAwait(false);
await projectSubsetChecksums.FindAsync(solution.State, Flatten(projectSubsetChecksums), map, cancellationToken).ConfigureAwait(false);
}
await project.AppendAssetMapAsync(map, cancellationToken).ConfigureAwait(false);
}
}
private static async Task AppendAssetMapAsync(this Project project, Dictionary<Checksum, object> map, CancellationToken cancellationToken)
{
if (!RemoteSupportedLanguages.IsSupported(project.Language))
{
return;
}
var projectChecksums = await project.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
await projectChecksums.FindAsync(project.State, Flatten(projectChecksums), map, cancellationToken).ConfigureAwait(false);
foreach (var document in project.Documents.Concat(project.AdditionalDocuments).Concat(project.AnalyzerConfigDocuments))
{
var documentChecksums = await document.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
await documentChecksums.FindAsync(document.State, Flatten(documentChecksums), map, cancellationToken).ConfigureAwait(false);
}
}
private static HashSet<Checksum> Flatten(ChecksumWithChildren checksums)
{
var set = new HashSet<Checksum>();
set.AppendChecksums(checksums);
return set;
}
public static void AppendChecksums(this HashSet<Checksum> set, ChecksumWithChildren checksums)
{
set.Add(checksums.Checksum);
foreach (var child in checksums.Children)
{
if (child is Checksum checksum)
{
if (checksum != Checksum.Null)
set.Add(checksum);
}
if (child is ChecksumCollection collection)
{
set.AppendChecksums(collection);
}
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Serialization;
#if DEBUG
using System.Diagnostics;
using System.Text;
using Microsoft.CodeAnalysis.Internal.Log;
#endif
namespace Microsoft.CodeAnalysis.Remote
{
internal static class TestUtils
{
public static void RemoveChecksums(this Dictionary<Checksum, object> map, ChecksumWithChildren checksums)
{
var set = new HashSet<Checksum>();
set.AppendChecksums(checksums);
RemoveChecksums(map, set);
}
public static void RemoveChecksums(this Dictionary<Checksum, object> map, IEnumerable<Checksum> checksums)
{
foreach (var checksum in checksums)
{
map.Remove(checksum);
}
}
internal static async Task AssertChecksumsAsync(
AssetProvider assetService,
Checksum checksumFromRequest,
Solution solutionFromScratch,
Solution incrementalSolutionBuilt)
{
#if DEBUG
var sb = new StringBuilder();
var allChecksumsFromRequest = await GetAllChildrenChecksumsAsync(checksumFromRequest).ConfigureAwait(false);
var assetMapFromNewSolution = await solutionFromScratch.GetAssetMapAsync(includeProjectCones: true, CancellationToken.None).ConfigureAwait(false);
var assetMapFromIncrementalSolution = await incrementalSolutionBuilt.GetAssetMapAsync(includeProjectCones: true, CancellationToken.None).ConfigureAwait(false);
// check 4 things
// 1. first see if we create new solution from scratch, it works as expected (indicating a bug in incremental update)
var mismatch1 = assetMapFromNewSolution.Where(p => !allChecksumsFromRequest.Contains(p.Key)).ToList();
AppendMismatch(mismatch1, "assets only in new solutoin but not in the request", sb);
// 2. second check what items is mismatching for incremental solution
var mismatch2 = assetMapFromIncrementalSolution.Where(p => !allChecksumsFromRequest.Contains(p.Key)).ToList();
AppendMismatch(mismatch2, "assets only in the incremental solution but not in the request", sb);
// 3. check whether solution created from scratch and incremental one have any mismatch
var mismatch3 = assetMapFromNewSolution.Where(p => !assetMapFromIncrementalSolution.ContainsKey(p.Key)).ToList();
AppendMismatch(mismatch3, "assets only in new solution but not in incremental solution", sb);
var mismatch4 = assetMapFromIncrementalSolution.Where(p => !assetMapFromNewSolution.ContainsKey(p.Key)).ToList();
AppendMismatch(mismatch4, "assets only in incremental solution but not in new solution", sb);
// 4. see what item is missing from request
var mismatch5 = await GetAssetFromAssetServiceAsync(allChecksumsFromRequest.Except(assetMapFromNewSolution.Keys)).ConfigureAwait(false);
AppendMismatch(mismatch5, "assets only in the request but not in new solution", sb);
var mismatch6 = await GetAssetFromAssetServiceAsync(allChecksumsFromRequest.Except(assetMapFromIncrementalSolution.Keys)).ConfigureAwait(false);
AppendMismatch(mismatch6, "assets only in the request but not in incremental solution", sb);
var result = sb.ToString();
if (result.Length > 0)
{
Logger.Log(FunctionId.SolutionCreator_AssetDifferences, result);
Debug.Fail("Differences detected in solution checksum: " + result);
}
static void AppendMismatch(List<KeyValuePair<Checksum, object>> items, string title, StringBuilder stringBuilder)
{
if (items.Count == 0)
{
return;
}
stringBuilder.AppendLine(title);
foreach (var kv in items)
{
stringBuilder.AppendLine($"{kv.Key.ToString()}, {kv.Value.ToString()}");
}
stringBuilder.AppendLine();
}
async Task<List<KeyValuePair<Checksum, object>>> GetAssetFromAssetServiceAsync(IEnumerable<Checksum> checksums)
{
var items = new List<KeyValuePair<Checksum, object>>();
foreach (var checksum in checksums)
{
items.Add(new KeyValuePair<Checksum, object>(checksum, await assetService.GetAssetAsync<object>(checksum, CancellationToken.None).ConfigureAwait(false)));
}
return items;
}
async Task<HashSet<Checksum>> GetAllChildrenChecksumsAsync(Checksum solutionChecksum)
{
var set = new HashSet<Checksum>();
var solutionChecksums = await assetService.GetAssetAsync<SolutionStateChecksums>(solutionChecksum, CancellationToken.None).ConfigureAwait(false);
set.AppendChecksums(solutionChecksums);
foreach (var projectChecksum in solutionChecksums.Projects)
{
var projectChecksums = await assetService.GetAssetAsync<ProjectStateChecksums>(projectChecksum, CancellationToken.None).ConfigureAwait(false);
set.AppendChecksums(projectChecksums);
foreach (var documentChecksum in projectChecksums.Documents.Concat(projectChecksums.AdditionalDocuments).Concat(projectChecksums.AnalyzerConfigDocuments))
{
var documentChecksums = await assetService.GetAssetAsync<DocumentStateChecksums>(documentChecksum, CancellationToken.None).ConfigureAwait(false);
set.AppendChecksums(documentChecksums);
}
}
return set;
}
#else
// have this to avoid error on async
await Task.CompletedTask.ConfigureAwait(false);
#endif
}
/// <summary>
/// create checksum to correspoing object map from solution
/// this map should contain every parts of solution that can be used to re-create the solution back
/// </summary>
public static async Task<Dictionary<Checksum, object>> GetAssetMapAsync(this Solution solution, bool includeProjectCones, CancellationToken cancellationToken)
{
var map = new Dictionary<Checksum, object>();
await solution.AppendAssetMapAsync(includeProjectCones, map, cancellationToken).ConfigureAwait(false);
return map;
}
/// <summary>
/// create checksum to correspoing object map from project
/// this map should contain every parts of project that can be used to re-create the project back
/// </summary>
public static async Task<Dictionary<Checksum, object>> GetAssetMapAsync(this Project project, CancellationToken cancellationToken)
{
var map = new Dictionary<Checksum, object>();
await project.AppendAssetMapAsync(map, cancellationToken).ConfigureAwait(false);
return map;
}
public static async Task AppendAssetMapAsync(this Solution solution, bool includeProjectCones, Dictionary<Checksum, object> map, CancellationToken cancellationToken)
{
var solutionChecksums = await solution.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
await solutionChecksums.FindAsync(solution.State, Flatten(solutionChecksums), map, cancellationToken).ConfigureAwait(false);
foreach (var project in solution.Projects)
{
if (includeProjectCones)
{
var projectSubsetChecksums = await solution.State.GetStateChecksumsAsync(project.Id, cancellationToken).ConfigureAwait(false);
await projectSubsetChecksums.FindAsync(solution.State, Flatten(projectSubsetChecksums), map, cancellationToken).ConfigureAwait(false);
}
await project.AppendAssetMapAsync(map, cancellationToken).ConfigureAwait(false);
}
}
private static async Task AppendAssetMapAsync(this Project project, Dictionary<Checksum, object> map, CancellationToken cancellationToken)
{
if (!RemoteSupportedLanguages.IsSupported(project.Language))
{
return;
}
var projectChecksums = await project.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
await projectChecksums.FindAsync(project.State, Flatten(projectChecksums), map, cancellationToken).ConfigureAwait(false);
foreach (var document in project.Documents.Concat(project.AdditionalDocuments).Concat(project.AnalyzerConfigDocuments))
{
var documentChecksums = await document.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
await documentChecksums.FindAsync(document.State, Flatten(documentChecksums), map, cancellationToken).ConfigureAwait(false);
}
}
private static HashSet<Checksum> Flatten(ChecksumWithChildren checksums)
{
var set = new HashSet<Checksum>();
set.AppendChecksums(checksums);
return set;
}
public static void AppendChecksums(this HashSet<Checksum> set, ChecksumWithChildren checksums)
{
set.Add(checksums.Checksum);
foreach (var child in checksums.Children)
{
if (child is Checksum checksum)
{
if (checksum != Checksum.Null)
set.Add(checksum);
}
if (child is ChecksumCollection collection)
{
set.AppendChecksums(collection);
}
}
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Workspaces/Core/Portable/Options/EditorConfig/EditorConfigFileGenerator.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis.Simplification;
namespace Microsoft.CodeAnalysis.Options
{
internal static partial class EditorConfigFileGenerator
{
public static string Generate(
ImmutableArray<(string feature, ImmutableArray<IOption> options)> groupedOptions,
OptionSet optionSet,
string language)
{
var editorconfig = new StringBuilder();
editorconfig.AppendLine($"# {WorkspacesResources.Remove_the_line_below_if_you_want_to_inherit_dot_editorconfig_settings_from_higher_directories}");
editorconfig.AppendLine("root = true");
editorconfig.AppendLine();
if (language == LanguageNames.CSharp)
{
editorconfig.AppendLine($"# {WorkspacesResources.CSharp_files}");
editorconfig.AppendLine("[*.cs]");
}
else if (language == LanguageNames.VisualBasic)
{
editorconfig.AppendLine($"# {WorkspacesResources.Visual_Basic_files}");
editorconfig.AppendLine("[*.vb]");
}
editorconfig.AppendLine();
foreach ((var feature, var options) in groupedOptions)
{
AppendOptionsToEditorConfig(optionSet, feature, options, language, editorconfig);
}
var namingStylePreferences = optionSet.GetOption(NamingStyleOptions.NamingPreferences, language);
AppendNamingStylePreferencesToEditorConfig(namingStylePreferences, language, editorconfig);
return editorconfig.ToString();
}
private static void AppendOptionsToEditorConfig(OptionSet optionSet, string feature, ImmutableArray<IOption> options, string language, StringBuilder editorconfig)
{
editorconfig.AppendLine($"#### {feature} ####");
editorconfig.AppendLine();
foreach (var optionGrouping in options
.Where(o => o.StorageLocations.Any(l => l is IEditorConfigStorageLocation2))
.GroupBy(o => (o as IOptionWithGroup)?.Group ?? OptionGroup.Default)
.OrderBy(g => g.Key.Priority))
{
editorconfig.AppendLine($"# {optionGrouping.Key.Description}");
var optionsAndEditorConfigLocations = optionGrouping.Select(o => (o, o.StorageLocations.OfType<IEditorConfigStorageLocation2>().First()));
var uniqueEntries = new SortedSet<string>();
foreach ((var option, var editorConfigLocation) in optionsAndEditorConfigLocations)
{
var editorConfigString = GetEditorConfigString(option, editorConfigLocation);
uniqueEntries.Add(editorConfigString);
}
foreach (var entry in uniqueEntries)
{
editorconfig.AppendLine(entry);
}
editorconfig.AppendLine();
}
string GetEditorConfigString(IOption option, IEditorConfigStorageLocation2 editorConfigLocation)
{
var optionKey = new OptionKey(option, option.IsPerLanguage ? language : null);
var value = optionSet.GetOption(optionKey);
var editorConfigString = editorConfigLocation.GetEditorConfigString(value, optionSet);
Debug.Assert(!string.IsNullOrEmpty(editorConfigString));
return editorConfigString;
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis.Simplification;
namespace Microsoft.CodeAnalysis.Options
{
internal static partial class EditorConfigFileGenerator
{
public static string Generate(
ImmutableArray<(string feature, ImmutableArray<IOption> options)> groupedOptions,
OptionSet optionSet,
string language)
{
var editorconfig = new StringBuilder();
editorconfig.AppendLine($"# {WorkspacesResources.Remove_the_line_below_if_you_want_to_inherit_dot_editorconfig_settings_from_higher_directories}");
editorconfig.AppendLine("root = true");
editorconfig.AppendLine();
if (language == LanguageNames.CSharp)
{
editorconfig.AppendLine($"# {WorkspacesResources.CSharp_files}");
editorconfig.AppendLine("[*.cs]");
}
else if (language == LanguageNames.VisualBasic)
{
editorconfig.AppendLine($"# {WorkspacesResources.Visual_Basic_files}");
editorconfig.AppendLine("[*.vb]");
}
editorconfig.AppendLine();
foreach ((var feature, var options) in groupedOptions)
{
AppendOptionsToEditorConfig(optionSet, feature, options, language, editorconfig);
}
var namingStylePreferences = optionSet.GetOption(NamingStyleOptions.NamingPreferences, language);
AppendNamingStylePreferencesToEditorConfig(namingStylePreferences, language, editorconfig);
return editorconfig.ToString();
}
private static void AppendOptionsToEditorConfig(OptionSet optionSet, string feature, ImmutableArray<IOption> options, string language, StringBuilder editorconfig)
{
editorconfig.AppendLine($"#### {feature} ####");
editorconfig.AppendLine();
foreach (var optionGrouping in options
.Where(o => o.StorageLocations.Any(l => l is IEditorConfigStorageLocation2))
.GroupBy(o => (o as IOptionWithGroup)?.Group ?? OptionGroup.Default)
.OrderBy(g => g.Key.Priority))
{
editorconfig.AppendLine($"# {optionGrouping.Key.Description}");
var optionsAndEditorConfigLocations = optionGrouping.Select(o => (o, o.StorageLocations.OfType<IEditorConfigStorageLocation2>().First()));
var uniqueEntries = new SortedSet<string>();
foreach ((var option, var editorConfigLocation) in optionsAndEditorConfigLocations)
{
var editorConfigString = GetEditorConfigString(option, editorConfigLocation);
uniqueEntries.Add(editorConfigString);
}
foreach (var entry in uniqueEntries)
{
editorconfig.AppendLine(entry);
}
editorconfig.AppendLine();
}
string GetEditorConfigString(IOption option, IEditorConfigStorageLocation2 editorConfigLocation)
{
var optionKey = new OptionKey(option, option.IsPerLanguage ? language : null);
var value = optionSet.GetOption(optionKey);
var editorConfigString = editorConfigLocation.GetEditorConfigString(value, optionSet);
Debug.Assert(!string.IsNullOrEmpty(editorConfigString));
return editorConfigString;
}
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Interactive/HostTest/InteractiveHostCoreTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
extern alias InteractiveHost;
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using static Roslyn.Test.Utilities.TestMetadata;
namespace Microsoft.CodeAnalysis.UnitTests.Interactive
{
using InteractiveHost::Microsoft.CodeAnalysis.Interactive;
[Trait(Traits.Feature, Traits.Features.InteractiveHost)]
public sealed class InteractiveHostCoreTests : AbstractInteractiveHostTests
{
internal override InteractiveHostPlatform DefaultPlatform => InteractiveHostPlatform.Core;
internal override bool UseDefaultInitializationFile => false;
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/53392")]
public async Task StackOverflow()
{
var process = Host.TryGetProcess();
await Execute(@"
int goo(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9)
{
return goo(0,1,2,3,4,5,6,7,8,9) + goo(0,1,2,3,4,5,6,7,8,9);
}
goo(0,1,2,3,4,5,6,7,8,9)
");
var output = await ReadOutputToEnd();
Assert.Equal("", output);
// Hosting process exited with exit code ###.
var errorOutput = (await ReadErrorOutputToEnd()).Trim();
Assert.True(errorOutput.StartsWith("Stack overflow.\n"));
Assert.True(errorOutput.EndsWith(string.Format(InteractiveHostResources.Hosting_process_exited_with_exit_code_0, process!.ExitCode)));
await Execute(@"1+1");
output = await ReadOutputToEnd();
Assert.Equal("2\r\n", output.ToString());
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
extern alias InteractiveHost;
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using static Roslyn.Test.Utilities.TestMetadata;
namespace Microsoft.CodeAnalysis.UnitTests.Interactive
{
using InteractiveHost::Microsoft.CodeAnalysis.Interactive;
[Trait(Traits.Feature, Traits.Features.InteractiveHost)]
public sealed class InteractiveHostCoreTests : AbstractInteractiveHostTests
{
internal override InteractiveHostPlatform DefaultPlatform => InteractiveHostPlatform.Core;
internal override bool UseDefaultInitializationFile => false;
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/53392")]
public async Task StackOverflow()
{
var process = Host.TryGetProcess();
await Execute(@"
int goo(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9)
{
return goo(0,1,2,3,4,5,6,7,8,9) + goo(0,1,2,3,4,5,6,7,8,9);
}
goo(0,1,2,3,4,5,6,7,8,9)
");
var output = await ReadOutputToEnd();
Assert.Equal("", output);
// Hosting process exited with exit code ###.
var errorOutput = (await ReadErrorOutputToEnd()).Trim();
Assert.True(errorOutput.StartsWith("Stack overflow.\n"));
Assert.True(errorOutput.EndsWith(string.Format(InteractiveHostResources.Hosting_process_exited_with_exit_code_0, process!.ExitCode)));
await Execute(@"1+1");
output = await ReadOutputToEnd();
Assert.Equal("2\r\n", output.ToString());
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/CSharp/Portable/Syntax/InternalSyntax/TypeSyntax.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
{
internal abstract partial class TypeSyntax
{
public bool IsVar => IsIdentifierName("var");
public bool IsUnmanaged => IsIdentifierName("unmanaged");
public bool IsNotNull => IsIdentifierName("notnull");
public bool IsNint => IsIdentifierName("nint");
public bool IsNuint => IsIdentifierName("nuint");
private bool IsIdentifierName(string id) => this is IdentifierNameSyntax name && name.Identifier.ToString() == id;
public bool IsRef => Kind == SyntaxKind.RefType;
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
{
internal abstract partial class TypeSyntax
{
public bool IsVar => IsIdentifierName("var");
public bool IsUnmanaged => IsIdentifierName("unmanaged");
public bool IsNotNull => IsIdentifierName("notnull");
public bool IsNint => IsIdentifierName("nint");
public bool IsNuint => IsIdentifierName("nuint");
private bool IsIdentifierName(string id) => this is IdentifierNameSyntax name && name.Identifier.ToString() == id;
public bool IsRef => Kind == SyntaxKind.RefType;
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeRefactorings
{
[Export(typeof(ICodeRefactoringService)), Shared]
internal class CodeRefactoringService : ICodeRefactoringService
{
private readonly Lazy<ImmutableDictionary<string, Lazy<ImmutableArray<CodeRefactoringProvider>>>> _lazyLanguageToProvidersMap;
private readonly Lazy<ImmutableDictionary<CodeRefactoringProvider, CodeChangeProviderMetadata>> _lazyRefactoringToMetadataMap;
private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableArray<CodeRefactoringProvider>>> _projectRefactoringsMap = new();
private readonly ConditionalWeakTable<AnalyzerReference, ProjectCodeRefactoringProvider> _analyzerReferenceToRefactoringsMap = new();
private readonly ConditionalWeakTable<AnalyzerReference, ProjectCodeRefactoringProvider>.CreateValueCallback _createProjectCodeRefactoringsProvider
= new(r => new ProjectCodeRefactoringProvider(r));
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CodeRefactoringService(
[ImportMany] IEnumerable<Lazy<CodeRefactoringProvider, CodeChangeProviderMetadata>> providers)
{
// convert set of all code refactoring providers into a map from language to a lazy initialized list of ordered providers.
_lazyLanguageToProvidersMap = new Lazy<ImmutableDictionary<string, Lazy<ImmutableArray<CodeRefactoringProvider>>>>(
() =>
ImmutableDictionary.CreateRange(
DistributeLanguages(providers)
.GroupBy(lz => lz.Metadata.Language)
.Select(grp => new KeyValuePair<string, Lazy<ImmutableArray<CodeRefactoringProvider>>>(
grp.Key,
new Lazy<ImmutableArray<CodeRefactoringProvider>>(() => ExtensionOrderer.Order(grp).Select(lz => lz.Value).ToImmutableArray())))));
_lazyRefactoringToMetadataMap = new(() => providers.Where(provider => provider.IsValueCreated).ToImmutableDictionary(provider => provider.Value, provider => provider.Metadata));
}
private static IEnumerable<Lazy<CodeRefactoringProvider, OrderableLanguageMetadata>> DistributeLanguages(IEnumerable<Lazy<CodeRefactoringProvider, CodeChangeProviderMetadata>> providers)
{
foreach (var provider in providers)
{
foreach (var language in provider.Metadata.Languages)
{
var orderable = new OrderableLanguageMetadata(
provider.Metadata.Name, language, provider.Metadata.AfterTyped, provider.Metadata.BeforeTyped);
yield return new Lazy<CodeRefactoringProvider, OrderableLanguageMetadata>(() => provider.Value, orderable);
}
}
}
private ImmutableDictionary<string, Lazy<ImmutableArray<CodeRefactoringProvider>>> LanguageToProvidersMap
=> _lazyLanguageToProvidersMap.Value;
private ImmutableDictionary<CodeRefactoringProvider, CodeChangeProviderMetadata> RefactoringToMetadataMap
=> _lazyRefactoringToMetadataMap.Value;
private ConcatImmutableArray<CodeRefactoringProvider> GetProviders(Document document)
{
var allRefactorings = ImmutableArray<CodeRefactoringProvider>.Empty;
if (LanguageToProvidersMap.TryGetValue(document.Project.Language, out var lazyProviders))
{
allRefactorings = lazyProviders.Value;
}
return allRefactorings.ConcatFast(GetProjectRefactorings(document.Project));
}
public async Task<bool> HasRefactoringsAsync(
Document document,
TextSpan state,
CancellationToken cancellationToken)
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
foreach (var provider in GetProviders(document))
{
cancellationToken.ThrowIfCancellationRequested();
RefactoringToMetadataMap.TryGetValue(provider, out var providerMetadata);
var refactoring = await GetRefactoringFromProviderAsync(
document, state, provider, providerMetadata, extensionManager, isBlocking: false, cancellationToken).ConfigureAwait(false);
if (refactoring != null)
{
return true;
}
}
return false;
}
public async Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(
Document document,
TextSpan state,
CodeActionRequestPriority priority,
bool isBlocking,
Func<string, IDisposable?> addOperationScope,
CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.Refactoring_CodeRefactoringService_GetRefactoringsAsync, cancellationToken))
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
using var _ = ArrayBuilder<Task<CodeRefactoring?>>.GetInstance(out var tasks);
foreach (var provider in GetProviders(document))
{
if (priority != CodeActionRequestPriority.None && priority != provider.RequestPriority)
continue;
tasks.Add(Task.Run(() =>
{
var providerName = provider.GetType().Name;
RefactoringToMetadataMap.TryGetValue(provider, out var providerMetadata);
using (addOperationScope(providerName))
using (RoslynEventSource.LogInformationalBlock(FunctionId.Refactoring_CodeRefactoringService_GetRefactoringsAsync, providerName, cancellationToken))
{
return GetRefactoringFromProviderAsync(document, state, provider, providerMetadata, extensionManager, isBlocking, cancellationToken);
}
},
cancellationToken));
}
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
return results.WhereNotNull().ToImmutableArray();
}
}
private static async Task<CodeRefactoring?> GetRefactoringFromProviderAsync(
Document document,
TextSpan state,
CodeRefactoringProvider provider,
CodeChangeProviderMetadata? providerMetadata,
IExtensionManager extensionManager,
bool isBlocking,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
if (extensionManager.IsDisabled(provider))
{
return null;
}
try
{
using var _ = ArrayBuilder<(CodeAction action, TextSpan? applicableToSpan)>.GetInstance(out var actions);
var context = new CodeRefactoringContext(document, state,
// TODO: Can we share code between similar lambdas that we pass to this API in BatchFixAllProvider.cs, CodeFixService.cs and CodeRefactoringService.cs?
(action, applicableToSpan) =>
{
// Serialize access for thread safety - we don't know what thread the refactoring provider will call this delegate from.
lock (actions)
{
// Add the Refactoring Provider Name to the parent CodeAction's CustomTags.
// Always add a name even in cases of 3rd party refactorings that do not export
// name metadata.
action.AddCustomTag(providerMetadata?.Name ?? provider.GetTypeDisplayName());
actions.Add((action, applicableToSpan));
}
},
isBlocking,
cancellationToken);
var task = provider.ComputeRefactoringsAsync(context) ?? Task.CompletedTask;
await task.ConfigureAwait(false);
var result = actions.Count > 0
? new CodeRefactoring(provider, actions.ToImmutable())
: null;
return result;
}
catch (OperationCanceledException)
{
// We don't want to catch operation canceled exceptions in the catch block
// below. So catch is here and rethrow it.
throw;
}
catch (Exception e)
{
extensionManager.HandleException(provider, e);
}
return null;
}
private ImmutableArray<CodeRefactoringProvider> GetProjectRefactorings(Project project)
{
// TODO (https://github.com/dotnet/roslyn/issues/4932): Don't restrict refactorings in Interactive
if (project.Solution.Workspace.Kind == WorkspaceKind.Interactive)
{
return ImmutableArray<CodeRefactoringProvider>.Empty;
}
if (_projectRefactoringsMap.TryGetValue(project.AnalyzerReferences, out var refactorings))
{
return refactorings.Value;
}
return GetProjectRefactoringsSlow(project);
// Local functions
ImmutableArray<CodeRefactoringProvider> GetProjectRefactoringsSlow(Project project)
{
return _projectRefactoringsMap.GetValue(project.AnalyzerReferences, pId => new StrongBox<ImmutableArray<CodeRefactoringProvider>>(ComputeProjectRefactorings(project))).Value;
}
ImmutableArray<CodeRefactoringProvider> ComputeProjectRefactorings(Project project)
{
using var _ = ArrayBuilder<CodeRefactoringProvider>.GetInstance(out var builder);
foreach (var reference in project.AnalyzerReferences)
{
var projectCodeRefactoringProvider = _analyzerReferenceToRefactoringsMap.GetValue(reference, _createProjectCodeRefactoringsProvider);
foreach (var refactoring in projectCodeRefactoringProvider.GetExtensions(project.Language))
builder.Add(refactoring);
}
return builder.ToImmutable();
}
}
private class ProjectCodeRefactoringProvider
: AbstractProjectExtensionProvider<CodeRefactoringProvider, ExportCodeRefactoringProviderAttribute>
{
public ProjectCodeRefactoringProvider(AnalyzerReference reference)
: base(reference)
{
}
protected override bool SupportsLanguage(ExportCodeRefactoringProviderAttribute exportAttribute, string language)
{
return exportAttribute.Languages == null
|| exportAttribute.Languages.Length == 0
|| exportAttribute.Languages.Contains(language);
}
protected override bool TryGetExtensionsFromReference(AnalyzerReference reference, out ImmutableArray<CodeRefactoringProvider> extensions)
{
// check whether the analyzer reference knows how to return fixers directly.
if (reference is ICodeRefactoringProviderFactory codeRefactoringProviderFactory)
{
extensions = codeRefactoringProviderFactory.GetRefactorings();
return true;
}
extensions = default;
return false;
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeRefactorings
{
[Export(typeof(ICodeRefactoringService)), Shared]
internal class CodeRefactoringService : ICodeRefactoringService
{
private readonly Lazy<ImmutableDictionary<string, Lazy<ImmutableArray<CodeRefactoringProvider>>>> _lazyLanguageToProvidersMap;
private readonly Lazy<ImmutableDictionary<CodeRefactoringProvider, CodeChangeProviderMetadata>> _lazyRefactoringToMetadataMap;
private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableArray<CodeRefactoringProvider>>> _projectRefactoringsMap = new();
private readonly ConditionalWeakTable<AnalyzerReference, ProjectCodeRefactoringProvider> _analyzerReferenceToRefactoringsMap = new();
private readonly ConditionalWeakTable<AnalyzerReference, ProjectCodeRefactoringProvider>.CreateValueCallback _createProjectCodeRefactoringsProvider
= new(r => new ProjectCodeRefactoringProvider(r));
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CodeRefactoringService(
[ImportMany] IEnumerable<Lazy<CodeRefactoringProvider, CodeChangeProviderMetadata>> providers)
{
// convert set of all code refactoring providers into a map from language to a lazy initialized list of ordered providers.
_lazyLanguageToProvidersMap = new Lazy<ImmutableDictionary<string, Lazy<ImmutableArray<CodeRefactoringProvider>>>>(
() =>
ImmutableDictionary.CreateRange(
DistributeLanguages(providers)
.GroupBy(lz => lz.Metadata.Language)
.Select(grp => new KeyValuePair<string, Lazy<ImmutableArray<CodeRefactoringProvider>>>(
grp.Key,
new Lazy<ImmutableArray<CodeRefactoringProvider>>(() => ExtensionOrderer.Order(grp).Select(lz => lz.Value).ToImmutableArray())))));
_lazyRefactoringToMetadataMap = new(() => providers.Where(provider => provider.IsValueCreated).ToImmutableDictionary(provider => provider.Value, provider => provider.Metadata));
}
private static IEnumerable<Lazy<CodeRefactoringProvider, OrderableLanguageMetadata>> DistributeLanguages(IEnumerable<Lazy<CodeRefactoringProvider, CodeChangeProviderMetadata>> providers)
{
foreach (var provider in providers)
{
foreach (var language in provider.Metadata.Languages)
{
var orderable = new OrderableLanguageMetadata(
provider.Metadata.Name, language, provider.Metadata.AfterTyped, provider.Metadata.BeforeTyped);
yield return new Lazy<CodeRefactoringProvider, OrderableLanguageMetadata>(() => provider.Value, orderable);
}
}
}
private ImmutableDictionary<string, Lazy<ImmutableArray<CodeRefactoringProvider>>> LanguageToProvidersMap
=> _lazyLanguageToProvidersMap.Value;
private ImmutableDictionary<CodeRefactoringProvider, CodeChangeProviderMetadata> RefactoringToMetadataMap
=> _lazyRefactoringToMetadataMap.Value;
private ConcatImmutableArray<CodeRefactoringProvider> GetProviders(Document document)
{
var allRefactorings = ImmutableArray<CodeRefactoringProvider>.Empty;
if (LanguageToProvidersMap.TryGetValue(document.Project.Language, out var lazyProviders))
{
allRefactorings = lazyProviders.Value;
}
return allRefactorings.ConcatFast(GetProjectRefactorings(document.Project));
}
public async Task<bool> HasRefactoringsAsync(
Document document,
TextSpan state,
CancellationToken cancellationToken)
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
foreach (var provider in GetProviders(document))
{
cancellationToken.ThrowIfCancellationRequested();
RefactoringToMetadataMap.TryGetValue(provider, out var providerMetadata);
var refactoring = await GetRefactoringFromProviderAsync(
document, state, provider, providerMetadata, extensionManager, isBlocking: false, cancellationToken).ConfigureAwait(false);
if (refactoring != null)
{
return true;
}
}
return false;
}
public async Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(
Document document,
TextSpan state,
CodeActionRequestPriority priority,
bool isBlocking,
Func<string, IDisposable?> addOperationScope,
CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.Refactoring_CodeRefactoringService_GetRefactoringsAsync, cancellationToken))
{
var extensionManager = document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>();
using var _ = ArrayBuilder<Task<CodeRefactoring?>>.GetInstance(out var tasks);
foreach (var provider in GetProviders(document))
{
if (priority != CodeActionRequestPriority.None && priority != provider.RequestPriority)
continue;
tasks.Add(Task.Run(() =>
{
var providerName = provider.GetType().Name;
RefactoringToMetadataMap.TryGetValue(provider, out var providerMetadata);
using (addOperationScope(providerName))
using (RoslynEventSource.LogInformationalBlock(FunctionId.Refactoring_CodeRefactoringService_GetRefactoringsAsync, providerName, cancellationToken))
{
return GetRefactoringFromProviderAsync(document, state, provider, providerMetadata, extensionManager, isBlocking, cancellationToken);
}
},
cancellationToken));
}
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
return results.WhereNotNull().ToImmutableArray();
}
}
private static async Task<CodeRefactoring?> GetRefactoringFromProviderAsync(
Document document,
TextSpan state,
CodeRefactoringProvider provider,
CodeChangeProviderMetadata? providerMetadata,
IExtensionManager extensionManager,
bool isBlocking,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
if (extensionManager.IsDisabled(provider))
{
return null;
}
try
{
using var _ = ArrayBuilder<(CodeAction action, TextSpan? applicableToSpan)>.GetInstance(out var actions);
var context = new CodeRefactoringContext(document, state,
// TODO: Can we share code between similar lambdas that we pass to this API in BatchFixAllProvider.cs, CodeFixService.cs and CodeRefactoringService.cs?
(action, applicableToSpan) =>
{
// Serialize access for thread safety - we don't know what thread the refactoring provider will call this delegate from.
lock (actions)
{
// Add the Refactoring Provider Name to the parent CodeAction's CustomTags.
// Always add a name even in cases of 3rd party refactorings that do not export
// name metadata.
action.AddCustomTag(providerMetadata?.Name ?? provider.GetTypeDisplayName());
actions.Add((action, applicableToSpan));
}
},
isBlocking,
cancellationToken);
var task = provider.ComputeRefactoringsAsync(context) ?? Task.CompletedTask;
await task.ConfigureAwait(false);
var result = actions.Count > 0
? new CodeRefactoring(provider, actions.ToImmutable())
: null;
return result;
}
catch (OperationCanceledException)
{
// We don't want to catch operation canceled exceptions in the catch block
// below. So catch is here and rethrow it.
throw;
}
catch (Exception e)
{
extensionManager.HandleException(provider, e);
}
return null;
}
private ImmutableArray<CodeRefactoringProvider> GetProjectRefactorings(Project project)
{
// TODO (https://github.com/dotnet/roslyn/issues/4932): Don't restrict refactorings in Interactive
if (project.Solution.Workspace.Kind == WorkspaceKind.Interactive)
{
return ImmutableArray<CodeRefactoringProvider>.Empty;
}
if (_projectRefactoringsMap.TryGetValue(project.AnalyzerReferences, out var refactorings))
{
return refactorings.Value;
}
return GetProjectRefactoringsSlow(project);
// Local functions
ImmutableArray<CodeRefactoringProvider> GetProjectRefactoringsSlow(Project project)
{
return _projectRefactoringsMap.GetValue(project.AnalyzerReferences, pId => new StrongBox<ImmutableArray<CodeRefactoringProvider>>(ComputeProjectRefactorings(project))).Value;
}
ImmutableArray<CodeRefactoringProvider> ComputeProjectRefactorings(Project project)
{
using var _ = ArrayBuilder<CodeRefactoringProvider>.GetInstance(out var builder);
foreach (var reference in project.AnalyzerReferences)
{
var projectCodeRefactoringProvider = _analyzerReferenceToRefactoringsMap.GetValue(reference, _createProjectCodeRefactoringsProvider);
foreach (var refactoring in projectCodeRefactoringProvider.GetExtensions(project.Language))
builder.Add(refactoring);
}
return builder.ToImmutable();
}
}
private class ProjectCodeRefactoringProvider
: AbstractProjectExtensionProvider<CodeRefactoringProvider, ExportCodeRefactoringProviderAttribute>
{
public ProjectCodeRefactoringProvider(AnalyzerReference reference)
: base(reference)
{
}
protected override bool SupportsLanguage(ExportCodeRefactoringProviderAttribute exportAttribute, string language)
{
return exportAttribute.Languages == null
|| exportAttribute.Languages.Length == 0
|| exportAttribute.Languages.Contains(language);
}
protected override bool TryGetExtensionsFromReference(AnalyzerReference reference, out ImmutableArray<CodeRefactoringProvider> extensions)
{
// check whether the analyzer reference knows how to return fixers directly.
if (reference is ICodeRefactoringProviderFactory codeRefactoringProviderFactory)
{
extensions = codeRefactoringProviderFactory.GetRefactorings();
return true;
}
extensions = default;
return false;
}
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/VisualStudio/Core/Test.Next/Services/PerformanceTrackerServiceTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Remote.Diagnostics;
using Xunit;
namespace Roslyn.VisualStudio.Next.UnitTests.Services
{
public class PerformanceTrackerServiceTests
{
[Fact]
public void TestTooFewSamples()
{
// minimum sample is 100
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 80);
Assert.Empty(badAnalyzers);
}
[Fact]
public void TestTracking()
{
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 200);
VerifyBadAnalyzer(badAnalyzers[0], "CSharpRemoveUnnecessaryCastDiagnosticAnalyzer", 101.244432561581, 54.48, 21.8163001442628);
VerifyBadAnalyzer(badAnalyzers[1], "CSharpInlineDeclarationDiagnosticAnalyzer", 49.9389715502954, 26.6686092715232, 9.2987133054884);
VerifyBadAnalyzer(badAnalyzers[2], "VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer", 42.0967360557792, 23.277619047619, 7.25464266261805);
}
[Fact]
public void TestTrackingMaxSample()
{
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 300);
VerifyBadAnalyzer(badAnalyzers[0], "CSharpRemoveUnnecessaryCastDiagnosticAnalyzer", 85.6039521236341, 58.4542358078603, 18.4245217226717);
VerifyBadAnalyzer(badAnalyzers[1], "VisualBasic.UseAutoProperty.UseAutoPropertyAnalyzer", 45.0918385052674, 29.0622535211268, 9.13728667060397);
VerifyBadAnalyzer(badAnalyzers[2], "CSharpInlineDeclarationDiagnosticAnalyzer", 42.2014208750466, 28.7935371179039, 7.99261581900397);
}
[Fact]
public void TestTrackingRolling()
{
// data starting to rolling at 300 data points
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 400);
VerifyBadAnalyzer(badAnalyzers[0], "CSharpRemoveUnnecessaryCastDiagnosticAnalyzer", 76.2748443491852, 51.1698695652174, 17.3819563479479);
VerifyBadAnalyzer(badAnalyzers[1], "VisualBasic.UseAutoProperty.UseAutoPropertyAnalyzer", 43.5700167914005, 29.2597857142857, 9.21213873850298);
VerifyBadAnalyzer(badAnalyzers[2], "InlineDeclaration.CSharpInlineDeclarationDiagnosticAnalyzer", 36.4336594793033, 23.9764782608696, 7.43956680199015);
}
[Fact]
public void TestBadAnalyzerInfoPII()
{
var badAnalyzer1 = new ExpensiveAnalyzerInfo(true, "test", 0.1, 0.1, 0.1);
Assert.True(badAnalyzer1.PIISafeAnalyzerId == badAnalyzer1.AnalyzerId);
Assert.True(badAnalyzer1.PIISafeAnalyzerId == "test");
var badAnalyzer2 = new ExpensiveAnalyzerInfo(false, "test", 0.1, 0.1, 0.1);
Assert.True(badAnalyzer2.PIISafeAnalyzerId == badAnalyzer2.AnalyzerIdHash);
Assert.True(badAnalyzer2.PIISafeAnalyzerId == "test".GetHashCode().ToString());
}
private void VerifyBadAnalyzer(ExpensiveAnalyzerInfo analyzer, string analyzerId, double lof, double mean, double stddev)
{
Assert.True(analyzer.PIISafeAnalyzerId.IndexOf(analyzerId, StringComparison.OrdinalIgnoreCase) >= 0);
Assert.Equal(lof, analyzer.LocalOutlierFactor, precision: 4);
Assert.Equal(mean, analyzer.Average, precision: 4);
Assert.Equal(stddev, analyzer.AdjustedStandardDeviation, precision: 4);
}
private List<ExpensiveAnalyzerInfo> GetBadAnalyzers(string testFileName, int to)
{
var testFile = ReadTestFile(testFileName);
var (matrix, dataCount) = CreateMatrix(testFile);
to = Math.Min(to, dataCount);
var service = new PerformanceTrackerService(minLOFValue: 0, averageThreshold: 0, stddevThreshold: 0);
for (var i = 0; i < to; i++)
{
service.AddSnapshot(CreateSnapshots(matrix, i), unitCount: 100);
}
var badAnalyzerInfo = new List<ExpensiveAnalyzerInfo>();
service.GenerateReport(badAnalyzerInfo);
return badAnalyzerInfo;
}
private IEnumerable<AnalyzerPerformanceInfo> CreateSnapshots(Dictionary<string, double[]> matrix, int index)
{
foreach (var kv in matrix)
{
var timeSpan = kv.Value[index];
if (double.IsNaN(timeSpan))
{
continue;
}
yield return new AnalyzerPerformanceInfo(kv.Key, true, TimeSpan.FromMilliseconds(timeSpan));
}
}
private (Dictionary<string, double[]> matrix, int dataCount) CreateMatrix(string testFile)
{
var matrix = new Dictionary<string, double[]>();
var lines = testFile.Split('\n');
var expectedDataCount = GetExpectedDataCount(lines[0]);
for (var i = 1; i < lines.Length; i++)
{
if (lines[i].Trim().Length == 0)
{
continue;
}
var data = SkipAnalyzerId(lines[i]).Split(',');
Assert.Equal(data.Length, expectedDataCount);
var analyzerId = GetAnalyzerId(lines[i]);
var timeSpans = new double[expectedDataCount];
for (var j = 0; j < data.Length; j++)
{
double result;
if (!double.TryParse(data[j], NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out result))
{
// no data for this analyzer for this particular run
result = double.NaN;
}
timeSpans[j] = result;
}
matrix[analyzerId] = timeSpans;
}
return (matrix, expectedDataCount);
}
private string GetAnalyzerId(string line)
{
return line.Substring(1, line.LastIndexOf('"') - 1);
}
private int GetExpectedDataCount(string header)
{
var data = header.Split(',');
return data.Length - 1;
}
private string SkipAnalyzerId(string line)
{
return line.Substring(line.LastIndexOf('"') + 2);
}
private string ReadTestFile(string name)
{
var assembly = typeof(PerformanceTrackerServiceTests).Assembly;
var resourceName = GetResourceName(assembly, name);
using (var stream = assembly.GetManifestResourceStream(resourceName))
{
if (stream == null)
{
throw new InvalidOperationException($"Resource '{resourceName}' not found in {assembly.FullName}.");
}
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
private static string GetResourceName(Assembly assembly, string name)
{
var convert = name.Replace(@"\", ".");
return assembly.GetManifestResourceNames().Where(n => n.EndsWith(convert, StringComparison.OrdinalIgnoreCase)).First();
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Remote.Diagnostics;
using Xunit;
namespace Roslyn.VisualStudio.Next.UnitTests.Services
{
public class PerformanceTrackerServiceTests
{
[Fact]
public void TestTooFewSamples()
{
// minimum sample is 100
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 80);
Assert.Empty(badAnalyzers);
}
[Fact]
public void TestTracking()
{
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 200);
VerifyBadAnalyzer(badAnalyzers[0], "CSharpRemoveUnnecessaryCastDiagnosticAnalyzer", 101.244432561581, 54.48, 21.8163001442628);
VerifyBadAnalyzer(badAnalyzers[1], "CSharpInlineDeclarationDiagnosticAnalyzer", 49.9389715502954, 26.6686092715232, 9.2987133054884);
VerifyBadAnalyzer(badAnalyzers[2], "VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer", 42.0967360557792, 23.277619047619, 7.25464266261805);
}
[Fact]
public void TestTrackingMaxSample()
{
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 300);
VerifyBadAnalyzer(badAnalyzers[0], "CSharpRemoveUnnecessaryCastDiagnosticAnalyzer", 85.6039521236341, 58.4542358078603, 18.4245217226717);
VerifyBadAnalyzer(badAnalyzers[1], "VisualBasic.UseAutoProperty.UseAutoPropertyAnalyzer", 45.0918385052674, 29.0622535211268, 9.13728667060397);
VerifyBadAnalyzer(badAnalyzers[2], "CSharpInlineDeclarationDiagnosticAnalyzer", 42.2014208750466, 28.7935371179039, 7.99261581900397);
}
[Fact]
public void TestTrackingRolling()
{
// data starting to rolling at 300 data points
var badAnalyzers = GetBadAnalyzers(@"TestFiles\analyzer_input.csv", to: 400);
VerifyBadAnalyzer(badAnalyzers[0], "CSharpRemoveUnnecessaryCastDiagnosticAnalyzer", 76.2748443491852, 51.1698695652174, 17.3819563479479);
VerifyBadAnalyzer(badAnalyzers[1], "VisualBasic.UseAutoProperty.UseAutoPropertyAnalyzer", 43.5700167914005, 29.2597857142857, 9.21213873850298);
VerifyBadAnalyzer(badAnalyzers[2], "InlineDeclaration.CSharpInlineDeclarationDiagnosticAnalyzer", 36.4336594793033, 23.9764782608696, 7.43956680199015);
}
[Fact]
public void TestBadAnalyzerInfoPII()
{
var badAnalyzer1 = new ExpensiveAnalyzerInfo(true, "test", 0.1, 0.1, 0.1);
Assert.True(badAnalyzer1.PIISafeAnalyzerId == badAnalyzer1.AnalyzerId);
Assert.True(badAnalyzer1.PIISafeAnalyzerId == "test");
var badAnalyzer2 = new ExpensiveAnalyzerInfo(false, "test", 0.1, 0.1, 0.1);
Assert.True(badAnalyzer2.PIISafeAnalyzerId == badAnalyzer2.AnalyzerIdHash);
Assert.True(badAnalyzer2.PIISafeAnalyzerId == "test".GetHashCode().ToString());
}
private void VerifyBadAnalyzer(ExpensiveAnalyzerInfo analyzer, string analyzerId, double lof, double mean, double stddev)
{
Assert.True(analyzer.PIISafeAnalyzerId.IndexOf(analyzerId, StringComparison.OrdinalIgnoreCase) >= 0);
Assert.Equal(lof, analyzer.LocalOutlierFactor, precision: 4);
Assert.Equal(mean, analyzer.Average, precision: 4);
Assert.Equal(stddev, analyzer.AdjustedStandardDeviation, precision: 4);
}
private List<ExpensiveAnalyzerInfo> GetBadAnalyzers(string testFileName, int to)
{
var testFile = ReadTestFile(testFileName);
var (matrix, dataCount) = CreateMatrix(testFile);
to = Math.Min(to, dataCount);
var service = new PerformanceTrackerService(minLOFValue: 0, averageThreshold: 0, stddevThreshold: 0);
for (var i = 0; i < to; i++)
{
service.AddSnapshot(CreateSnapshots(matrix, i), unitCount: 100);
}
var badAnalyzerInfo = new List<ExpensiveAnalyzerInfo>();
service.GenerateReport(badAnalyzerInfo);
return badAnalyzerInfo;
}
private IEnumerable<AnalyzerPerformanceInfo> CreateSnapshots(Dictionary<string, double[]> matrix, int index)
{
foreach (var kv in matrix)
{
var timeSpan = kv.Value[index];
if (double.IsNaN(timeSpan))
{
continue;
}
yield return new AnalyzerPerformanceInfo(kv.Key, true, TimeSpan.FromMilliseconds(timeSpan));
}
}
private (Dictionary<string, double[]> matrix, int dataCount) CreateMatrix(string testFile)
{
var matrix = new Dictionary<string, double[]>();
var lines = testFile.Split('\n');
var expectedDataCount = GetExpectedDataCount(lines[0]);
for (var i = 1; i < lines.Length; i++)
{
if (lines[i].Trim().Length == 0)
{
continue;
}
var data = SkipAnalyzerId(lines[i]).Split(',');
Assert.Equal(data.Length, expectedDataCount);
var analyzerId = GetAnalyzerId(lines[i]);
var timeSpans = new double[expectedDataCount];
for (var j = 0; j < data.Length; j++)
{
double result;
if (!double.TryParse(data[j], NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out result))
{
// no data for this analyzer for this particular run
result = double.NaN;
}
timeSpans[j] = result;
}
matrix[analyzerId] = timeSpans;
}
return (matrix, expectedDataCount);
}
private string GetAnalyzerId(string line)
{
return line.Substring(1, line.LastIndexOf('"') - 1);
}
private int GetExpectedDataCount(string header)
{
var data = header.Split(',');
return data.Length - 1;
}
private string SkipAnalyzerId(string line)
{
return line.Substring(line.LastIndexOf('"') + 2);
}
private string ReadTestFile(string name)
{
var assembly = typeof(PerformanceTrackerServiceTests).Assembly;
var resourceName = GetResourceName(assembly, name);
using (var stream = assembly.GetManifestResourceStream(resourceName))
{
if (stream == null)
{
throw new InvalidOperationException($"Resource '{resourceName}' not found in {assembly.FullName}.");
}
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
private static string GetResourceName(Assembly assembly, string name)
{
var convert = name.Replace(@"\", ".");
return assembly.GetManifestResourceNames().Where(n => n.EndsWith(convert, StringComparison.OrdinalIgnoreCase)).First();
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Features/Core/Portable/AddMissingReference/AddMissingReferenceCodeAction.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeActions.WorkspaceServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.AddMissingReference
{
internal class AddMissingReferenceCodeAction : CodeAction
{
private readonly Project _project;
private readonly ProjectReference? _projectReferenceToAdd;
private readonly AssemblyIdentity _missingAssemblyIdentity;
public override string Title { get; }
public AddMissingReferenceCodeAction(Project project, string title, ProjectReference? projectReferenceToAdd, AssemblyIdentity missingAssemblyIdentity)
{
_project = project;
Title = title;
_projectReferenceToAdd = projectReferenceToAdd;
_missingAssemblyIdentity = missingAssemblyIdentity;
}
public static async Task<CodeAction> CreateAsync(Project project, AssemblyIdentity missingAssemblyIdentity, CancellationToken cancellationToken)
{
var dependencyGraph = project.Solution.GetProjectDependencyGraph();
// We want to find a project that generates this assembly, if one so exists. We therefore
// search all projects that our project with an error depends on. We want to do this for
// complicated and evil scenarios like this one:
//
// C -> B -> A
//
// A'
//
// Where, for some insane reason, A and A' are two projects that both emit an assembly
// by the same name. So imagine we are using a type in B from C, and we are missing a
// reference to A.dll. Both A and A' are candidates, but we know we can throw out A'
// since whatever type from B we are using that's causing the error, we know that type
// isn't referencing A'. Put another way: this code action adds a reference, but should
// never change the transitive closure of project references that C has.
//
// Doing this filtering also means we get to check less projects (good), and ensures that
// whatever project reference we end up adding won't add a circularity (also good.)
foreach (var candidateProjectId in dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(project.Id))
{
var candidateProject = project.Solution.GetRequiredProject(candidateProjectId);
if (candidateProject.SupportsCompilation &&
string.Equals(missingAssemblyIdentity.Name, candidateProject.AssemblyName, StringComparison.OrdinalIgnoreCase))
{
// The name matches, so let's see if the full identities are equal.
var compilation = await candidateProject.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
if (missingAssemblyIdentity.Equals(compilation.Assembly.Identity))
{
// It matches, so just add a reference to this
return new AddMissingReferenceCodeAction(project,
string.Format(FeaturesResources.Add_project_reference_to_0, candidateProject.Name),
new ProjectReference(candidateProjectId), missingAssemblyIdentity);
}
}
}
// No matching project, so metadata reference
var description = string.Format(FeaturesResources.Add_reference_to_0, missingAssemblyIdentity.GetDisplayName());
return new AddMissingReferenceCodeAction(project, description, null, missingAssemblyIdentity);
}
protected override Task<IEnumerable<CodeActionOperation>> ComputeOperationsAsync(CancellationToken cancellationToken)
{
// If we have a project reference to add, then add it
if (_projectReferenceToAdd != null)
{
// note: no need to post process since we are just adding a project reference and not making any code changes.
return Task.FromResult(SpecializedCollections.SingletonEnumerable<CodeActionOperation>(
new ApplyChangesOperation(_project.AddProjectReference(_projectReferenceToAdd).Solution)));
}
else
{
// We didn't have any project, so we need to try adding a metadata reference
var factoryService = _project.Solution.Workspace.Services.GetRequiredService<IAddMetadataReferenceCodeActionOperationFactoryWorkspaceService>();
var operation = factoryService.CreateAddMetadataReferenceOperation(_project.Id, _missingAssemblyIdentity);
return Task.FromResult(SpecializedCollections.SingletonEnumerable(operation));
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeActions.WorkspaceServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.AddMissingReference
{
internal class AddMissingReferenceCodeAction : CodeAction
{
private readonly Project _project;
private readonly ProjectReference? _projectReferenceToAdd;
private readonly AssemblyIdentity _missingAssemblyIdentity;
public override string Title { get; }
public AddMissingReferenceCodeAction(Project project, string title, ProjectReference? projectReferenceToAdd, AssemblyIdentity missingAssemblyIdentity)
{
_project = project;
Title = title;
_projectReferenceToAdd = projectReferenceToAdd;
_missingAssemblyIdentity = missingAssemblyIdentity;
}
public static async Task<CodeAction> CreateAsync(Project project, AssemblyIdentity missingAssemblyIdentity, CancellationToken cancellationToken)
{
var dependencyGraph = project.Solution.GetProjectDependencyGraph();
// We want to find a project that generates this assembly, if one so exists. We therefore
// search all projects that our project with an error depends on. We want to do this for
// complicated and evil scenarios like this one:
//
// C -> B -> A
//
// A'
//
// Where, for some insane reason, A and A' are two projects that both emit an assembly
// by the same name. So imagine we are using a type in B from C, and we are missing a
// reference to A.dll. Both A and A' are candidates, but we know we can throw out A'
// since whatever type from B we are using that's causing the error, we know that type
// isn't referencing A'. Put another way: this code action adds a reference, but should
// never change the transitive closure of project references that C has.
//
// Doing this filtering also means we get to check less projects (good), and ensures that
// whatever project reference we end up adding won't add a circularity (also good.)
foreach (var candidateProjectId in dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(project.Id))
{
var candidateProject = project.Solution.GetRequiredProject(candidateProjectId);
if (candidateProject.SupportsCompilation &&
string.Equals(missingAssemblyIdentity.Name, candidateProject.AssemblyName, StringComparison.OrdinalIgnoreCase))
{
// The name matches, so let's see if the full identities are equal.
var compilation = await candidateProject.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
if (missingAssemblyIdentity.Equals(compilation.Assembly.Identity))
{
// It matches, so just add a reference to this
return new AddMissingReferenceCodeAction(project,
string.Format(FeaturesResources.Add_project_reference_to_0, candidateProject.Name),
new ProjectReference(candidateProjectId), missingAssemblyIdentity);
}
}
}
// No matching project, so metadata reference
var description = string.Format(FeaturesResources.Add_reference_to_0, missingAssemblyIdentity.GetDisplayName());
return new AddMissingReferenceCodeAction(project, description, null, missingAssemblyIdentity);
}
protected override Task<IEnumerable<CodeActionOperation>> ComputeOperationsAsync(CancellationToken cancellationToken)
{
// If we have a project reference to add, then add it
if (_projectReferenceToAdd != null)
{
// note: no need to post process since we are just adding a project reference and not making any code changes.
return Task.FromResult(SpecializedCollections.SingletonEnumerable<CodeActionOperation>(
new ApplyChangesOperation(_project.AddProjectReference(_projectReferenceToAdd).Solution)));
}
else
{
// We didn't have any project, so we need to try adding a metadata reference
var factoryService = _project.Solution.Workspace.Services.GetRequiredService<IAddMetadataReferenceCodeActionOperationFactoryWorkspaceService>();
var operation = factoryService.CreateAddMetadataReferenceOperation(_project.Id, _missingAssemblyIdentity);
return Task.FromResult(SpecializedCollections.SingletonEnumerable(operation));
}
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/CSharp/Portable/Lowering/SpillSequenceSpiller.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
internal sealed class SpillSequenceSpiller : BoundTreeRewriterWithStackGuard
{
private const BoundKind SpillSequenceBuilderKind = (BoundKind)byte.MaxValue;
private readonly SyntheticBoundNodeFactory _F;
private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
private SpillSequenceSpiller(MethodSymbol method, SyntaxNode syntaxNode, TypeCompilationState compilationState, PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution, BindingDiagnosticBag diagnostics)
{
_F = new SyntheticBoundNodeFactory(method, syntaxNode, compilationState, diagnostics);
_F.CurrentFunction = method;
_tempSubstitution = tempSubstitution;
}
private sealed class BoundSpillSequenceBuilder : BoundExpression
{
public readonly BoundExpression Value;
private ArrayBuilder<LocalSymbol> _locals;
private ArrayBuilder<BoundStatement> _statements;
public BoundSpillSequenceBuilder(SyntaxNode syntax, BoundExpression value = null)
: base(SpillSequenceBuilderKind, syntax, value?.Type)
{
Debug.Assert(value?.Kind != SpillSequenceBuilderKind);
this.Value = value;
}
public bool HasStatements
{
get
{
return _statements != null;
}
}
public bool HasLocals
{
get
{
return _locals != null;
}
}
public ImmutableArray<LocalSymbol> GetLocals()
{
return (_locals == null) ? ImmutableArray<LocalSymbol>.Empty : _locals.ToImmutable();
}
public ImmutableArray<BoundStatement> GetStatements()
{
if (_statements == null)
{
return ImmutableArray<BoundStatement>.Empty;
}
return _statements.ToImmutable();
}
internal BoundSpillSequenceBuilder Update(BoundExpression value)
{
var result = new BoundSpillSequenceBuilder(this.Syntax, value);
result._locals = _locals;
result._statements = _statements;
return result;
}
public void Free()
{
if (_locals != null) _locals.Free();
if (_statements != null) _statements.Free();
}
internal void Include(BoundSpillSequenceBuilder other)
{
if (other != null)
{
IncludeAndFree(ref _locals, ref other._locals);
IncludeAndFree(ref _statements, ref other._statements);
}
}
private static void IncludeAndFree<T>(ref ArrayBuilder<T> left, ref ArrayBuilder<T> right)
{
if (right == null)
{
return;
}
if (left == null)
{
left = right;
return;
}
left.AddRange(right);
right.Free();
}
public void AddLocal(LocalSymbol local)
{
if (_locals == null)
{
_locals = ArrayBuilder<LocalSymbol>.GetInstance();
}
_locals.Add(local);
}
public void AddLocals(ImmutableArray<LocalSymbol> locals)
{
foreach (var local in locals)
{
AddLocal(local);
}
}
public void AddStatement(BoundStatement statement)
{
if (_statements == null)
{
_statements = ArrayBuilder<BoundStatement>.GetInstance();
}
_statements.Add(statement);
}
public void AddStatements(ImmutableArray<BoundStatement> statements)
{
foreach (var statement in statements)
{
AddStatement(statement);
}
}
internal void AddExpressions(ImmutableArray<BoundExpression> expressions)
{
foreach (var expression in expressions)
{
AddStatement(new BoundExpressionStatement(expression.Syntax, expression) { WasCompilerGenerated = true });
}
}
#if DEBUG
internal override string Dump()
{
var node = new TreeDumperNode("boundSpillSequenceBuilder", null, new TreeDumperNode[]
{
new TreeDumperNode("locals", this.GetLocals(), null),
new TreeDumperNode("statements", null, from x in this.GetStatements() select BoundTreeDumperNodeProducer.MakeTree(x)),
new TreeDumperNode("value", null, new TreeDumperNode[] { BoundTreeDumperNodeProducer.MakeTree(this.Value) }),
new TreeDumperNode("type", this.Type, null)
});
return TreeDumper.DumpCompact(node);
}
#endif
}
private sealed class LocalSubstituter : BoundTreeRewriterWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
{
private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
private LocalSubstituter(PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution, int recursionDepth = 0)
: base(recursionDepth)
{
_tempSubstitution = tempSubstitution;
}
public static BoundNode Rewrite(PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution, BoundNode node)
{
if (tempSubstitution.Count == 0)
{
return node;
}
var substituter = new LocalSubstituter(tempSubstitution);
return substituter.Visit(node);
}
public override BoundNode VisitLocal(BoundLocal node)
{
if (!node.LocalSymbol.SynthesizedKind.IsLongLived())
{
LocalSymbol longLived;
if (_tempSubstitution.TryGetValue(node.LocalSymbol, out longLived))
{
return node.Update(longLived, node.ConstantValueOpt, node.Type);
}
}
return base.VisitLocal(node);
}
}
internal static BoundStatement Rewrite(BoundStatement body, MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
{
var tempSubstitution = PooledDictionary<LocalSymbol, LocalSymbol>.GetInstance();
var spiller = new SpillSequenceSpiller(method, body.Syntax, compilationState, tempSubstitution, diagnostics);
BoundNode result = spiller.Visit(body);
result = LocalSubstituter.Rewrite(tempSubstitution, result);
tempSubstitution.Free();
return (BoundStatement)result;
}
private BoundExpression VisitExpression(ref BoundSpillSequenceBuilder builder, BoundExpression expression)
{
var e = (BoundExpression)this.Visit(expression);
if (e == null || e.Kind != SpillSequenceBuilderKind)
{
return e;
}
var newBuilder = (BoundSpillSequenceBuilder)e;
if (builder == null)
{
builder = newBuilder.Update(null);
}
else
{
builder.Include(newBuilder);
}
return newBuilder.Value;
}
private static BoundExpression UpdateExpression(BoundSpillSequenceBuilder builder, BoundExpression expression)
{
if (builder == null)
{
return expression;
}
Debug.Assert(builder.Value == null);
if (!builder.HasLocals && !builder.HasStatements)
{
builder.Free();
return expression;
}
return builder.Update(expression);
}
private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundStatement statement)
{
if (builder == null)
{
Debug.Assert(statement != null);
return statement;
}
Debug.Assert(builder.Value == null);
if (statement != null)
{
builder.AddStatement(statement);
}
var result = new BoundBlock(statement.Syntax, builder.GetLocals(), builder.GetStatements()) { WasCompilerGenerated = true };
builder.Free();
return result;
}
private BoundExpression Spill(
BoundSpillSequenceBuilder builder,
BoundExpression expression,
RefKind refKind = RefKind.None,
bool sideEffectsOnly = false)
{
Debug.Assert(builder != null);
if (builder.Syntax != null)
_F.Syntax = builder.Syntax;
while (true)
{
switch (expression.Kind)
{
case BoundKind.ArrayInitialization:
Debug.Assert(refKind == RefKind.None);
Debug.Assert(!sideEffectsOnly);
var arrayInitialization = (BoundArrayInitialization)expression;
var newInitializers = VisitExpressionList(ref builder, arrayInitialization.Initializers, forceSpill: true);
return arrayInitialization.Update(newInitializers);
case BoundKind.ArgListOperator:
Debug.Assert(refKind == RefKind.None);
Debug.Assert(!sideEffectsOnly);
var argumentList = (BoundArgListOperator)expression;
var newArgs = VisitExpressionList(ref builder, argumentList.Arguments, argumentList.ArgumentRefKindsOpt, forceSpill: true);
return argumentList.Update(newArgs, argumentList.ArgumentRefKindsOpt, argumentList.Type);
case SpillSequenceBuilderKind:
var sequenceBuilder = (BoundSpillSequenceBuilder)expression;
builder.Include(sequenceBuilder);
expression = sequenceBuilder.Value;
continue;
case BoundKind.Sequence:
// neither the side-effects nor the value of the sequence contains await
// (otherwise it would be converted to a SpillSequenceBuilder).
if (refKind != RefKind.None)
{
return expression;
}
goto default;
case BoundKind.ThisReference:
case BoundKind.BaseReference:
if (refKind != RefKind.None || expression.Type.IsReferenceType)
{
return expression;
}
goto default;
case BoundKind.Parameter:
if (refKind != RefKind.None)
{
return expression;
}
goto default;
case BoundKind.Local:
var local = (BoundLocal)expression;
if (local.LocalSymbol.SynthesizedKind == SynthesizedLocalKind.Spill || refKind != RefKind.None)
{
return local;
}
goto default;
case BoundKind.FieldAccess:
var field = (BoundFieldAccess)expression;
var fieldSymbol = field.FieldSymbol;
if (fieldSymbol.IsStatic)
{
// no need to spill static fields if used as locations or if readonly
if (refKind != RefKind.None || fieldSymbol.IsReadOnly)
{
return field;
}
goto default;
}
if (refKind == RefKind.None) goto default;
var receiver = Spill(builder, field.ReceiverOpt, fieldSymbol.ContainingType.IsValueType ? refKind : RefKind.None);
return field.Update(receiver, fieldSymbol, field.ConstantValueOpt, field.ResultKind, field.Type);
case BoundKind.Literal:
case BoundKind.TypeExpression:
return expression;
case BoundKind.ConditionalReceiver:
// we will rewrite this as a part of rewriting whole LoweredConditionalAccess
// later, if needed
return expression;
default:
if (expression.Type.IsVoidType() || sideEffectsOnly)
{
builder.AddStatement(_F.ExpressionStatement(expression));
return null;
}
else
{
BoundAssignmentOperator assignToTemp;
var replacement = _F.StoreToTemp(
expression,
out assignToTemp,
refKind: refKind,
kind: SynthesizedLocalKind.Spill,
syntaxOpt: _F.Syntax);
builder.AddLocal(replacement.LocalSymbol);
builder.AddStatement(_F.ExpressionStatement(assignToTemp));
return replacement;
}
}
}
}
private ImmutableArray<BoundExpression> VisitExpressionList(
ref BoundSpillSequenceBuilder builder,
ImmutableArray<BoundExpression> args,
ImmutableArray<RefKind> refKinds = default(ImmutableArray<RefKind>),
bool forceSpill = false,
bool sideEffectsOnly = false)
{
Debug.Assert(!sideEffectsOnly || refKinds.IsDefault);
Debug.Assert(refKinds.IsDefault || refKinds.Length == args.Length);
if (args.Length == 0)
{
return args;
}
var newList = VisitList(args);
Debug.Assert(newList.Length == args.Length);
int lastSpill;
if (forceSpill)
{
lastSpill = newList.Length;
}
else
{
lastSpill = -1;
for (int i = newList.Length - 1; i >= 0; i--)
{
if (newList[i].Kind == SpillSequenceBuilderKind)
{
lastSpill = i;
break;
}
}
}
if (lastSpill == -1)
{
return newList;
}
if (builder == null)
{
builder = new BoundSpillSequenceBuilder(lastSpill < newList.Length ? (newList[lastSpill] as BoundSpillSequenceBuilder)?.Syntax : null);
}
var result = ArrayBuilder<BoundExpression>.GetInstance(newList.Length);
// everything up until the last spill must be spilled entirely
for (int i = 0; i < lastSpill; i++)
{
var refKind = refKinds.IsDefault ? RefKind.None : refKinds[i];
var replacement = Spill(builder, newList[i], refKind, sideEffectsOnly);
Debug.Assert(sideEffectsOnly || replacement != null);
if (!sideEffectsOnly)
{
result.Add(replacement);
}
}
// the value of the last spill and everything that follows is not spilled
if (lastSpill < newList.Length)
{
var lastSpillNode = (BoundSpillSequenceBuilder)newList[lastSpill];
builder.Include(lastSpillNode);
result.Add(lastSpillNode.Value);
for (int i = lastSpill + 1; i < newList.Length; i++)
{
result.Add(newList[i]);
}
}
return result.ToImmutableAndFree();
}
#region Statement Visitors
public override BoundNode VisitSwitchDispatch(BoundSwitchDispatch node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateStatement(builder, node.Update(expression, node.Cases, node.DefaultLabel, node.EqualityMethod));
}
public override BoundNode VisitThrowStatement(BoundThrowStatement node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression expression = VisitExpression(ref builder, node.ExpressionOpt);
return UpdateStatement(builder, node.Update(expression));
}
public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression expr = VisitExpression(ref builder, node.Expression);
Debug.Assert(expr != null);
Debug.Assert(builder == null || builder.Value == null);
return UpdateStatement(builder, node.Update(expr));
}
public override BoundNode VisitConditionalGoto(BoundConditionalGoto node)
{
BoundSpillSequenceBuilder builder = null;
var condition = VisitExpression(ref builder, node.Condition);
return UpdateStatement(builder, node.Update(condition, node.JumpIfTrue, node.Label));
}
public override BoundNode VisitReturnStatement(BoundReturnStatement node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.ExpressionOpt);
return UpdateStatement(builder, node.Update(node.RefKind, expression));
}
public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateStatement(builder, node.Update(expression));
}
public override BoundNode VisitCatchBlock(BoundCatchBlock node)
{
BoundExpression exceptionSourceOpt = (BoundExpression)this.Visit(node.ExceptionSourceOpt);
var locals = node.Locals;
var exceptionFilterPrologueOpt = node.ExceptionFilterPrologueOpt;
Debug.Assert(exceptionFilterPrologueOpt is null); // it is introduced by this pass
BoundSpillSequenceBuilder builder = null;
var exceptionFilterOpt = VisitExpression(ref builder, node.ExceptionFilterOpt);
if (builder is { })
{
Debug.Assert(builder.Value is null);
locals = locals.AddRange(builder.GetLocals());
exceptionFilterPrologueOpt = new BoundStatementList(node.Syntax, builder.GetStatements());
}
BoundBlock body = (BoundBlock)this.Visit(node.Body);
TypeSymbol exceptionTypeOpt = this.VisitType(node.ExceptionTypeOpt);
return node.Update(locals, exceptionSourceOpt, exceptionTypeOpt, exceptionFilterPrologueOpt, exceptionFilterOpt, body, node.IsSynthesizedAsyncCatchAll);
}
#if DEBUG
public override BoundNode DefaultVisit(BoundNode node)
{
Debug.Assert(!(node is BoundStatement));
return base.DefaultVisit(node);
}
#endif
#endregion
#region Expression Visitors
public override BoundNode VisitAwaitExpression(BoundAwaitExpression node)
{
// An await expression has already been wrapped in a BoundSpillSequence if not at the top level, so
// the spilling will occur in the enclosing node.
BoundSpillSequenceBuilder builder = null;
var expr = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(expr, node.AwaitableInfo, node.Type));
}
public override BoundNode VisitSpillSequence(BoundSpillSequence node)
{
var builder = new BoundSpillSequenceBuilder(node.Syntax);
// Ensure later errors (e.g. in async rewriting) are associated with the correct node.
_F.Syntax = node.Syntax;
builder.AddStatements(VisitList(node.SideEffects));
builder.AddLocals(node.Locals);
var value = VisitExpression(ref builder, node.Value);
return builder.Update(value);
}
public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node)
{
BoundSpillSequenceBuilder builder = null;
var expr = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(expr, node.IsManaged, node.Type));
}
public override BoundNode VisitArgListOperator(BoundArgListOperator node)
{
BoundSpillSequenceBuilder builder = null;
var newArgs = VisitExpressionList(ref builder, node.Arguments);
return UpdateExpression(builder, node.Update(newArgs, node.ArgumentRefKindsOpt, node.Type));
}
public override BoundNode VisitArrayAccess(BoundArrayAccess node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
BoundSpillSequenceBuilder indicesBuilder = null;
var indices = this.VisitExpressionList(ref indicesBuilder, node.Indices);
if (indicesBuilder != null)
{
// spill the array if there were await expressions in the indices
if (builder == null)
{
builder = new BoundSpillSequenceBuilder(indicesBuilder.Syntax);
}
expression = Spill(builder, expression);
}
if (builder != null)
{
builder.Include(indicesBuilder);
indicesBuilder = builder;
builder = null;
}
return UpdateExpression(indicesBuilder, node.Update(expression, indices, node.Type));
}
public override BoundNode VisitArrayCreation(BoundArrayCreation node)
{
BoundSpillSequenceBuilder builder = null;
var init = (BoundArrayInitialization)VisitExpression(ref builder, node.InitializerOpt);
ImmutableArray<BoundExpression> bounds;
if (builder == null)
{
bounds = VisitExpressionList(ref builder, node.Bounds);
}
else
{
// spill bounds expressions if initializers contain await
var boundsBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
bounds = VisitExpressionList(ref boundsBuilder, node.Bounds, forceSpill: true);
boundsBuilder.Include(builder);
builder = boundsBuilder;
}
return UpdateExpression(builder, node.Update(bounds, init, node.Type));
}
public override BoundNode VisitArrayInitialization(BoundArrayInitialization node)
{
BoundSpillSequenceBuilder builder = null;
var initializers = this.VisitExpressionList(ref builder, node.Initializers);
return UpdateExpression(builder, node.Update(initializers));
}
public override BoundNode VisitConvertedStackAllocExpression(BoundConvertedStackAllocExpression node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression count = VisitExpression(ref builder, node.Count);
var initializerOpt = (BoundArrayInitialization)VisitExpression(ref builder, node.InitializerOpt);
return UpdateExpression(builder, node.Update(node.ElementType, count, initializerOpt, node.Type));
}
public override BoundNode VisitArrayLength(BoundArrayLength node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(expression, node.Type));
}
public override BoundNode VisitAsOperator(BoundAsOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.TargetType, node.Conversion, node.Type));
}
public override BoundNode VisitAssignmentOperator(BoundAssignmentOperator node)
{
BoundSpillSequenceBuilder builder = null;
var right = VisitExpression(ref builder, node.Right);
BoundExpression left = node.Left;
if (builder == null)
{
left = VisitExpression(ref builder, left);
}
else
{
// if the right-hand-side has await, spill the left
var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
switch (left.Kind)
{
case BoundKind.Local:
case BoundKind.Parameter:
// locals and parameters are directly assignable, LHS is not on the stack so nothing to spill
break;
case BoundKind.FieldAccess:
var field = (BoundFieldAccess)left;
// static fields are directly assignable, LHS is not on the stack, nothing to spill
if (field.FieldSymbol.IsStatic) break;
// instance fields are directly assignable, but receiver is pushed, so need to spill that.
left = fieldWithSpilledReceiver(field, ref leftBuilder, isAssignmentTarget: true);
break;
case BoundKind.ArrayAccess:
var arrayAccess = (BoundArrayAccess)left;
// array and indices are pushed on stack so need to spill that
var expression = VisitExpression(ref leftBuilder, arrayAccess.Expression);
expression = Spill(leftBuilder, expression, RefKind.None);
var indices = this.VisitExpressionList(ref leftBuilder, arrayAccess.Indices, forceSpill: true);
left = arrayAccess.Update(expression, indices, arrayAccess.Type);
break;
default:
// must be something indirectly assignable, just visit and spill as an ordinary Ref (not a RefReadOnly!!)
//
// NOTE: in some cases this will result in spiller producing an error.
// For example if the LHS is a ref-returning method like
//
// obj.RefReturning(a, b, c) = await Something();
//
// the spiller would eventually have to spill the evaluation result of "refReturning" call as an ordinary Ref,
// which it can't.
left = Spill(leftBuilder, VisitExpression(ref leftBuilder, left), RefKind.Ref);
break;
}
leftBuilder.Include(builder);
builder = leftBuilder;
}
return UpdateExpression(builder, node.Update(left, right, node.IsRef, node.Type));
BoundExpression fieldWithSpilledReceiver(BoundFieldAccess field, ref BoundSpillSequenceBuilder leftBuilder, bool isAssignmentTarget)
{
var generateDummyFieldAccess = false;
if (!field.FieldSymbol.IsStatic)
{
Debug.Assert(field.ReceiverOpt is object);
BoundExpression receiver;
if (field.FieldSymbol.ContainingType.IsReferenceType)
{
// a reference type can always live across await so Spill using leftBuilder
receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt));
// dummy field access to trigger NRE
// a.b = c will trigger a NRE if a is null on assignment,
// but a.b.c = d will trigger a NRE if a is null before evaluating d
// so check whether we assign to the field directly
generateDummyFieldAccess = !isAssignmentTarget;
}
else if (field.ReceiverOpt is BoundArrayAccess arrayAccess)
{
// an arrayAccess returns a ref so can only be called after the await, but spill expression and indices
var expression = VisitExpression(ref leftBuilder, arrayAccess.Expression);
expression = Spill(leftBuilder, expression, RefKind.None);
var indices = this.VisitExpressionList(ref leftBuilder, arrayAccess.Indices, forceSpill: true);
receiver = arrayAccess.Update(expression, indices, arrayAccess.Type);
// dummy array access to trigger IndexOutRangeException or NRE
// we only need this if the array access is a receiver since
// a[0] = b triggers a NRE/IORE on assignment
// but a[0].b = c triggers an NRE/IORE before evaluating c
Spill(leftBuilder, receiver, sideEffectsOnly: true);
}
else if (field.ReceiverOpt is BoundFieldAccess receiverField)
{
receiver = fieldWithSpilledReceiver(receiverField, ref leftBuilder, isAssignmentTarget: false);
}
else
{
receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt), RefKind.Ref);
}
field = field.Update(receiver, field.FieldSymbol, field.ConstantValueOpt, field.ResultKind, field.Type);
}
if (generateDummyFieldAccess)
{
Spill(leftBuilder, field, sideEffectsOnly: true);
}
return field;
}
}
public override BoundNode VisitBadExpression(BoundBadExpression node)
{
// Cannot recurse into BadExpression children
return node;
}
public override BoundNode VisitUserDefinedConditionalLogicalOperator(BoundUserDefinedConditionalLogicalOperator node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitBinaryOperator(BoundBinaryOperator node)
{
BoundSpillSequenceBuilder builder = null;
var right = VisitExpression(ref builder, node.Right);
BoundExpression left;
if (builder == null)
{
left = VisitExpression(ref builder, node.Left);
}
else
{
var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
left = VisitExpression(ref leftBuilder, node.Left);
left = Spill(leftBuilder, left);
if (node.OperatorKind == BinaryOperatorKind.LogicalBoolOr || node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd)
{
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
leftBuilder.AddLocal(tmp);
leftBuilder.AddStatement(_F.Assignment(_F.Local(tmp), left));
leftBuilder.AddStatement(_F.If(
node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd ? _F.Local(tmp) : _F.Not(_F.Local(tmp)),
UpdateStatement(builder, _F.Assignment(_F.Local(tmp), right))));
return UpdateExpression(leftBuilder, _F.Local(tmp));
}
else
{
// if the right-hand-side has await, spill the left
leftBuilder.Include(builder);
builder = leftBuilder;
}
}
return UpdateExpression(builder, node.Update(node.OperatorKind, node.ConstantValue, node.Method, node.ConstrainedToType, node.ResultKind, left, right, node.Type));
}
public override BoundNode VisitCall(BoundCall node)
{
BoundSpillSequenceBuilder builder = null;
var arguments = this.VisitExpressionList(ref builder, node.Arguments, node.ArgumentRefKindsOpt);
BoundExpression receiver = null;
if (builder == null || node.ReceiverOpt is BoundTypeExpression)
{
receiver = VisitExpression(ref builder, node.ReceiverOpt);
}
else if (node.Method.RequiresInstanceReceiver)
{
// spill the receiver if there were await expressions in the arguments
var receiverBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
receiver = node.ReceiverOpt;
RefKind refKind = ReceiverSpillRefKind(receiver);
receiver = Spill(receiverBuilder, VisitExpression(ref receiverBuilder, receiver), refKind: refKind);
receiverBuilder.Include(builder);
builder = receiverBuilder;
}
return UpdateExpression(builder, node.Update(receiver, node.Method, arguments));
}
private static RefKind ReceiverSpillRefKind(BoundExpression receiver)
{
var result = RefKind.None;
if (!receiver.Type.IsReferenceType && LocalRewriter.CanBePassedByReference(receiver))
{
result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref;
}
return result;
}
public override BoundNode VisitConditionalOperator(BoundConditionalOperator node)
{
BoundSpillSequenceBuilder conditionBuilder = null;
var condition = VisitExpression(ref conditionBuilder, node.Condition);
BoundSpillSequenceBuilder consequenceBuilder = null;
var consequence = VisitExpression(ref consequenceBuilder, node.Consequence);
BoundSpillSequenceBuilder alternativeBuilder = null;
var alternative = VisitExpression(ref alternativeBuilder, node.Alternative);
if (consequenceBuilder == null && alternativeBuilder == null)
{
return UpdateExpression(conditionBuilder, node.Update(node.IsRef, condition, consequence, alternative, node.ConstantValueOpt, node.NaturalTypeOpt, node.WasTargetTyped, node.Type));
}
if (conditionBuilder == null) conditionBuilder = new BoundSpillSequenceBuilder((consequenceBuilder ?? alternativeBuilder).Syntax);
if (consequenceBuilder == null) consequenceBuilder = new BoundSpillSequenceBuilder(alternativeBuilder.Syntax);
if (alternativeBuilder == null) alternativeBuilder = new BoundSpillSequenceBuilder(consequenceBuilder.Syntax);
if (node.Type.IsVoidType())
{
conditionBuilder.AddStatement(
_F.If(condition,
UpdateStatement(consequenceBuilder, _F.ExpressionStatement(consequence)),
UpdateStatement(alternativeBuilder, _F.ExpressionStatement(alternative))));
return conditionBuilder.Update(_F.Default(node.Type));
}
else
{
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
conditionBuilder.AddLocal(tmp);
conditionBuilder.AddStatement(
_F.If(condition,
UpdateStatement(consequenceBuilder, _F.Assignment(_F.Local(tmp), consequence)),
UpdateStatement(alternativeBuilder, _F.Assignment(_F.Local(tmp), alternative))));
return conditionBuilder.Update(_F.Local(tmp));
}
}
public override BoundNode VisitConversion(BoundConversion node)
{
if (node.ConversionKind == ConversionKind.AnonymousFunction && node.Type.IsExpressionTree())
{
// Expression trees do not contain any code that requires spilling.
return node;
}
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(
builder,
node.UpdateOperand(operand));
}
public override BoundNode VisitPassByCopy(BoundPassByCopy node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateExpression(
builder,
node.Update(
expression,
type: node.Type));
}
public override BoundNode VisitMethodGroup(BoundMethodGroup node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationExpression node)
{
BoundSpillSequenceBuilder builder = null;
var argument = VisitExpression(ref builder, node.Argument);
return UpdateExpression(builder, node.Update(argument, node.MethodOpt, node.IsExtensionMethod, node.Type));
}
public override BoundNode VisitFieldAccess(BoundFieldAccess node)
{
BoundSpillSequenceBuilder builder = null;
var receiver = VisitExpression(ref builder, node.ReceiverOpt);
return UpdateExpression(builder, node.Update(receiver, node.FieldSymbol, node.ConstantValueOpt, node.ResultKind, node.Type));
}
public override BoundNode VisitIsOperator(BoundIsOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.TargetType, node.Conversion, node.Type));
}
public override BoundNode VisitMakeRefOperator(BoundMakeRefOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.Type));
}
public override BoundNode VisitNullCoalescingOperator(BoundNullCoalescingOperator node)
{
BoundSpillSequenceBuilder builder = null;
var right = VisitExpression(ref builder, node.RightOperand);
BoundExpression left;
if (builder == null)
{
left = VisitExpression(ref builder, node.LeftOperand);
}
else
{
var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
left = VisitExpression(ref leftBuilder, node.LeftOperand);
left = Spill(leftBuilder, left);
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
leftBuilder.AddLocal(tmp);
leftBuilder.AddStatement(_F.Assignment(_F.Local(tmp), left));
leftBuilder.AddStatement(_F.If(
_F.ObjectEqual(_F.Local(tmp), _F.Null(left.Type)),
UpdateStatement(builder, _F.Assignment(_F.Local(tmp), right))));
return UpdateExpression(leftBuilder, _F.Local(tmp));
}
return UpdateExpression(builder, node.Update(left, right, node.LeftConversion, node.OperatorResultKind, node.Type));
}
public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalAccess node)
{
var receiverRefKind = ReceiverSpillRefKind(node.Receiver);
BoundSpillSequenceBuilder receiverBuilder = null;
var receiver = VisitExpression(ref receiverBuilder, node.Receiver);
BoundSpillSequenceBuilder whenNotNullBuilder = null;
var whenNotNull = VisitExpression(ref whenNotNullBuilder, node.WhenNotNull);
BoundSpillSequenceBuilder whenNullBuilder = null;
var whenNullOpt = VisitExpression(ref whenNullBuilder, node.WhenNullOpt);
if (whenNotNullBuilder == null && whenNullBuilder == null)
{
return UpdateExpression(receiverBuilder, node.Update(receiver, node.HasValueMethodOpt, whenNotNull, whenNullOpt, node.Id, node.Type));
}
if (receiverBuilder == null) receiverBuilder = new BoundSpillSequenceBuilder((whenNotNullBuilder ?? whenNullBuilder).Syntax);
if (whenNotNullBuilder == null) whenNotNullBuilder = new BoundSpillSequenceBuilder(whenNullBuilder.Syntax);
if (whenNullBuilder == null) whenNullBuilder = new BoundSpillSequenceBuilder(whenNotNullBuilder.Syntax);
BoundExpression condition;
if (receiver.Type.IsReferenceType || receiver.Type.IsValueType || receiverRefKind == RefKind.None)
{
// spill to a clone
receiver = Spill(receiverBuilder, receiver, RefKind.None);
var hasValueOpt = node.HasValueMethodOpt;
if (hasValueOpt == null)
{
condition = _F.ObjectNotEqual(
_F.Convert(_F.SpecialType(SpecialType.System_Object), receiver),
_F.Null(_F.SpecialType(SpecialType.System_Object)));
}
else
{
condition = _F.Call(receiver, hasValueOpt);
}
}
else
{
Debug.Assert(node.HasValueMethodOpt == null);
receiver = Spill(receiverBuilder, receiver, RefKind.Ref);
var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill);
receiverBuilder.AddLocal(clone);
// (object)default(T) != null
var isNotClass = _F.ObjectNotEqual(
_F.Convert(_F.SpecialType(SpecialType.System_Object), _F.Default(receiver.Type)),
_F.Null(_F.SpecialType(SpecialType.System_Object)));
// isNotCalss || {clone = receiver; (object)clone != null}
condition = _F.LogicalOr(
isNotClass,
_F.MakeSequence(
_F.AssignmentExpression(_F.Local(clone), receiver),
_F.ObjectNotEqual(
_F.Convert(_F.SpecialType(SpecialType.System_Object), _F.Local(clone)),
_F.Null(_F.SpecialType(SpecialType.System_Object))))
);
receiver = _F.ComplexConditionalReceiver(receiver, _F.Local(clone));
}
if (node.Type.IsVoidType())
{
var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull));
whenNotNullStatement = ConditionalReceiverReplacer.Replace(whenNotNullStatement, receiver, node.Id, RecursionDepth);
Debug.Assert(whenNullOpt == null || !LocalRewriter.ReadIsSideeffecting(whenNullOpt));
receiverBuilder.AddStatement(_F.If(condition, whenNotNullStatement));
return receiverBuilder.Update(_F.Default(node.Type));
}
else
{
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull));
whenNotNullStatement = ConditionalReceiverReplacer.Replace(whenNotNullStatement, receiver, node.Id, RecursionDepth);
whenNullOpt = whenNullOpt ?? _F.Default(node.Type);
receiverBuilder.AddLocal(tmp);
receiverBuilder.AddStatement(
_F.If(condition,
whenNotNullStatement,
UpdateStatement(whenNullBuilder, _F.Assignment(_F.Local(tmp), whenNullOpt))));
return receiverBuilder.Update(_F.Local(tmp));
}
}
private sealed class ConditionalReceiverReplacer : BoundTreeRewriterWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
{
private readonly BoundExpression _receiver;
private readonly int _receiverId;
#if DEBUG
// we must replace exactly one node
private int _replaced;
#endif
private ConditionalReceiverReplacer(BoundExpression receiver, int receiverId, int recursionDepth)
: base(recursionDepth)
{
_receiver = receiver;
_receiverId = receiverId;
}
public static BoundStatement Replace(BoundNode node, BoundExpression receiver, int receiverID, int recursionDepth)
{
var replacer = new ConditionalReceiverReplacer(receiver, receiverID, recursionDepth);
var result = (BoundStatement)replacer.Visit(node);
#if DEBUG
Debug.Assert(replacer._replaced == 1, "should have replaced exactly one node");
#endif
return result;
}
public override BoundNode VisitConditionalReceiver(BoundConditionalReceiver node)
{
if (node.Id == _receiverId)
{
#if DEBUG
_replaced++;
#endif
return _receiver;
}
return node;
}
}
public override BoundNode VisitLambda(BoundLambda node)
{
var oldCurrentFunction = _F.CurrentFunction;
_F.CurrentFunction = node.Symbol;
var result = base.VisitLambda(node);
_F.CurrentFunction = oldCurrentFunction;
return result;
}
public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatement node)
{
var oldCurrentFunction = _F.CurrentFunction;
_F.CurrentFunction = node.Symbol;
var result = base.VisitLocalFunctionStatement(node);
_F.CurrentFunction = oldCurrentFunction;
return result;
}
public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
{
Debug.Assert(node.InitializerExpressionOpt == null);
BoundSpillSequenceBuilder builder = null;
var arguments = this.VisitExpressionList(ref builder, node.Arguments, node.ArgumentRefKindsOpt);
return UpdateExpression(builder, node.Update(node.Constructor, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.DefaultArguments, node.ConstantValueOpt, node.InitializerExpressionOpt, node.Type));
}
public override BoundNode VisitPointerElementAccess(BoundPointerElementAccess node)
{
BoundSpillSequenceBuilder builder = null;
var index = VisitExpression(ref builder, node.Index);
BoundExpression expression;
if (builder == null)
{
expression = VisitExpression(ref builder, node.Expression);
}
else
{
var expressionBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
expression = VisitExpression(ref expressionBuilder, node.Expression);
expression = Spill(expressionBuilder, expression);
expressionBuilder.Include(builder);
builder = expressionBuilder;
}
return UpdateExpression(builder, node.Update(expression, index, node.Checked, node.Type));
}
public override BoundNode VisitPointerIndirectionOperator(BoundPointerIndirectionOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.Type));
}
public override BoundNode VisitSequence(BoundSequence node)
{
BoundSpillSequenceBuilder valueBuilder = null;
var value = VisitExpression(ref valueBuilder, node.Value);
BoundSpillSequenceBuilder builder = null;
var sideEffects = VisitExpressionList(ref builder, node.SideEffects, forceSpill: valueBuilder != null, sideEffectsOnly: true);
if (builder == null && valueBuilder == null)
{
return node.Update(node.Locals, sideEffects, value, node.Type);
}
if (builder == null)
{
builder = new BoundSpillSequenceBuilder(valueBuilder.Syntax);
}
PromoteAndAddLocals(builder, node.Locals);
builder.AddExpressions(sideEffects);
builder.Include(valueBuilder);
return builder.Update(value);
}
public override BoundNode VisitThrowExpression(BoundThrowExpression node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression operand = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(operand, node.Type));
}
/// <summary>
/// If an expression node that declares synthesized short-lived locals (currently only sequence) contains
/// a spill sequence (from an await or switch expression), these locals become long-lived since their
/// values may be read by code that follows. We promote these variables to long-lived of kind
/// <see cref="SynthesizedLocalKind.Spill"/>.
/// </summary>
private void PromoteAndAddLocals(BoundSpillSequenceBuilder builder, ImmutableArray<LocalSymbol> locals)
{
foreach (var local in locals)
{
if (local.SynthesizedKind.IsLongLived())
{
builder.AddLocal(local);
}
else
{
LocalSymbol longLived = local.WithSynthesizedLocalKindAndSyntax(SynthesizedLocalKind.Spill, _F.Syntax);
_tempSubstitution.Add(local, longLived);
builder.AddLocal(longLived);
}
}
}
public override BoundNode VisitUnaryOperator(BoundUnaryOperator node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(node.OperatorKind, operand, node.ConstantValueOpt, node.MethodOpt, node.ConstrainedToTypeOpt, node.ResultKind, node.Type));
}
public override BoundNode VisitReadOnlySpanFromArray(BoundReadOnlySpanFromArray node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.ConversionMethod, node.Type));
}
public override BoundNode VisitSequencePointExpression(BoundSequencePointExpression node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression expression = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(expression, node.Type));
}
#endregion
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
internal sealed class SpillSequenceSpiller : BoundTreeRewriterWithStackGuard
{
private const BoundKind SpillSequenceBuilderKind = (BoundKind)byte.MaxValue;
private readonly SyntheticBoundNodeFactory _F;
private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
private SpillSequenceSpiller(MethodSymbol method, SyntaxNode syntaxNode, TypeCompilationState compilationState, PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution, BindingDiagnosticBag diagnostics)
{
_F = new SyntheticBoundNodeFactory(method, syntaxNode, compilationState, diagnostics);
_F.CurrentFunction = method;
_tempSubstitution = tempSubstitution;
}
private sealed class BoundSpillSequenceBuilder : BoundExpression
{
public readonly BoundExpression Value;
private ArrayBuilder<LocalSymbol> _locals;
private ArrayBuilder<BoundStatement> _statements;
public BoundSpillSequenceBuilder(SyntaxNode syntax, BoundExpression value = null)
: base(SpillSequenceBuilderKind, syntax, value?.Type)
{
Debug.Assert(value?.Kind != SpillSequenceBuilderKind);
this.Value = value;
}
public bool HasStatements
{
get
{
return _statements != null;
}
}
public bool HasLocals
{
get
{
return _locals != null;
}
}
public ImmutableArray<LocalSymbol> GetLocals()
{
return (_locals == null) ? ImmutableArray<LocalSymbol>.Empty : _locals.ToImmutable();
}
public ImmutableArray<BoundStatement> GetStatements()
{
if (_statements == null)
{
return ImmutableArray<BoundStatement>.Empty;
}
return _statements.ToImmutable();
}
internal BoundSpillSequenceBuilder Update(BoundExpression value)
{
var result = new BoundSpillSequenceBuilder(this.Syntax, value);
result._locals = _locals;
result._statements = _statements;
return result;
}
public void Free()
{
if (_locals != null) _locals.Free();
if (_statements != null) _statements.Free();
}
internal void Include(BoundSpillSequenceBuilder other)
{
if (other != null)
{
IncludeAndFree(ref _locals, ref other._locals);
IncludeAndFree(ref _statements, ref other._statements);
}
}
private static void IncludeAndFree<T>(ref ArrayBuilder<T> left, ref ArrayBuilder<T> right)
{
if (right == null)
{
return;
}
if (left == null)
{
left = right;
return;
}
left.AddRange(right);
right.Free();
}
public void AddLocal(LocalSymbol local)
{
if (_locals == null)
{
_locals = ArrayBuilder<LocalSymbol>.GetInstance();
}
_locals.Add(local);
}
public void AddLocals(ImmutableArray<LocalSymbol> locals)
{
foreach (var local in locals)
{
AddLocal(local);
}
}
public void AddStatement(BoundStatement statement)
{
if (_statements == null)
{
_statements = ArrayBuilder<BoundStatement>.GetInstance();
}
_statements.Add(statement);
}
public void AddStatements(ImmutableArray<BoundStatement> statements)
{
foreach (var statement in statements)
{
AddStatement(statement);
}
}
internal void AddExpressions(ImmutableArray<BoundExpression> expressions)
{
foreach (var expression in expressions)
{
AddStatement(new BoundExpressionStatement(expression.Syntax, expression) { WasCompilerGenerated = true });
}
}
#if DEBUG
internal override string Dump()
{
var node = new TreeDumperNode("boundSpillSequenceBuilder", null, new TreeDumperNode[]
{
new TreeDumperNode("locals", this.GetLocals(), null),
new TreeDumperNode("statements", null, from x in this.GetStatements() select BoundTreeDumperNodeProducer.MakeTree(x)),
new TreeDumperNode("value", null, new TreeDumperNode[] { BoundTreeDumperNodeProducer.MakeTree(this.Value) }),
new TreeDumperNode("type", this.Type, null)
});
return TreeDumper.DumpCompact(node);
}
#endif
}
private sealed class LocalSubstituter : BoundTreeRewriterWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
{
private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
private LocalSubstituter(PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution, int recursionDepth = 0)
: base(recursionDepth)
{
_tempSubstitution = tempSubstitution;
}
public static BoundNode Rewrite(PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution, BoundNode node)
{
if (tempSubstitution.Count == 0)
{
return node;
}
var substituter = new LocalSubstituter(tempSubstitution);
return substituter.Visit(node);
}
public override BoundNode VisitLocal(BoundLocal node)
{
if (!node.LocalSymbol.SynthesizedKind.IsLongLived())
{
LocalSymbol longLived;
if (_tempSubstitution.TryGetValue(node.LocalSymbol, out longLived))
{
return node.Update(longLived, node.ConstantValueOpt, node.Type);
}
}
return base.VisitLocal(node);
}
}
internal static BoundStatement Rewrite(BoundStatement body, MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
{
var tempSubstitution = PooledDictionary<LocalSymbol, LocalSymbol>.GetInstance();
var spiller = new SpillSequenceSpiller(method, body.Syntax, compilationState, tempSubstitution, diagnostics);
BoundNode result = spiller.Visit(body);
result = LocalSubstituter.Rewrite(tempSubstitution, result);
tempSubstitution.Free();
return (BoundStatement)result;
}
private BoundExpression VisitExpression(ref BoundSpillSequenceBuilder builder, BoundExpression expression)
{
var e = (BoundExpression)this.Visit(expression);
if (e == null || e.Kind != SpillSequenceBuilderKind)
{
return e;
}
var newBuilder = (BoundSpillSequenceBuilder)e;
if (builder == null)
{
builder = newBuilder.Update(null);
}
else
{
builder.Include(newBuilder);
}
return newBuilder.Value;
}
private static BoundExpression UpdateExpression(BoundSpillSequenceBuilder builder, BoundExpression expression)
{
if (builder == null)
{
return expression;
}
Debug.Assert(builder.Value == null);
if (!builder.HasLocals && !builder.HasStatements)
{
builder.Free();
return expression;
}
return builder.Update(expression);
}
private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundStatement statement)
{
if (builder == null)
{
Debug.Assert(statement != null);
return statement;
}
Debug.Assert(builder.Value == null);
if (statement != null)
{
builder.AddStatement(statement);
}
var result = new BoundBlock(statement.Syntax, builder.GetLocals(), builder.GetStatements()) { WasCompilerGenerated = true };
builder.Free();
return result;
}
private BoundExpression Spill(
BoundSpillSequenceBuilder builder,
BoundExpression expression,
RefKind refKind = RefKind.None,
bool sideEffectsOnly = false)
{
Debug.Assert(builder != null);
if (builder.Syntax != null)
_F.Syntax = builder.Syntax;
while (true)
{
switch (expression.Kind)
{
case BoundKind.ArrayInitialization:
Debug.Assert(refKind == RefKind.None);
Debug.Assert(!sideEffectsOnly);
var arrayInitialization = (BoundArrayInitialization)expression;
var newInitializers = VisitExpressionList(ref builder, arrayInitialization.Initializers, forceSpill: true);
return arrayInitialization.Update(newInitializers);
case BoundKind.ArgListOperator:
Debug.Assert(refKind == RefKind.None);
Debug.Assert(!sideEffectsOnly);
var argumentList = (BoundArgListOperator)expression;
var newArgs = VisitExpressionList(ref builder, argumentList.Arguments, argumentList.ArgumentRefKindsOpt, forceSpill: true);
return argumentList.Update(newArgs, argumentList.ArgumentRefKindsOpt, argumentList.Type);
case SpillSequenceBuilderKind:
var sequenceBuilder = (BoundSpillSequenceBuilder)expression;
builder.Include(sequenceBuilder);
expression = sequenceBuilder.Value;
continue;
case BoundKind.Sequence:
// neither the side-effects nor the value of the sequence contains await
// (otherwise it would be converted to a SpillSequenceBuilder).
if (refKind != RefKind.None)
{
return expression;
}
goto default;
case BoundKind.ThisReference:
case BoundKind.BaseReference:
if (refKind != RefKind.None || expression.Type.IsReferenceType)
{
return expression;
}
goto default;
case BoundKind.Parameter:
if (refKind != RefKind.None)
{
return expression;
}
goto default;
case BoundKind.Local:
var local = (BoundLocal)expression;
if (local.LocalSymbol.SynthesizedKind == SynthesizedLocalKind.Spill || refKind != RefKind.None)
{
return local;
}
goto default;
case BoundKind.FieldAccess:
var field = (BoundFieldAccess)expression;
var fieldSymbol = field.FieldSymbol;
if (fieldSymbol.IsStatic)
{
// no need to spill static fields if used as locations or if readonly
if (refKind != RefKind.None || fieldSymbol.IsReadOnly)
{
return field;
}
goto default;
}
if (refKind == RefKind.None) goto default;
var receiver = Spill(builder, field.ReceiverOpt, fieldSymbol.ContainingType.IsValueType ? refKind : RefKind.None);
return field.Update(receiver, fieldSymbol, field.ConstantValueOpt, field.ResultKind, field.Type);
case BoundKind.Literal:
case BoundKind.TypeExpression:
return expression;
case BoundKind.ConditionalReceiver:
// we will rewrite this as a part of rewriting whole LoweredConditionalAccess
// later, if needed
return expression;
default:
if (expression.Type.IsVoidType() || sideEffectsOnly)
{
builder.AddStatement(_F.ExpressionStatement(expression));
return null;
}
else
{
BoundAssignmentOperator assignToTemp;
var replacement = _F.StoreToTemp(
expression,
out assignToTemp,
refKind: refKind,
kind: SynthesizedLocalKind.Spill,
syntaxOpt: _F.Syntax);
builder.AddLocal(replacement.LocalSymbol);
builder.AddStatement(_F.ExpressionStatement(assignToTemp));
return replacement;
}
}
}
}
private ImmutableArray<BoundExpression> VisitExpressionList(
ref BoundSpillSequenceBuilder builder,
ImmutableArray<BoundExpression> args,
ImmutableArray<RefKind> refKinds = default(ImmutableArray<RefKind>),
bool forceSpill = false,
bool sideEffectsOnly = false)
{
Debug.Assert(!sideEffectsOnly || refKinds.IsDefault);
Debug.Assert(refKinds.IsDefault || refKinds.Length == args.Length);
if (args.Length == 0)
{
return args;
}
var newList = VisitList(args);
Debug.Assert(newList.Length == args.Length);
int lastSpill;
if (forceSpill)
{
lastSpill = newList.Length;
}
else
{
lastSpill = -1;
for (int i = newList.Length - 1; i >= 0; i--)
{
if (newList[i].Kind == SpillSequenceBuilderKind)
{
lastSpill = i;
break;
}
}
}
if (lastSpill == -1)
{
return newList;
}
if (builder == null)
{
builder = new BoundSpillSequenceBuilder(lastSpill < newList.Length ? (newList[lastSpill] as BoundSpillSequenceBuilder)?.Syntax : null);
}
var result = ArrayBuilder<BoundExpression>.GetInstance(newList.Length);
// everything up until the last spill must be spilled entirely
for (int i = 0; i < lastSpill; i++)
{
var refKind = refKinds.IsDefault ? RefKind.None : refKinds[i];
var replacement = Spill(builder, newList[i], refKind, sideEffectsOnly);
Debug.Assert(sideEffectsOnly || replacement != null);
if (!sideEffectsOnly)
{
result.Add(replacement);
}
}
// the value of the last spill and everything that follows is not spilled
if (lastSpill < newList.Length)
{
var lastSpillNode = (BoundSpillSequenceBuilder)newList[lastSpill];
builder.Include(lastSpillNode);
result.Add(lastSpillNode.Value);
for (int i = lastSpill + 1; i < newList.Length; i++)
{
result.Add(newList[i]);
}
}
return result.ToImmutableAndFree();
}
#region Statement Visitors
public override BoundNode VisitSwitchDispatch(BoundSwitchDispatch node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateStatement(builder, node.Update(expression, node.Cases, node.DefaultLabel, node.EqualityMethod));
}
public override BoundNode VisitThrowStatement(BoundThrowStatement node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression expression = VisitExpression(ref builder, node.ExpressionOpt);
return UpdateStatement(builder, node.Update(expression));
}
public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression expr = VisitExpression(ref builder, node.Expression);
Debug.Assert(expr != null);
Debug.Assert(builder == null || builder.Value == null);
return UpdateStatement(builder, node.Update(expr));
}
public override BoundNode VisitConditionalGoto(BoundConditionalGoto node)
{
BoundSpillSequenceBuilder builder = null;
var condition = VisitExpression(ref builder, node.Condition);
return UpdateStatement(builder, node.Update(condition, node.JumpIfTrue, node.Label));
}
public override BoundNode VisitReturnStatement(BoundReturnStatement node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.ExpressionOpt);
return UpdateStatement(builder, node.Update(node.RefKind, expression));
}
public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateStatement(builder, node.Update(expression));
}
public override BoundNode VisitCatchBlock(BoundCatchBlock node)
{
BoundExpression exceptionSourceOpt = (BoundExpression)this.Visit(node.ExceptionSourceOpt);
var locals = node.Locals;
var exceptionFilterPrologueOpt = node.ExceptionFilterPrologueOpt;
Debug.Assert(exceptionFilterPrologueOpt is null); // it is introduced by this pass
BoundSpillSequenceBuilder builder = null;
var exceptionFilterOpt = VisitExpression(ref builder, node.ExceptionFilterOpt);
if (builder is { })
{
Debug.Assert(builder.Value is null);
locals = locals.AddRange(builder.GetLocals());
exceptionFilterPrologueOpt = new BoundStatementList(node.Syntax, builder.GetStatements());
}
BoundBlock body = (BoundBlock)this.Visit(node.Body);
TypeSymbol exceptionTypeOpt = this.VisitType(node.ExceptionTypeOpt);
return node.Update(locals, exceptionSourceOpt, exceptionTypeOpt, exceptionFilterPrologueOpt, exceptionFilterOpt, body, node.IsSynthesizedAsyncCatchAll);
}
#if DEBUG
public override BoundNode DefaultVisit(BoundNode node)
{
Debug.Assert(!(node is BoundStatement));
return base.DefaultVisit(node);
}
#endif
#endregion
#region Expression Visitors
public override BoundNode VisitAwaitExpression(BoundAwaitExpression node)
{
// An await expression has already been wrapped in a BoundSpillSequence if not at the top level, so
// the spilling will occur in the enclosing node.
BoundSpillSequenceBuilder builder = null;
var expr = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(expr, node.AwaitableInfo, node.Type));
}
public override BoundNode VisitSpillSequence(BoundSpillSequence node)
{
var builder = new BoundSpillSequenceBuilder(node.Syntax);
// Ensure later errors (e.g. in async rewriting) are associated with the correct node.
_F.Syntax = node.Syntax;
builder.AddStatements(VisitList(node.SideEffects));
builder.AddLocals(node.Locals);
var value = VisitExpression(ref builder, node.Value);
return builder.Update(value);
}
public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node)
{
BoundSpillSequenceBuilder builder = null;
var expr = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(expr, node.IsManaged, node.Type));
}
public override BoundNode VisitArgListOperator(BoundArgListOperator node)
{
BoundSpillSequenceBuilder builder = null;
var newArgs = VisitExpressionList(ref builder, node.Arguments);
return UpdateExpression(builder, node.Update(newArgs, node.ArgumentRefKindsOpt, node.Type));
}
public override BoundNode VisitArrayAccess(BoundArrayAccess node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
BoundSpillSequenceBuilder indicesBuilder = null;
var indices = this.VisitExpressionList(ref indicesBuilder, node.Indices);
if (indicesBuilder != null)
{
// spill the array if there were await expressions in the indices
if (builder == null)
{
builder = new BoundSpillSequenceBuilder(indicesBuilder.Syntax);
}
expression = Spill(builder, expression);
}
if (builder != null)
{
builder.Include(indicesBuilder);
indicesBuilder = builder;
builder = null;
}
return UpdateExpression(indicesBuilder, node.Update(expression, indices, node.Type));
}
public override BoundNode VisitArrayCreation(BoundArrayCreation node)
{
BoundSpillSequenceBuilder builder = null;
var init = (BoundArrayInitialization)VisitExpression(ref builder, node.InitializerOpt);
ImmutableArray<BoundExpression> bounds;
if (builder == null)
{
bounds = VisitExpressionList(ref builder, node.Bounds);
}
else
{
// spill bounds expressions if initializers contain await
var boundsBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
bounds = VisitExpressionList(ref boundsBuilder, node.Bounds, forceSpill: true);
boundsBuilder.Include(builder);
builder = boundsBuilder;
}
return UpdateExpression(builder, node.Update(bounds, init, node.Type));
}
public override BoundNode VisitArrayInitialization(BoundArrayInitialization node)
{
BoundSpillSequenceBuilder builder = null;
var initializers = this.VisitExpressionList(ref builder, node.Initializers);
return UpdateExpression(builder, node.Update(initializers));
}
public override BoundNode VisitConvertedStackAllocExpression(BoundConvertedStackAllocExpression node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression count = VisitExpression(ref builder, node.Count);
var initializerOpt = (BoundArrayInitialization)VisitExpression(ref builder, node.InitializerOpt);
return UpdateExpression(builder, node.Update(node.ElementType, count, initializerOpt, node.Type));
}
public override BoundNode VisitArrayLength(BoundArrayLength node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(expression, node.Type));
}
public override BoundNode VisitAsOperator(BoundAsOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.TargetType, node.Conversion, node.Type));
}
public override BoundNode VisitAssignmentOperator(BoundAssignmentOperator node)
{
BoundSpillSequenceBuilder builder = null;
var right = VisitExpression(ref builder, node.Right);
BoundExpression left = node.Left;
if (builder == null)
{
left = VisitExpression(ref builder, left);
}
else
{
// if the right-hand-side has await, spill the left
var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
switch (left.Kind)
{
case BoundKind.Local:
case BoundKind.Parameter:
// locals and parameters are directly assignable, LHS is not on the stack so nothing to spill
break;
case BoundKind.FieldAccess:
var field = (BoundFieldAccess)left;
// static fields are directly assignable, LHS is not on the stack, nothing to spill
if (field.FieldSymbol.IsStatic) break;
// instance fields are directly assignable, but receiver is pushed, so need to spill that.
left = fieldWithSpilledReceiver(field, ref leftBuilder, isAssignmentTarget: true);
break;
case BoundKind.ArrayAccess:
var arrayAccess = (BoundArrayAccess)left;
// array and indices are pushed on stack so need to spill that
var expression = VisitExpression(ref leftBuilder, arrayAccess.Expression);
expression = Spill(leftBuilder, expression, RefKind.None);
var indices = this.VisitExpressionList(ref leftBuilder, arrayAccess.Indices, forceSpill: true);
left = arrayAccess.Update(expression, indices, arrayAccess.Type);
break;
default:
// must be something indirectly assignable, just visit and spill as an ordinary Ref (not a RefReadOnly!!)
//
// NOTE: in some cases this will result in spiller producing an error.
// For example if the LHS is a ref-returning method like
//
// obj.RefReturning(a, b, c) = await Something();
//
// the spiller would eventually have to spill the evaluation result of "refReturning" call as an ordinary Ref,
// which it can't.
left = Spill(leftBuilder, VisitExpression(ref leftBuilder, left), RefKind.Ref);
break;
}
leftBuilder.Include(builder);
builder = leftBuilder;
}
return UpdateExpression(builder, node.Update(left, right, node.IsRef, node.Type));
BoundExpression fieldWithSpilledReceiver(BoundFieldAccess field, ref BoundSpillSequenceBuilder leftBuilder, bool isAssignmentTarget)
{
var generateDummyFieldAccess = false;
if (!field.FieldSymbol.IsStatic)
{
Debug.Assert(field.ReceiverOpt is object);
BoundExpression receiver;
if (field.FieldSymbol.ContainingType.IsReferenceType)
{
// a reference type can always live across await so Spill using leftBuilder
receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt));
// dummy field access to trigger NRE
// a.b = c will trigger a NRE if a is null on assignment,
// but a.b.c = d will trigger a NRE if a is null before evaluating d
// so check whether we assign to the field directly
generateDummyFieldAccess = !isAssignmentTarget;
}
else if (field.ReceiverOpt is BoundArrayAccess arrayAccess)
{
// an arrayAccess returns a ref so can only be called after the await, but spill expression and indices
var expression = VisitExpression(ref leftBuilder, arrayAccess.Expression);
expression = Spill(leftBuilder, expression, RefKind.None);
var indices = this.VisitExpressionList(ref leftBuilder, arrayAccess.Indices, forceSpill: true);
receiver = arrayAccess.Update(expression, indices, arrayAccess.Type);
// dummy array access to trigger IndexOutRangeException or NRE
// we only need this if the array access is a receiver since
// a[0] = b triggers a NRE/IORE on assignment
// but a[0].b = c triggers an NRE/IORE before evaluating c
Spill(leftBuilder, receiver, sideEffectsOnly: true);
}
else if (field.ReceiverOpt is BoundFieldAccess receiverField)
{
receiver = fieldWithSpilledReceiver(receiverField, ref leftBuilder, isAssignmentTarget: false);
}
else
{
receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt), RefKind.Ref);
}
field = field.Update(receiver, field.FieldSymbol, field.ConstantValueOpt, field.ResultKind, field.Type);
}
if (generateDummyFieldAccess)
{
Spill(leftBuilder, field, sideEffectsOnly: true);
}
return field;
}
}
public override BoundNode VisitBadExpression(BoundBadExpression node)
{
// Cannot recurse into BadExpression children
return node;
}
public override BoundNode VisitUserDefinedConditionalLogicalOperator(BoundUserDefinedConditionalLogicalOperator node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitBinaryOperator(BoundBinaryOperator node)
{
BoundSpillSequenceBuilder builder = null;
var right = VisitExpression(ref builder, node.Right);
BoundExpression left;
if (builder == null)
{
left = VisitExpression(ref builder, node.Left);
}
else
{
var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
left = VisitExpression(ref leftBuilder, node.Left);
left = Spill(leftBuilder, left);
if (node.OperatorKind == BinaryOperatorKind.LogicalBoolOr || node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd)
{
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
leftBuilder.AddLocal(tmp);
leftBuilder.AddStatement(_F.Assignment(_F.Local(tmp), left));
leftBuilder.AddStatement(_F.If(
node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd ? _F.Local(tmp) : _F.Not(_F.Local(tmp)),
UpdateStatement(builder, _F.Assignment(_F.Local(tmp), right))));
return UpdateExpression(leftBuilder, _F.Local(tmp));
}
else
{
// if the right-hand-side has await, spill the left
leftBuilder.Include(builder);
builder = leftBuilder;
}
}
return UpdateExpression(builder, node.Update(node.OperatorKind, node.ConstantValue, node.Method, node.ConstrainedToType, node.ResultKind, left, right, node.Type));
}
public override BoundNode VisitCall(BoundCall node)
{
BoundSpillSequenceBuilder builder = null;
var arguments = this.VisitExpressionList(ref builder, node.Arguments, node.ArgumentRefKindsOpt);
BoundExpression receiver = null;
if (builder == null || node.ReceiverOpt is BoundTypeExpression)
{
receiver = VisitExpression(ref builder, node.ReceiverOpt);
}
else if (node.Method.RequiresInstanceReceiver)
{
// spill the receiver if there were await expressions in the arguments
var receiverBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
receiver = node.ReceiverOpt;
RefKind refKind = ReceiverSpillRefKind(receiver);
receiver = Spill(receiverBuilder, VisitExpression(ref receiverBuilder, receiver), refKind: refKind);
receiverBuilder.Include(builder);
builder = receiverBuilder;
}
return UpdateExpression(builder, node.Update(receiver, node.Method, arguments));
}
private static RefKind ReceiverSpillRefKind(BoundExpression receiver)
{
var result = RefKind.None;
if (!receiver.Type.IsReferenceType && LocalRewriter.CanBePassedByReference(receiver))
{
result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref;
}
return result;
}
public override BoundNode VisitConditionalOperator(BoundConditionalOperator node)
{
BoundSpillSequenceBuilder conditionBuilder = null;
var condition = VisitExpression(ref conditionBuilder, node.Condition);
BoundSpillSequenceBuilder consequenceBuilder = null;
var consequence = VisitExpression(ref consequenceBuilder, node.Consequence);
BoundSpillSequenceBuilder alternativeBuilder = null;
var alternative = VisitExpression(ref alternativeBuilder, node.Alternative);
if (consequenceBuilder == null && alternativeBuilder == null)
{
return UpdateExpression(conditionBuilder, node.Update(node.IsRef, condition, consequence, alternative, node.ConstantValueOpt, node.NaturalTypeOpt, node.WasTargetTyped, node.Type));
}
if (conditionBuilder == null) conditionBuilder = new BoundSpillSequenceBuilder((consequenceBuilder ?? alternativeBuilder).Syntax);
if (consequenceBuilder == null) consequenceBuilder = new BoundSpillSequenceBuilder(alternativeBuilder.Syntax);
if (alternativeBuilder == null) alternativeBuilder = new BoundSpillSequenceBuilder(consequenceBuilder.Syntax);
if (node.Type.IsVoidType())
{
conditionBuilder.AddStatement(
_F.If(condition,
UpdateStatement(consequenceBuilder, _F.ExpressionStatement(consequence)),
UpdateStatement(alternativeBuilder, _F.ExpressionStatement(alternative))));
return conditionBuilder.Update(_F.Default(node.Type));
}
else
{
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
conditionBuilder.AddLocal(tmp);
conditionBuilder.AddStatement(
_F.If(condition,
UpdateStatement(consequenceBuilder, _F.Assignment(_F.Local(tmp), consequence)),
UpdateStatement(alternativeBuilder, _F.Assignment(_F.Local(tmp), alternative))));
return conditionBuilder.Update(_F.Local(tmp));
}
}
public override BoundNode VisitConversion(BoundConversion node)
{
if (node.ConversionKind == ConversionKind.AnonymousFunction && node.Type.IsExpressionTree())
{
// Expression trees do not contain any code that requires spilling.
return node;
}
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(
builder,
node.UpdateOperand(operand));
}
public override BoundNode VisitPassByCopy(BoundPassByCopy node)
{
BoundSpillSequenceBuilder builder = null;
var expression = VisitExpression(ref builder, node.Expression);
return UpdateExpression(
builder,
node.Update(
expression,
type: node.Type));
}
public override BoundNode VisitMethodGroup(BoundMethodGroup node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationExpression node)
{
BoundSpillSequenceBuilder builder = null;
var argument = VisitExpression(ref builder, node.Argument);
return UpdateExpression(builder, node.Update(argument, node.MethodOpt, node.IsExtensionMethod, node.Type));
}
public override BoundNode VisitFieldAccess(BoundFieldAccess node)
{
BoundSpillSequenceBuilder builder = null;
var receiver = VisitExpression(ref builder, node.ReceiverOpt);
return UpdateExpression(builder, node.Update(receiver, node.FieldSymbol, node.ConstantValueOpt, node.ResultKind, node.Type));
}
public override BoundNode VisitIsOperator(BoundIsOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.TargetType, node.Conversion, node.Type));
}
public override BoundNode VisitMakeRefOperator(BoundMakeRefOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.Type));
}
public override BoundNode VisitNullCoalescingOperator(BoundNullCoalescingOperator node)
{
BoundSpillSequenceBuilder builder = null;
var right = VisitExpression(ref builder, node.RightOperand);
BoundExpression left;
if (builder == null)
{
left = VisitExpression(ref builder, node.LeftOperand);
}
else
{
var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
left = VisitExpression(ref leftBuilder, node.LeftOperand);
left = Spill(leftBuilder, left);
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
leftBuilder.AddLocal(tmp);
leftBuilder.AddStatement(_F.Assignment(_F.Local(tmp), left));
leftBuilder.AddStatement(_F.If(
_F.ObjectEqual(_F.Local(tmp), _F.Null(left.Type)),
UpdateStatement(builder, _F.Assignment(_F.Local(tmp), right))));
return UpdateExpression(leftBuilder, _F.Local(tmp));
}
return UpdateExpression(builder, node.Update(left, right, node.LeftConversion, node.OperatorResultKind, node.Type));
}
public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalAccess node)
{
var receiverRefKind = ReceiverSpillRefKind(node.Receiver);
BoundSpillSequenceBuilder receiverBuilder = null;
var receiver = VisitExpression(ref receiverBuilder, node.Receiver);
BoundSpillSequenceBuilder whenNotNullBuilder = null;
var whenNotNull = VisitExpression(ref whenNotNullBuilder, node.WhenNotNull);
BoundSpillSequenceBuilder whenNullBuilder = null;
var whenNullOpt = VisitExpression(ref whenNullBuilder, node.WhenNullOpt);
if (whenNotNullBuilder == null && whenNullBuilder == null)
{
return UpdateExpression(receiverBuilder, node.Update(receiver, node.HasValueMethodOpt, whenNotNull, whenNullOpt, node.Id, node.Type));
}
if (receiverBuilder == null) receiverBuilder = new BoundSpillSequenceBuilder((whenNotNullBuilder ?? whenNullBuilder).Syntax);
if (whenNotNullBuilder == null) whenNotNullBuilder = new BoundSpillSequenceBuilder(whenNullBuilder.Syntax);
if (whenNullBuilder == null) whenNullBuilder = new BoundSpillSequenceBuilder(whenNotNullBuilder.Syntax);
BoundExpression condition;
if (receiver.Type.IsReferenceType || receiver.Type.IsValueType || receiverRefKind == RefKind.None)
{
// spill to a clone
receiver = Spill(receiverBuilder, receiver, RefKind.None);
var hasValueOpt = node.HasValueMethodOpt;
if (hasValueOpt == null)
{
condition = _F.ObjectNotEqual(
_F.Convert(_F.SpecialType(SpecialType.System_Object), receiver),
_F.Null(_F.SpecialType(SpecialType.System_Object)));
}
else
{
condition = _F.Call(receiver, hasValueOpt);
}
}
else
{
Debug.Assert(node.HasValueMethodOpt == null);
receiver = Spill(receiverBuilder, receiver, RefKind.Ref);
var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill);
receiverBuilder.AddLocal(clone);
// (object)default(T) != null
var isNotClass = _F.ObjectNotEqual(
_F.Convert(_F.SpecialType(SpecialType.System_Object), _F.Default(receiver.Type)),
_F.Null(_F.SpecialType(SpecialType.System_Object)));
// isNotCalss || {clone = receiver; (object)clone != null}
condition = _F.LogicalOr(
isNotClass,
_F.MakeSequence(
_F.AssignmentExpression(_F.Local(clone), receiver),
_F.ObjectNotEqual(
_F.Convert(_F.SpecialType(SpecialType.System_Object), _F.Local(clone)),
_F.Null(_F.SpecialType(SpecialType.System_Object))))
);
receiver = _F.ComplexConditionalReceiver(receiver, _F.Local(clone));
}
if (node.Type.IsVoidType())
{
var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull));
whenNotNullStatement = ConditionalReceiverReplacer.Replace(whenNotNullStatement, receiver, node.Id, RecursionDepth);
Debug.Assert(whenNullOpt == null || !LocalRewriter.ReadIsSideeffecting(whenNullOpt));
receiverBuilder.AddStatement(_F.If(condition, whenNotNullStatement));
return receiverBuilder.Update(_F.Default(node.Type));
}
else
{
var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull));
whenNotNullStatement = ConditionalReceiverReplacer.Replace(whenNotNullStatement, receiver, node.Id, RecursionDepth);
whenNullOpt = whenNullOpt ?? _F.Default(node.Type);
receiverBuilder.AddLocal(tmp);
receiverBuilder.AddStatement(
_F.If(condition,
whenNotNullStatement,
UpdateStatement(whenNullBuilder, _F.Assignment(_F.Local(tmp), whenNullOpt))));
return receiverBuilder.Update(_F.Local(tmp));
}
}
private sealed class ConditionalReceiverReplacer : BoundTreeRewriterWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
{
private readonly BoundExpression _receiver;
private readonly int _receiverId;
#if DEBUG
// we must replace exactly one node
private int _replaced;
#endif
private ConditionalReceiverReplacer(BoundExpression receiver, int receiverId, int recursionDepth)
: base(recursionDepth)
{
_receiver = receiver;
_receiverId = receiverId;
}
public static BoundStatement Replace(BoundNode node, BoundExpression receiver, int receiverID, int recursionDepth)
{
var replacer = new ConditionalReceiverReplacer(receiver, receiverID, recursionDepth);
var result = (BoundStatement)replacer.Visit(node);
#if DEBUG
Debug.Assert(replacer._replaced == 1, "should have replaced exactly one node");
#endif
return result;
}
public override BoundNode VisitConditionalReceiver(BoundConditionalReceiver node)
{
if (node.Id == _receiverId)
{
#if DEBUG
_replaced++;
#endif
return _receiver;
}
return node;
}
}
public override BoundNode VisitLambda(BoundLambda node)
{
var oldCurrentFunction = _F.CurrentFunction;
_F.CurrentFunction = node.Symbol;
var result = base.VisitLambda(node);
_F.CurrentFunction = oldCurrentFunction;
return result;
}
public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatement node)
{
var oldCurrentFunction = _F.CurrentFunction;
_F.CurrentFunction = node.Symbol;
var result = base.VisitLocalFunctionStatement(node);
_F.CurrentFunction = oldCurrentFunction;
return result;
}
public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
{
Debug.Assert(node.InitializerExpressionOpt == null);
BoundSpillSequenceBuilder builder = null;
var arguments = this.VisitExpressionList(ref builder, node.Arguments, node.ArgumentRefKindsOpt);
return UpdateExpression(builder, node.Update(node.Constructor, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.DefaultArguments, node.ConstantValueOpt, node.InitializerExpressionOpt, node.Type));
}
public override BoundNode VisitPointerElementAccess(BoundPointerElementAccess node)
{
BoundSpillSequenceBuilder builder = null;
var index = VisitExpression(ref builder, node.Index);
BoundExpression expression;
if (builder == null)
{
expression = VisitExpression(ref builder, node.Expression);
}
else
{
var expressionBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
expression = VisitExpression(ref expressionBuilder, node.Expression);
expression = Spill(expressionBuilder, expression);
expressionBuilder.Include(builder);
builder = expressionBuilder;
}
return UpdateExpression(builder, node.Update(expression, index, node.Checked, node.Type));
}
public override BoundNode VisitPointerIndirectionOperator(BoundPointerIndirectionOperator node)
{
BoundSpillSequenceBuilder builder = null;
var operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.Type));
}
public override BoundNode VisitSequence(BoundSequence node)
{
BoundSpillSequenceBuilder valueBuilder = null;
var value = VisitExpression(ref valueBuilder, node.Value);
BoundSpillSequenceBuilder builder = null;
var sideEffects = VisitExpressionList(ref builder, node.SideEffects, forceSpill: valueBuilder != null, sideEffectsOnly: true);
if (builder == null && valueBuilder == null)
{
return node.Update(node.Locals, sideEffects, value, node.Type);
}
if (builder == null)
{
builder = new BoundSpillSequenceBuilder(valueBuilder.Syntax);
}
PromoteAndAddLocals(builder, node.Locals);
builder.AddExpressions(sideEffects);
builder.Include(valueBuilder);
return builder.Update(value);
}
public override BoundNode VisitThrowExpression(BoundThrowExpression node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression operand = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(operand, node.Type));
}
/// <summary>
/// If an expression node that declares synthesized short-lived locals (currently only sequence) contains
/// a spill sequence (from an await or switch expression), these locals become long-lived since their
/// values may be read by code that follows. We promote these variables to long-lived of kind
/// <see cref="SynthesizedLocalKind.Spill"/>.
/// </summary>
private void PromoteAndAddLocals(BoundSpillSequenceBuilder builder, ImmutableArray<LocalSymbol> locals)
{
foreach (var local in locals)
{
if (local.SynthesizedKind.IsLongLived())
{
builder.AddLocal(local);
}
else
{
LocalSymbol longLived = local.WithSynthesizedLocalKindAndSyntax(SynthesizedLocalKind.Spill, _F.Syntax);
_tempSubstitution.Add(local, longLived);
builder.AddLocal(longLived);
}
}
}
public override BoundNode VisitUnaryOperator(BoundUnaryOperator node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(node.OperatorKind, operand, node.ConstantValueOpt, node.MethodOpt, node.ConstrainedToTypeOpt, node.ResultKind, node.Type));
}
public override BoundNode VisitReadOnlySpanFromArray(BoundReadOnlySpanFromArray node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression operand = VisitExpression(ref builder, node.Operand);
return UpdateExpression(builder, node.Update(operand, node.ConversionMethod, node.Type));
}
public override BoundNode VisitSequencePointExpression(BoundSequencePointExpression node)
{
BoundSpillSequenceBuilder builder = null;
BoundExpression expression = VisitExpression(ref builder, node.Expression);
return UpdateExpression(builder, node.Update(expression, node.Type));
}
#endregion
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Analyzers/VisualBasic/Tests/PopulateSwitch/PopulateSwitchStatementTests_FixAllTests.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.PopulateSwitch
Partial Public Class PopulateSwitchStatementTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInDocument() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
{|FixAllInDocument:|}Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case Else
Exit Select
End Select
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInProject() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
{|FixAllInProject:|}Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case MyEnum3.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case MyEnum3.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInSolution() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
{|FixAllInSolution:|}Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case MyEnum3.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.PopulateSwitch
Partial Public Class PopulateSwitchStatementTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInDocument() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
{|FixAllInDocument:|}Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case Else
Exit Select
End Select
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInProject() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
{|FixAllInProject:|}Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case MyEnum3.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case MyEnum3.FizzBuzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsPopulateSwitch)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInSolution() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
{|FixAllInSolution:|}Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Enum MyEnum1
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum1.Fizz
Select Case e
Case MyEnum1.Fizz
Exit Select
Case MyEnum1.Buzz
Exit Select
Case MyEnum1.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Enum MyEnum2
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum2.Fizz
Select Case e
Case MyEnum2.Fizz
Exit Select
Case MyEnum2.Buzz
Exit Select
Case MyEnum2.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Enum MyEnum3
Fizz
Buzz
FizzBuzz
End Enum
Class Goo
Sub Bar()
Dim e = MyEnum3.Fizz
Select Case e
Case MyEnum3.Fizz
Exit Select
Case MyEnum3.Buzz
Exit Select
Case MyEnum3.FizzBuzz
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Analyzers/VisualBasic/Analyzers/UseConditionalExpression/VisualBasicUseConditionalExpressionForAssignmentDiagnosticAnalyzer.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.UseConditionalExpression
Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UseConditionalExpression
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicUseConditionalExpressionForAssignmentDiagnosticAnalyzer
Inherits AbstractUseConditionalExpressionForAssignmentDiagnosticAnalyzer(Of MultiLineIfBlockSyntax)
Public Sub New()
MyBase.New(New LocalizableResourceString(NameOf(VisualBasicAnalyzersResources.If_statement_can_be_simplified), VisualBasicAnalyzersResources.ResourceManager, GetType(VisualBasicAnalyzersResources)))
End Sub
Protected Overrides Function GetSyntaxFacts() As ISyntaxFacts
Return VisualBasicSyntaxFacts.Instance
End Function
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.UseConditionalExpression
Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UseConditionalExpression
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicUseConditionalExpressionForAssignmentDiagnosticAnalyzer
Inherits AbstractUseConditionalExpressionForAssignmentDiagnosticAnalyzer(Of MultiLineIfBlockSyntax)
Public Sub New()
MyBase.New(New LocalizableResourceString(NameOf(VisualBasicAnalyzersResources.If_statement_can_be_simplified), VisualBasicAnalyzersResources.ResourceManager, GetType(VisualBasicAnalyzersResources)))
End Sub
Protected Overrides Function GetSyntaxFacts() As ISyntaxFacts
Return VisualBasicSyntaxFacts.Instance
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/Core/CodeAnalysisTest/Collections/CachingFactoryTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.Collections
{
public class CachingFactoryTests
{
private sealed class CacheKey
{
public CacheKey(int value) { this.Value = value; }
public readonly int Value;
public static int GetHashCode(CacheKey key) { return key.Value; }
}
private sealed class CacheValue
{
public CacheValue(int value) { this.Value = value; }
public readonly int Value;
}
[WorkItem(620704, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/620704")]
[Fact]
public void ZeroHash()
{
var cache = new CachingFactory<CacheKey, CacheValue>(512,
k => new CacheValue(k.Value + 1),
k => k.Value,
(k, v) => k.Value == v.Value);
var key = new CacheKey(0);
Assert.Equal(0, CacheKey.GetHashCode(key));
CacheValue value;
bool found = cache.TryGetValue(key, out value);
Assert.False(found);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.Collections
{
public class CachingFactoryTests
{
private sealed class CacheKey
{
public CacheKey(int value) { this.Value = value; }
public readonly int Value;
public static int GetHashCode(CacheKey key) { return key.Value; }
}
private sealed class CacheValue
{
public CacheValue(int value) { this.Value = value; }
public readonly int Value;
}
[WorkItem(620704, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/620704")]
[Fact]
public void ZeroHash()
{
var cache = new CachingFactory<CacheKey, CacheValue>(512,
k => new CacheValue(k.Value + 1),
k => k.Value,
(k, v) => k.Value == v.Value);
var key = new CacheKey(0);
Assert.Equal(0, CacheKey.GetHashCode(key));
CacheValue value;
bool found = cache.TryGetValue(key, out value);
Assert.False(found);
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/Core/Portable/Emit/EditAndContinue/EncLocalInfo.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Emit
{
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
internal readonly struct EncLocalInfo : IEquatable<EncLocalInfo>
{
public readonly LocalSlotDebugInfo SlotInfo;
public readonly Cci.ITypeReference? Type;
public readonly LocalSlotConstraints Constraints;
public readonly byte[]? Signature;
public readonly bool IsUnused;
public EncLocalInfo(byte[] signature)
{
Debug.Assert(signature.Length > 0);
SlotInfo = new LocalSlotDebugInfo(SynthesizedLocalKind.EmitterTemp, LocalDebugId.None);
Type = null;
Constraints = LocalSlotConstraints.None;
Signature = signature;
IsUnused = true;
}
public EncLocalInfo(LocalSlotDebugInfo slotInfo, Cci.ITypeReference type, LocalSlotConstraints constraints, byte[]? signature)
{
SlotInfo = slotInfo;
Type = type;
Constraints = constraints;
Signature = signature;
IsUnused = false;
}
public bool IsDefault
=> Type is null && Signature is null;
public bool Equals(EncLocalInfo other)
{
return SlotInfo.Equals(other.SlotInfo) &&
Cci.SymbolEquivalentEqualityComparer.Instance.Equals(Type, other.Type) &&
Constraints == other.Constraints &&
IsUnused == other.IsUnused;
}
public override bool Equals(object? obj)
=> obj is EncLocalInfo info && Equals(info);
public override int GetHashCode()
{
Debug.Assert(Type != null);
return Hash.Combine(SlotInfo.GetHashCode(),
Hash.Combine(Cci.SymbolEquivalentEqualityComparer.Instance.GetHashCode(Type),
Hash.Combine((int)Constraints,
Hash.Combine(IsUnused, 0))));
}
private string GetDebuggerDisplay()
{
if (IsDefault)
{
return "[default]";
}
if (IsUnused)
{
return "[invalid]";
}
return string.Format("[Id={0}, SynthesizedKind={1}, Type={2}, Constraints={3}, Sig={4}]",
SlotInfo.Id,
SlotInfo.SynthesizedKind,
Type,
Constraints,
(Signature != null) ? BitConverter.ToString(Signature) : "null");
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Emit
{
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
internal readonly struct EncLocalInfo : IEquatable<EncLocalInfo>
{
public readonly LocalSlotDebugInfo SlotInfo;
public readonly Cci.ITypeReference? Type;
public readonly LocalSlotConstraints Constraints;
public readonly byte[]? Signature;
public readonly bool IsUnused;
public EncLocalInfo(byte[] signature)
{
Debug.Assert(signature.Length > 0);
SlotInfo = new LocalSlotDebugInfo(SynthesizedLocalKind.EmitterTemp, LocalDebugId.None);
Type = null;
Constraints = LocalSlotConstraints.None;
Signature = signature;
IsUnused = true;
}
public EncLocalInfo(LocalSlotDebugInfo slotInfo, Cci.ITypeReference type, LocalSlotConstraints constraints, byte[]? signature)
{
SlotInfo = slotInfo;
Type = type;
Constraints = constraints;
Signature = signature;
IsUnused = false;
}
public bool IsDefault
=> Type is null && Signature is null;
public bool Equals(EncLocalInfo other)
{
return SlotInfo.Equals(other.SlotInfo) &&
Cci.SymbolEquivalentEqualityComparer.Instance.Equals(Type, other.Type) &&
Constraints == other.Constraints &&
IsUnused == other.IsUnused;
}
public override bool Equals(object? obj)
=> obj is EncLocalInfo info && Equals(info);
public override int GetHashCode()
{
Debug.Assert(Type != null);
return Hash.Combine(SlotInfo.GetHashCode(),
Hash.Combine(Cci.SymbolEquivalentEqualityComparer.Instance.GetHashCode(Type),
Hash.Combine((int)Constraints,
Hash.Combine(IsUnused, 0))));
}
private string GetDebuggerDisplay()
{
if (IsDefault)
{
return "[default]";
}
if (IsUnused)
{
return "[invalid]";
}
return string.Format("[Id={0}, SynthesizedKind={1}, Type={2}, Constraints={3}, Sig={4}]",
SlotInfo.Id,
SlotInfo.SynthesizedKind,
Type,
Constraints,
(Signature != null) ? BitConverter.ToString(Signature) : "null");
}
}
}
| -1 |
dotnet/roslyn | 56,173 | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property. | Closes #53800.
Related to #56171. | AlekseyTs | "2021-09-03T17:22:56Z" | "2021-09-07T18:21:02Z" | ec20540d1ac3d0b048ddfb3b7831728511f3e3bb | 5851730e82f7805df3559444fd0f605243bd1adf | Provide real implementation for RuntimeSupportsStaticAbstractMembersInInterfaces property.. Closes #53800.
Related to #56171. | ./src/Compilers/Server/VBCSCompilerTests/BuildProtocolTest.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommandLine;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
public class BuildProtocolTest : TestBase
{
private void VerifyShutdownRequest(BuildRequest request)
{
Assert.Equal(1, request.Arguments.Count);
var argument = request.Arguments[0];
Assert.Equal(BuildProtocolConstants.ArgumentId.Shutdown, argument.ArgumentId);
Assert.Equal(0, argument.ArgumentIndex);
Assert.Equal("", argument.Value);
}
[Fact]
public async Task ReadWriteCompleted()
{
var response = new CompletedBuildResponse(42, utf8output: false, output: "a string");
var memoryStream = new MemoryStream();
await response.WriteAsync(memoryStream, default(CancellationToken));
Assert.True(memoryStream.Position > 0);
memoryStream.Position = 0;
var read = (CompletedBuildResponse)(await BuildResponse.ReadAsync(memoryStream, default(CancellationToken)));
Assert.Equal(42, read.ReturnCode);
Assert.False(read.Utf8Output);
Assert.Equal("a string", read.Output);
}
[Fact]
public async Task ReadWriteRequest()
{
var request = new BuildRequest(
RequestLanguage.VisualBasicCompile,
"HashValue",
ImmutableArray.Create(
new BuildRequest.Argument(BuildProtocolConstants.ArgumentId.CurrentDirectory, argumentIndex: 0, value: "directory"),
new BuildRequest.Argument(BuildProtocolConstants.ArgumentId.CommandLineArgument, argumentIndex: 1, value: "file")));
var memoryStream = new MemoryStream();
await request.WriteAsync(memoryStream, default(CancellationToken));
Assert.True(memoryStream.Position > 0);
memoryStream.Position = 0;
var read = await BuildRequest.ReadAsync(memoryStream, default(CancellationToken));
Assert.Equal(RequestLanguage.VisualBasicCompile, read.Language);
Assert.Equal("HashValue", read.CompilerHash);
Assert.Equal(2, read.Arguments.Count);
Assert.Equal(BuildProtocolConstants.ArgumentId.CurrentDirectory, read.Arguments[0].ArgumentId);
Assert.Equal(0, read.Arguments[0].ArgumentIndex);
Assert.Equal("directory", read.Arguments[0].Value);
Assert.Equal(BuildProtocolConstants.ArgumentId.CommandLineArgument, read.Arguments[1].ArgumentId);
Assert.Equal(1, read.Arguments[1].ArgumentIndex);
Assert.Equal("file", read.Arguments[1].Value);
}
[Fact]
public void ShutdownMessage()
{
var request = BuildRequest.CreateShutdown();
VerifyShutdownRequest(request);
Assert.Equal(1, request.Arguments.Count);
var argument = request.Arguments[0];
Assert.Equal(BuildProtocolConstants.ArgumentId.Shutdown, argument.ArgumentId);
Assert.Equal(0, argument.ArgumentIndex);
Assert.Equal("", argument.Value);
}
[Fact]
public async Task ShutdownRequestWriteRead()
{
var memoryStream = new MemoryStream();
var request = BuildRequest.CreateShutdown();
await request.WriteAsync(memoryStream, CancellationToken.None);
memoryStream.Position = 0;
var read = await BuildRequest.ReadAsync(memoryStream, CancellationToken.None);
VerifyShutdownRequest(read);
}
[Fact]
public async Task ShutdownResponseWriteRead()
{
var response = new ShutdownBuildResponse(42);
Assert.Equal(BuildResponse.ResponseType.Shutdown, response.Type);
var memoryStream = new MemoryStream();
await response.WriteAsync(memoryStream, CancellationToken.None);
memoryStream.Position = 0;
var read = await BuildResponse.ReadAsync(memoryStream, CancellationToken.None);
Assert.Equal(BuildResponse.ResponseType.Shutdown, read.Type);
var typed = (ShutdownBuildResponse)read;
Assert.Equal(42, typed.ServerProcessId);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommandLine;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
public class BuildProtocolTest : TestBase
{
private void VerifyShutdownRequest(BuildRequest request)
{
Assert.Equal(1, request.Arguments.Count);
var argument = request.Arguments[0];
Assert.Equal(BuildProtocolConstants.ArgumentId.Shutdown, argument.ArgumentId);
Assert.Equal(0, argument.ArgumentIndex);
Assert.Equal("", argument.Value);
}
[Fact]
public async Task ReadWriteCompleted()
{
var response = new CompletedBuildResponse(42, utf8output: false, output: "a string");
var memoryStream = new MemoryStream();
await response.WriteAsync(memoryStream, default(CancellationToken));
Assert.True(memoryStream.Position > 0);
memoryStream.Position = 0;
var read = (CompletedBuildResponse)(await BuildResponse.ReadAsync(memoryStream, default(CancellationToken)));
Assert.Equal(42, read.ReturnCode);
Assert.False(read.Utf8Output);
Assert.Equal("a string", read.Output);
}
[Fact]
public async Task ReadWriteRequest()
{
var request = new BuildRequest(
RequestLanguage.VisualBasicCompile,
"HashValue",
ImmutableArray.Create(
new BuildRequest.Argument(BuildProtocolConstants.ArgumentId.CurrentDirectory, argumentIndex: 0, value: "directory"),
new BuildRequest.Argument(BuildProtocolConstants.ArgumentId.CommandLineArgument, argumentIndex: 1, value: "file")));
var memoryStream = new MemoryStream();
await request.WriteAsync(memoryStream, default(CancellationToken));
Assert.True(memoryStream.Position > 0);
memoryStream.Position = 0;
var read = await BuildRequest.ReadAsync(memoryStream, default(CancellationToken));
Assert.Equal(RequestLanguage.VisualBasicCompile, read.Language);
Assert.Equal("HashValue", read.CompilerHash);
Assert.Equal(2, read.Arguments.Count);
Assert.Equal(BuildProtocolConstants.ArgumentId.CurrentDirectory, read.Arguments[0].ArgumentId);
Assert.Equal(0, read.Arguments[0].ArgumentIndex);
Assert.Equal("directory", read.Arguments[0].Value);
Assert.Equal(BuildProtocolConstants.ArgumentId.CommandLineArgument, read.Arguments[1].ArgumentId);
Assert.Equal(1, read.Arguments[1].ArgumentIndex);
Assert.Equal("file", read.Arguments[1].Value);
}
[Fact]
public void ShutdownMessage()
{
var request = BuildRequest.CreateShutdown();
VerifyShutdownRequest(request);
Assert.Equal(1, request.Arguments.Count);
var argument = request.Arguments[0];
Assert.Equal(BuildProtocolConstants.ArgumentId.Shutdown, argument.ArgumentId);
Assert.Equal(0, argument.ArgumentIndex);
Assert.Equal("", argument.Value);
}
[Fact]
public async Task ShutdownRequestWriteRead()
{
var memoryStream = new MemoryStream();
var request = BuildRequest.CreateShutdown();
await request.WriteAsync(memoryStream, CancellationToken.None);
memoryStream.Position = 0;
var read = await BuildRequest.ReadAsync(memoryStream, CancellationToken.None);
VerifyShutdownRequest(read);
}
[Fact]
public async Task ShutdownResponseWriteRead()
{
var response = new ShutdownBuildResponse(42);
Assert.Equal(BuildResponse.ResponseType.Shutdown, response.Type);
var memoryStream = new MemoryStream();
await response.WriteAsync(memoryStream, CancellationToken.None);
memoryStream.Position = 0;
var read = await BuildResponse.ReadAsync(memoryStream, CancellationToken.None);
Assert.Equal(BuildResponse.ResponseType.Shutdown, read.Type);
var typed = (ShutdownBuildResponse)read;
Assert.Equal(42, typed.ServerProcessId);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsClassificationTaggerProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.Text;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
{
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.RoslynContentType)]
[ContentType(ContentTypeNames.XamlContentType)]
[TagType(typeof(ClassificationTag))]
internal partial class DiagnosticsClassificationTaggerProvider : AbstractDiagnosticsTaggerProvider<ClassificationTag>
{
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions = new[] { EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Classification, ServiceComponentOnOffOptions.DiagnosticProvider };
private readonly ClassificationTypeMap _typeMap;
private readonly ClassificationTag _classificationTag;
private readonly IEditorOptionsFactoryService _editorOptionsFactoryService;
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DiagnosticsClassificationTaggerProvider(
IThreadingContext threadingContext,
IDiagnosticService diagnosticService,
ClassificationTypeMap typeMap,
IEditorOptionsFactoryService editorOptionsFactoryService,
IAsynchronousOperationListenerProvider listenerProvider)
: base(threadingContext, diagnosticService, listenerProvider.GetListener(FeatureAttribute.Classification))
{
_typeMap = typeMap;
_classificationTag = new ClassificationTag(_typeMap.GetClassificationType(ClassificationTypeDefinitions.UnnecessaryCode));
_editorOptionsFactoryService = editorOptionsFactoryService;
}
// If we are under high contrast mode, the editor ignores classification tags that fade things out,
// because that reduces contrast. Since the editor will ignore them, there's no reason to produce them.
protected internal override bool IsEnabled
=> !_editorOptionsFactoryService.GlobalOptions.GetOptionValue(DefaultTextViewHostOptions.IsInContrastModeId);
protected internal override bool IncludeDiagnostic(DiagnosticData data)
=> data.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
protected internal override ITagSpan<ClassificationTag> CreateTagSpan(Workspace workspace, bool isLiveUpdate, SnapshotSpan span, DiagnosticData data)
=> new TagSpan<ClassificationTag>(span, _classificationTag);
protected internal override ImmutableArray<DiagnosticDataLocation> GetLocationsToTag(DiagnosticData diagnosticData)
{
// If there are 'unnecessary' locations specified in the property bag, use those instead of the main diagnostic location.
if (diagnosticData.AdditionalLocations.Length > 0
&& diagnosticData.Properties != null
&& diagnosticData.Properties.TryGetValue(WellKnownDiagnosticTags.Unnecessary, out var unnecessaryIndices)
&& unnecessaryIndices is object)
{
using var _ = PooledObjects.ArrayBuilder<DiagnosticDataLocation>.GetInstance(out var locationsToTag);
foreach (var index in GetLocationIndices(unnecessaryIndices))
locationsToTag.Add(diagnosticData.AdditionalLocations[index]);
return locationsToTag.ToImmutable();
}
// Default to the base implementation for the diagnostic data
return base.GetLocationsToTag(diagnosticData);
static IEnumerable<int> GetLocationIndices(string indicesProperty)
{
try
{
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(indicesProperty));
var serializer = new DataContractJsonSerializer(typeof(IEnumerable<int>));
var result = serializer.ReadObject(stream) as IEnumerable<int>;
return result ?? Array.Empty<int>();
}
catch (Exception e) when (FatalError.ReportAndCatch(e))
{
return ImmutableArray<int>.Empty;
}
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.Text;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
{
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.RoslynContentType)]
[ContentType(ContentTypeNames.XamlContentType)]
[TagType(typeof(ClassificationTag))]
internal partial class DiagnosticsClassificationTaggerProvider : AbstractDiagnosticsTaggerProvider<ClassificationTag>
{
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions = new[] { EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Classification };
private readonly ClassificationTypeMap _typeMap;
private readonly ClassificationTag _classificationTag;
private readonly IEditorOptionsFactoryService _editorOptionsFactoryService;
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DiagnosticsClassificationTaggerProvider(
IThreadingContext threadingContext,
IDiagnosticService diagnosticService,
ClassificationTypeMap typeMap,
IEditorOptionsFactoryService editorOptionsFactoryService,
IAsynchronousOperationListenerProvider listenerProvider)
: base(threadingContext, diagnosticService, listenerProvider.GetListener(FeatureAttribute.Classification))
{
_typeMap = typeMap;
_classificationTag = new ClassificationTag(_typeMap.GetClassificationType(ClassificationTypeDefinitions.UnnecessaryCode));
_editorOptionsFactoryService = editorOptionsFactoryService;
}
// If we are under high contrast mode, the editor ignores classification tags that fade things out,
// because that reduces contrast. Since the editor will ignore them, there's no reason to produce them.
protected internal override bool IsEnabled
=> !_editorOptionsFactoryService.GlobalOptions.GetOptionValue(DefaultTextViewHostOptions.IsInContrastModeId);
protected internal override bool IncludeDiagnostic(DiagnosticData data)
=> data.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
protected internal override ITagSpan<ClassificationTag> CreateTagSpan(Workspace workspace, bool isLiveUpdate, SnapshotSpan span, DiagnosticData data)
=> new TagSpan<ClassificationTag>(span, _classificationTag);
protected internal override ImmutableArray<DiagnosticDataLocation> GetLocationsToTag(DiagnosticData diagnosticData)
{
// If there are 'unnecessary' locations specified in the property bag, use those instead of the main diagnostic location.
if (diagnosticData.AdditionalLocations.Length > 0
&& diagnosticData.Properties != null
&& diagnosticData.Properties.TryGetValue(WellKnownDiagnosticTags.Unnecessary, out var unnecessaryIndices)
&& unnecessaryIndices is object)
{
using var _ = PooledObjects.ArrayBuilder<DiagnosticDataLocation>.GetInstance(out var locationsToTag);
foreach (var index in GetLocationIndices(unnecessaryIndices))
locationsToTag.Add(diagnosticData.AdditionalLocations[index]);
return locationsToTag.ToImmutable();
}
// Default to the base implementation for the diagnostic data
return base.GetLocationsToTag(diagnosticData);
static IEnumerable<int> GetLocationIndices(string indicesProperty)
{
try
{
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(indicesProperty));
var serializer = new DataContractJsonSerializer(typeof(IEnumerable<int>));
var result = serializer.ReadObject(stream) as IEnumerable<int>;
return result ?? Array.Empty<int>();
}
catch (Exception e) when (FatalError.ReportAndCatch(e))
{
return ImmutableArray<int>.Empty;
}
}
}
}
}
| 1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSquiggleTaggerProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
{
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.RoslynContentType)]
[ContentType(ContentTypeNames.XamlContentType)]
[TagType(typeof(IErrorTag))]
internal partial class DiagnosticsSquiggleTaggerProvider : AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
{
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles, ServiceComponentOnOffOptions.DiagnosticProvider);
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DiagnosticsSquiggleTaggerProvider(
IThreadingContext threadingContext,
IDiagnosticService diagnosticService,
IAsynchronousOperationListenerProvider listenerProvider)
: base(threadingContext, diagnosticService, listenerProvider)
{
}
protected internal override bool IncludeDiagnostic(DiagnosticData diagnostic)
{
var isUnnecessary = diagnostic.Severity == DiagnosticSeverity.Hidden && diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
return
(diagnostic.Severity == DiagnosticSeverity.Warning || diagnostic.Severity == DiagnosticSeverity.Error || isUnnecessary) &&
!string.IsNullOrWhiteSpace(diagnostic.Message);
}
protected override IErrorTag? CreateTag(Workspace workspace, DiagnosticData diagnostic)
{
Debug.Assert(!string.IsNullOrWhiteSpace(diagnostic.Message));
var errorType = GetErrorTypeFromDiagnostic(diagnostic);
if (errorType == null)
{
// unknown diagnostic kind.
// we don't provide tagging for unknown diagnostic kind.
//
// it should be provided by the one who introduced the new diagnostic kind.
return null;
}
return new ErrorTag(errorType, CreateToolTipContent(workspace, diagnostic));
}
private static string? GetErrorTypeFromDiagnostic(DiagnosticData diagnostic)
{
if (diagnostic.IsSuppressed)
{
// Don't squiggle suppressed diagnostics.
return null;
}
return GetErrorTypeFromDiagnosticTags(diagnostic) ??
GetErrorTypeFromDiagnosticSeverity(diagnostic);
}
private static string? GetErrorTypeFromDiagnosticTags(DiagnosticData diagnostic)
{
if (diagnostic.Severity == DiagnosticSeverity.Error &&
diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.EditAndContinue))
{
return EditAndContinueErrorTypeDefinition.Name;
}
return null;
}
private static string? GetErrorTypeFromDiagnosticSeverity(DiagnosticData diagnostic)
{
switch (diagnostic.Severity)
{
case DiagnosticSeverity.Error:
return PredefinedErrorTypeNames.SyntaxError;
case DiagnosticSeverity.Warning:
return PredefinedErrorTypeNames.Warning;
case DiagnosticSeverity.Info:
return null;
case DiagnosticSeverity.Hidden:
if (diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary))
{
// This ensures that we have an 'invisible' squiggle (which will in turn
// display Quick Info on mouse hover) for the hidden diagnostics that we
// report for 'Remove Unnecessary Usings' and 'Simplify Type Name'. The
// presence of Quick Info pane for such squiggles allows platform
// to display Light Bulb for the corresponding fixes (per their current
// design platform can only display light bulb if Quick Info pane is present).
return PredefinedErrorTypeNames.Suggestion;
}
return null;
default:
return PredefinedErrorTypeNames.OtherError;
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
{
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.RoslynContentType)]
[ContentType(ContentTypeNames.XamlContentType)]
[TagType(typeof(IErrorTag))]
internal partial class DiagnosticsSquiggleTaggerProvider : AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
{
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles);
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DiagnosticsSquiggleTaggerProvider(
IThreadingContext threadingContext,
IDiagnosticService diagnosticService,
IAsynchronousOperationListenerProvider listenerProvider)
: base(threadingContext, diagnosticService, listenerProvider)
{
}
protected internal override bool IncludeDiagnostic(DiagnosticData diagnostic)
{
var isUnnecessary = diagnostic.Severity == DiagnosticSeverity.Hidden && diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
return
(diagnostic.Severity == DiagnosticSeverity.Warning || diagnostic.Severity == DiagnosticSeverity.Error || isUnnecessary) &&
!string.IsNullOrWhiteSpace(diagnostic.Message);
}
protected override IErrorTag? CreateTag(Workspace workspace, DiagnosticData diagnostic)
{
Debug.Assert(!string.IsNullOrWhiteSpace(diagnostic.Message));
var errorType = GetErrorTypeFromDiagnostic(diagnostic);
if (errorType == null)
{
// unknown diagnostic kind.
// we don't provide tagging for unknown diagnostic kind.
//
// it should be provided by the one who introduced the new diagnostic kind.
return null;
}
return new ErrorTag(errorType, CreateToolTipContent(workspace, diagnostic));
}
private static string? GetErrorTypeFromDiagnostic(DiagnosticData diagnostic)
{
if (diagnostic.IsSuppressed)
{
// Don't squiggle suppressed diagnostics.
return null;
}
return GetErrorTypeFromDiagnosticTags(diagnostic) ??
GetErrorTypeFromDiagnosticSeverity(diagnostic);
}
private static string? GetErrorTypeFromDiagnosticTags(DiagnosticData diagnostic)
{
if (diagnostic.Severity == DiagnosticSeverity.Error &&
diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.EditAndContinue))
{
return EditAndContinueErrorTypeDefinition.Name;
}
return null;
}
private static string? GetErrorTypeFromDiagnosticSeverity(DiagnosticData diagnostic)
{
switch (diagnostic.Severity)
{
case DiagnosticSeverity.Error:
return PredefinedErrorTypeNames.SyntaxError;
case DiagnosticSeverity.Warning:
return PredefinedErrorTypeNames.Warning;
case DiagnosticSeverity.Info:
return null;
case DiagnosticSeverity.Hidden:
if (diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary))
{
// This ensures that we have an 'invisible' squiggle (which will in turn
// display Quick Info on mouse hover) for the hidden diagnostics that we
// report for 'Remove Unnecessary Usings' and 'Simplify Type Name'. The
// presence of Quick Info pane for such squiggles allows platform
// to display Light Bulb for the corresponding fixes (per their current
// design platform can only display light bulb if Quick Info pane is present).
return PredefinedErrorTypeNames.Suggestion;
}
return null;
default:
return PredefinedErrorTypeNames.OtherError;
}
}
}
}
| 1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSuggestionTaggerProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
{
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.RoslynContentType)]
[ContentType(ContentTypeNames.XamlContentType)]
[TagType(typeof(IErrorTag))]
internal partial class DiagnosticsSuggestionTaggerProvider :
AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
{
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles, ServiceComponentOnOffOptions.DiagnosticProvider);
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DiagnosticsSuggestionTaggerProvider(
IThreadingContext threadingContext,
IDiagnosticService diagnosticService,
IAsynchronousOperationListenerProvider listenerProvider)
: base(threadingContext, diagnosticService, listenerProvider)
{
}
protected internal override bool IncludeDiagnostic(DiagnosticData diagnostic)
=> diagnostic.Severity == DiagnosticSeverity.Info;
protected override IErrorTag CreateTag(Workspace workspace, DiagnosticData diagnostic)
=> new ErrorTag(
PredefinedErrorTypeNames.HintedSuggestion,
CreateToolTipContent(workspace, diagnostic));
protected override SnapshotSpan AdjustSnapshotSpan(SnapshotSpan snapshotSpan, int minimumLength)
{
// We always want suggestion tags to be two characters long.
return AdjustSnapshotSpan(snapshotSpan, minimumLength: 2, maximumLength: 2);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
{
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.RoslynContentType)]
[ContentType(ContentTypeNames.XamlContentType)]
[TagType(typeof(IErrorTag))]
internal partial class DiagnosticsSuggestionTaggerProvider :
AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
{
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles);
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DiagnosticsSuggestionTaggerProvider(
IThreadingContext threadingContext,
IDiagnosticService diagnosticService,
IAsynchronousOperationListenerProvider listenerProvider)
: base(threadingContext, diagnosticService, listenerProvider)
{
}
protected internal override bool IncludeDiagnostic(DiagnosticData diagnostic)
=> diagnostic.Severity == DiagnosticSeverity.Info;
protected override IErrorTag CreateTag(Workspace workspace, DiagnosticData diagnostic)
=> new ErrorTag(
PredefinedErrorTypeNames.HintedSuggestion,
CreateToolTipContent(workspace, diagnostic));
protected override SnapshotSpan AdjustSnapshotSpan(SnapshotSpan snapshotSpan, int minimumLength)
{
// We always want suggestion tags to be two characters long.
return AdjustSnapshotSpan(snapshotSpan, minimumLength: 2, maximumLength: 2);
}
}
}
| 1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.CSharp
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Shared.Options
Imports Microsoft.CodeAnalysis.SolutionCrawler
Imports Microsoft.CodeAnalysis.UnitTests
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
''' <summary>
''' Tests for Error List. Since it is language agnostic there are no C# or VB Specific tests
''' </summary>
<[UseExportProvider]>
Public Class DiagnosticProviderTests
Private Const s_errorElementName As String = "Error"
Private Const s_projectAttributeName As String = "Project"
Private Const s_codeAttributeName As String = "Code"
Private Const s_mappedLineAttributeName As String = "MappedLine"
Private Const s_mappedColumnAttributeName As String = "MappedColumn"
Private Const s_originalLineAttributeName As String = "OriginalLine"
Private Const s_originalColumnAttributeName As String = "OriginalColumn"
Private Const s_idAttributeName As String = "Id"
Private Const s_messageAttributeName As String = "Message"
Private Const s_originalFileAttributeName As String = "OriginalFile"
Private Const s_mappedFileAttributeName As String = "MappedFile"
Private Shared ReadOnly s_composition As TestComposition = EditorTestCompositions.EditorFeatures _
.AddExcludedPartTypes(GetType(IDiagnosticUpdateSourceRegistrationService)) _
.AddParts(
GetType(NoCompilationContentTypeLanguageService),
GetType(NoCompilationContentTypeDefinitions),
GetType(MockDiagnosticUpdateSourceRegistrationService))
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestNoErrors()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { }
</Document>
</Project>
</Workspace>
VerifyAllAvailableDiagnostics(test, Nothing)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestSingleDeclarationError()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { dontcompile }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="1" MappedColumn="64" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="64"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestLineDirective()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { dontcompile }
#line 1000
class Goo2 { dontcompile }
#line default
class Goo4 { dontcompile }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="1" MappedColumn="64" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="64"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="999" MappedColumn="65" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="65"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="5" MappedColumn="65" OriginalFile="Test.cs" OriginalLine="5" OriginalColumn="65"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestSingleBindingError()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { int a = "test"; }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="29" Id="CS0029" MappedFile="Test.cs" MappedLine="1" MappedColumn="60" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="60"
Message=<%= String.Format(CSharpResources.ERR_NoImplicitConv, "string", "int") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestMultipleErrorsAndWarnings()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { gibberish }
class Goo2 { as; }
class Goo3 { long q = 1l; }
#pragma disable 9999999"
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="1" MappedColumn="62" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="62"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="2" MappedColumn="53" OriginalFile="Test.cs" OriginalLine="2" OriginalColumn="53"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "as") %>/>
<Warning Code="78" Id="CS0078" MappedFile="Test.cs" MappedLine="3" MappedColumn="63" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="63"
Message=<%= CSharpResources.WRN_LowercaseEllSuffix %>/>
<Warning Code="1633" Id="CS1633" MappedFile="Test.cs" MappedLine="4" MappedColumn="48" OriginalFile="Test.cs" OriginalLine="4" OriginalColumn="48"
Message=<%= CSharpResources.WRN_IllegalPragma %>/>
</Diagnostics>
' Note: The below is removed because of bug # 550593.
'<Warning Code = "414" Id="CS0414" MappedFile="Test.cs" MappedLine="3" MappedColumn="58" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="58"
' Message = "The field 'Goo3.q' is assigned but its value is never used" />
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestBindingAndDeclarationErrors()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Program { void Main() { - } }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1525" Id="CS1525" MappedFile="Test.cs" MappedLine="1" MappedColumn="72" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="72"
Message=<%= String.Format(CSharpResources.ERR_InvalidExprTerm, "}") %>/>
<Error Code="1002" Id="CS1002" MappedFile="Test.cs" MappedLine="1" MappedColumn="72" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="72"
Message=<%= CSharpResources.ERR_SemicolonExpected %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
' Diagnostics are ordered by project-id
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestDiagnosticsFromMultipleProjects()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Program
{
-
void Test()
{
int a = 5 - "2";
}
}
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true">
<Document FilePath="Test.vb">
Class GooClass
Sub Blah() End Sub
End Class
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="3" MappedColumn="44" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="44"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "-") %>/>
<Error Code="19" Id="CS0019" MappedFile="Test.cs" MappedLine="6" MappedColumn="56" OriginalFile="Test.cs" OriginalLine="6" OriginalColumn="56"
Message=<%= String.Format(CSharpResources.ERR_BadBinaryOps, "-", "int", "string") %>/>
<Error Code="30026" Id="BC30026" MappedFile="Test.vb" MappedLine="2" MappedColumn="44" OriginalFile="Test.vb" OriginalLine="2" OriginalColumn="44"
Message=<%= VBResources.ERR_EndSubExpected %>/>
<Error Code="30205" Id="BC30205" MappedFile="Test.vb" MappedLine="2" MappedColumn="55" OriginalFile="Test.vb" OriginalLine="2" OriginalColumn="55"
Message=<%= VBResources.ERR_ExpectedEOS %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics, ordered:=False)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestDiagnosticsFromTurnedOff()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Program
{
-
void Test()
{
int a = 5 - "2";
}
}
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true">
<Document FilePath="Test.vb">
Class GooClass
Sub Blah() End Sub
End Class
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics></Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics, ordered:=False, enabled:=False)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub WarningsAsErrors()
Dim test =
<Workspace>
<Project Language="C#" CommonReferences="true">
<CompilationOptions ReportDiagnostic="Error"/>
<Document FilePath="Test.cs">
class Program
{
void Test()
{
int a = 5;
}
}
</Document>
</Project>
</Workspace>
Dim diagnostics =
<Diagnostics>
<Error Code="219" Id="CS0219"
MappedFile="Test.cs" MappedLine="5" MappedColumn="40"
OriginalFile="Test.cs" OriginalLine="5" OriginalColumn="40"
Message=<%= String.Format(CSharpResources.WRN_UnreferencedVarAssg, "a") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub DiagnosticsInNoCompilationProjects()
Dim test =
<Workspace>
<Project Language="NoCompilation">
<Document FilePath="A.ts">
Dummy content.
</Document>
</Project>
</Workspace>
Dim diagnostics =
<Diagnostics>
<Error Id=<%= NoCompilationDocumentDiagnosticAnalyzer.Descriptor.Id %>
MappedFile="A.ts" MappedLine="0" MappedColumn="0"
OriginalFile="A.ts" OriginalLine="0" OriginalColumn="0"
Message=<%= NoCompilationDocumentDiagnosticAnalyzer.Descriptor.MessageFormat.ToString() %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
Private Shared Sub VerifyAllAvailableDiagnostics(test As XElement, diagnostics As XElement, Optional ordered As Boolean = True, Optional enabled As Boolean = True)
Using workspace = TestWorkspace.CreateWorkspace(test, composition:=s_composition)
' turn off diagnostic
If Not enabled Then
workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options _
.WithChangedOption(ServiceComponentOnOffOptions.DiagnosticProvider, False) _
.WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.CSharp, BackgroundAnalysisScope.Default) _
.WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.VisualBasic, BackgroundAnalysisScope.Default)))
End If
Dim registrationService = workspace.Services.GetService(Of ISolutionCrawlerRegistrationService)()
registrationService.Register(workspace)
Dim diagnosticProvider = GetDiagnosticProvider(workspace)
Dim actualDiagnostics = diagnosticProvider.GetCachedDiagnosticsAsync(workspace).Result
registrationService.Unregister(workspace)
If diagnostics Is Nothing Then
Assert.Equal(0, actualDiagnostics.Length)
Else
Dim expectedDiagnostics = GetExpectedDiagnostics(workspace, diagnostics)
If ordered Then
AssertEx.Equal(expectedDiagnostics, actualDiagnostics, New Comparer())
Else
AssertEx.SetEqual(expectedDiagnostics, actualDiagnostics, New Comparer())
End If
End If
End Using
End Sub
Private Shared Function GetDiagnosticProvider(workspace As TestWorkspace) As DiagnosticAnalyzerService
Dim compilerAnalyzersMap = DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap().Add(
NoCompilationConstants.LanguageName, ImmutableArray.Create(Of DiagnosticAnalyzer)(New NoCompilationDocumentDiagnosticAnalyzer()))
Dim analyzerReference = New TestAnalyzerReferenceByLanguage(compilerAnalyzersMap)
workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference}))
Assert.IsType(Of MockDiagnosticUpdateSourceRegistrationService)(workspace.GetService(Of IDiagnosticUpdateSourceRegistrationService)())
Dim analyzerService = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)())
' CollectErrors generates interleaved background and foreground tasks.
Dim service = DirectCast(workspace.Services.GetService(Of ISolutionCrawlerRegistrationService)(), SolutionCrawlerRegistrationService)
service.GetTestAccessor().WaitUntilCompletion(workspace, SpecializedCollections.SingletonEnumerable(analyzerService.CreateIncrementalAnalyzer(workspace)).WhereNotNull().ToImmutableArray())
Return analyzerService
End Function
Private Shared Function GetExpectedDiagnostics(workspace As TestWorkspace, diagnostics As XElement) As List(Of DiagnosticData)
Dim result As New List(Of DiagnosticData)
Dim mappedLine As Integer, mappedColumn As Integer, originalLine As Integer, originalColumn As Integer
Dim Id As String, message As String, originalFile As String, mappedFile As String
Dim documentId As DocumentId
For Each diagnostic As XElement In diagnostics.Elements()
mappedLine = Integer.Parse(diagnostic.Attribute(s_mappedLineAttributeName).Value)
mappedColumn = Integer.Parse(diagnostic.Attribute(s_mappedColumnAttributeName).Value)
originalLine = Integer.Parse(diagnostic.Attribute(s_originalLineAttributeName).Value)
originalColumn = Integer.Parse(diagnostic.Attribute(s_originalColumnAttributeName).Value)
Id = diagnostic.Attribute(s_idAttributeName).Value
message = diagnostic.Attribute(s_messageAttributeName).Value
originalFile = diagnostic.Attribute(s_originalFileAttributeName).Value
mappedFile = diagnostic.Attribute(s_mappedFileAttributeName).Value
documentId = GetDocumentId(workspace, originalFile)
If diagnostic.Name.LocalName.Equals(s_errorElementName) Then
result.Add(SourceError(Id, message, documentId, documentId.ProjectId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile))
Else
result.Add(SourceWarning(Id, message, documentId, documentId.ProjectId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile))
End If
Next
Return result
End Function
Private Shared Function GetProjectId(workspace As TestWorkspace, projectName As String) As ProjectId
Return (From doc In workspace.Documents
Where doc.Project.AssemblyName.Equals(projectName)
Select doc.Project.Id).Single()
End Function
Private Shared Function GetDocumentId(workspace As TestWorkspace, document As String) As DocumentId
Return (From doc In workspace.Documents
Where doc.FilePath.Equals(document)
Select doc.Id).Single()
End Function
Private Shared Function SourceError(id As String, message As String, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return CreateDiagnostic(id, message, DiagnosticSeverity.Error, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
End Function
Private Shared Function SourceWarning(id As String, message As String, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return CreateDiagnostic(id, message, DiagnosticSeverity.Warning, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
End Function
Private Shared Function CreateDiagnostic(id As String, message As String, severity As DiagnosticSeverity, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return New DiagnosticData(
id:=id,
category:="test",
message:=message,
enuMessageForBingSearch:=message,
severity:=severity,
defaultSeverity:=severity,
isEnabledByDefault:=True,
warningLevel:=0,
customTags:=ImmutableArray(Of String).Empty,
properties:=ImmutableDictionary(Of String, String).Empty,
projectId:=projId,
location:=New DiagnosticDataLocation(docId, Nothing, originalFile, originalLine, originalColumn, originalLine, originalColumn, mappedFile, mappedLine, mappedColumn, mappedLine, mappedColumn),
additionalLocations:=Nothing,
language:=LanguageNames.VisualBasic,
title:=Nothing)
End Function
Private Class Comparer
Implements IEqualityComparer(Of DiagnosticData)
Public Overloads Function Equals(x As DiagnosticData, y As DiagnosticData) As Boolean Implements IEqualityComparer(Of DiagnosticData).Equals
Return x.Id = y.Id AndAlso
x.Message = y.Message AndAlso
x.Severity = y.Severity AndAlso
x.ProjectId = y.ProjectId AndAlso
x.DocumentId = y.DocumentId AndAlso
Equals(x.DataLocation?.OriginalStartLine, y.DataLocation?.OriginalStartLine) AndAlso
Equals(x.DataLocation?.OriginalStartColumn, y.DataLocation?.OriginalStartColumn)
End Function
Public Overloads Function GetHashCode(obj As DiagnosticData) As Integer Implements IEqualityComparer(Of DiagnosticData).GetHashCode
Return Hash.Combine(obj.Id,
Hash.Combine(obj.Message,
Hash.Combine(obj.ProjectId,
Hash.Combine(obj.DocumentId,
Hash.Combine(If(obj.DataLocation?.OriginalStartLine, 0),
Hash.Combine(If(obj.DataLocation?.OriginalStartColumn, 0), obj.Severity))))))
End Function
End Class
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.CSharp
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Shared.Options
Imports Microsoft.CodeAnalysis.SolutionCrawler
Imports Microsoft.CodeAnalysis.UnitTests
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
''' <summary>
''' Tests for Error List. Since it is language agnostic there are no C# or VB Specific tests
''' </summary>
<[UseExportProvider]>
Public Class DiagnosticProviderTests
Private Const s_errorElementName As String = "Error"
Private Const s_projectAttributeName As String = "Project"
Private Const s_codeAttributeName As String = "Code"
Private Const s_mappedLineAttributeName As String = "MappedLine"
Private Const s_mappedColumnAttributeName As String = "MappedColumn"
Private Const s_originalLineAttributeName As String = "OriginalLine"
Private Const s_originalColumnAttributeName As String = "OriginalColumn"
Private Const s_idAttributeName As String = "Id"
Private Const s_messageAttributeName As String = "Message"
Private Const s_originalFileAttributeName As String = "OriginalFile"
Private Const s_mappedFileAttributeName As String = "MappedFile"
Private Shared ReadOnly s_composition As TestComposition = EditorTestCompositions.EditorFeatures _
.AddExcludedPartTypes(GetType(IDiagnosticUpdateSourceRegistrationService)) _
.AddParts(
GetType(NoCompilationContentTypeLanguageService),
GetType(NoCompilationContentTypeDefinitions),
GetType(MockDiagnosticUpdateSourceRegistrationService))
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestNoErrors()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { }
</Document>
</Project>
</Workspace>
VerifyAllAvailableDiagnostics(test, Nothing)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestSingleDeclarationError()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { dontcompile }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="1" MappedColumn="64" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="64"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestLineDirective()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { dontcompile }
#line 1000
class Goo2 { dontcompile }
#line default
class Goo4 { dontcompile }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="1" MappedColumn="64" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="64"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="999" MappedColumn="65" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="65"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="5" MappedColumn="65" OriginalFile="Test.cs" OriginalLine="5" OriginalColumn="65"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestSingleBindingError()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { int a = "test"; }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="29" Id="CS0029" MappedFile="Test.cs" MappedLine="1" MappedColumn="60" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="60"
Message=<%= String.Format(CSharpResources.ERR_NoImplicitConv, "string", "int") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestMultipleErrorsAndWarnings()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Goo { gibberish }
class Goo2 { as; }
class Goo3 { long q = 1l; }
#pragma disable 9999999"
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="1" MappedColumn="62" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="62"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "}") %>/>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="2" MappedColumn="53" OriginalFile="Test.cs" OriginalLine="2" OriginalColumn="53"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "as") %>/>
<Warning Code="78" Id="CS0078" MappedFile="Test.cs" MappedLine="3" MappedColumn="63" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="63"
Message=<%= CSharpResources.WRN_LowercaseEllSuffix %>/>
<Warning Code="1633" Id="CS1633" MappedFile="Test.cs" MappedLine="4" MappedColumn="48" OriginalFile="Test.cs" OriginalLine="4" OriginalColumn="48"
Message=<%= CSharpResources.WRN_IllegalPragma %>/>
</Diagnostics>
' Note: The below is removed because of bug # 550593.
'<Warning Code = "414" Id="CS0414" MappedFile="Test.cs" MappedLine="3" MappedColumn="58" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="58"
' Message = "The field 'Goo3.q' is assigned but its value is never used" />
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestBindingAndDeclarationErrors()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Program { void Main() { - } }
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1525" Id="CS1525" MappedFile="Test.cs" MappedLine="1" MappedColumn="72" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="72"
Message=<%= String.Format(CSharpResources.ERR_InvalidExprTerm, "}") %>/>
<Error Code="1002" Id="CS1002" MappedFile="Test.cs" MappedLine="1" MappedColumn="72" OriginalFile="Test.cs" OriginalLine="1" OriginalColumn="72"
Message=<%= CSharpResources.ERR_SemicolonExpected %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
' Diagnostics are ordered by project-id
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub TestDiagnosticsFromMultipleProjects()
Dim test = <Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Test.cs">
class Program
{
-
void Test()
{
int a = 5 - "2";
}
}
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true">
<Document FilePath="Test.vb">
Class GooClass
Sub Blah() End Sub
End Class
</Document>
</Project>
</Workspace>
Dim diagnostics = <Diagnostics>
<Error Code="1519" Id="CS1519" MappedFile="Test.cs" MappedLine="3" MappedColumn="44" OriginalFile="Test.cs" OriginalLine="3" OriginalColumn="44"
Message=<%= String.Format(CSharpResources.ERR_InvalidMemberDecl, "-") %>/>
<Error Code="19" Id="CS0019" MappedFile="Test.cs" MappedLine="6" MappedColumn="56" OriginalFile="Test.cs" OriginalLine="6" OriginalColumn="56"
Message=<%= String.Format(CSharpResources.ERR_BadBinaryOps, "-", "int", "string") %>/>
<Error Code="30026" Id="BC30026" MappedFile="Test.vb" MappedLine="2" MappedColumn="44" OriginalFile="Test.vb" OriginalLine="2" OriginalColumn="44"
Message=<%= VBResources.ERR_EndSubExpected %>/>
<Error Code="30205" Id="BC30205" MappedFile="Test.vb" MappedLine="2" MappedColumn="55" OriginalFile="Test.vb" OriginalLine="2" OriginalColumn="55"
Message=<%= VBResources.ERR_ExpectedEOS %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics, ordered:=False)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub WarningsAsErrors()
Dim test =
<Workspace>
<Project Language="C#" CommonReferences="true">
<CompilationOptions ReportDiagnostic="Error"/>
<Document FilePath="Test.cs">
class Program
{
void Test()
{
int a = 5;
}
}
</Document>
</Project>
</Workspace>
Dim diagnostics =
<Diagnostics>
<Error Code="219" Id="CS0219"
MappedFile="Test.cs" MappedLine="5" MappedColumn="40"
OriginalFile="Test.cs" OriginalLine="5" OriginalColumn="40"
Message=<%= String.Format(CSharpResources.WRN_UnreferencedVarAssg, "a") %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub DiagnosticsInNoCompilationProjects()
Dim test =
<Workspace>
<Project Language="NoCompilation">
<Document FilePath="A.ts">
Dummy content.
</Document>
</Project>
</Workspace>
Dim diagnostics =
<Diagnostics>
<Error Id=<%= NoCompilationDocumentDiagnosticAnalyzer.Descriptor.Id %>
MappedFile="A.ts" MappedLine="0" MappedColumn="0"
OriginalFile="A.ts" OriginalLine="0" OriginalColumn="0"
Message=<%= NoCompilationDocumentDiagnosticAnalyzer.Descriptor.MessageFormat.ToString() %>/>
</Diagnostics>
VerifyAllAvailableDiagnostics(test, diagnostics)
End Sub
Private Shared Sub VerifyAllAvailableDiagnostics(test As XElement, diagnostics As XElement, Optional ordered As Boolean = True)
Using workspace = TestWorkspace.CreateWorkspace(test, composition:=s_composition)
Dim registrationService = workspace.Services.GetService(Of ISolutionCrawlerRegistrationService)()
registrationService.Register(workspace)
Dim diagnosticProvider = GetDiagnosticProvider(workspace)
Dim actualDiagnostics = diagnosticProvider.GetCachedDiagnosticsAsync(workspace).Result
registrationService.Unregister(workspace)
If diagnostics Is Nothing Then
Assert.Equal(0, actualDiagnostics.Length)
Else
Dim expectedDiagnostics = GetExpectedDiagnostics(workspace, diagnostics)
If ordered Then
AssertEx.Equal(expectedDiagnostics, actualDiagnostics, New Comparer())
Else
AssertEx.SetEqual(expectedDiagnostics, actualDiagnostics, New Comparer())
End If
End If
End Using
End Sub
Private Shared Function GetDiagnosticProvider(workspace As TestWorkspace) As DiagnosticAnalyzerService
Dim compilerAnalyzersMap = DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap().Add(
NoCompilationConstants.LanguageName, ImmutableArray.Create(Of DiagnosticAnalyzer)(New NoCompilationDocumentDiagnosticAnalyzer()))
Dim analyzerReference = New TestAnalyzerReferenceByLanguage(compilerAnalyzersMap)
workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference}))
Assert.IsType(Of MockDiagnosticUpdateSourceRegistrationService)(workspace.GetService(Of IDiagnosticUpdateSourceRegistrationService)())
Dim analyzerService = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)())
' CollectErrors generates interleaved background and foreground tasks.
Dim service = DirectCast(workspace.Services.GetService(Of ISolutionCrawlerRegistrationService)(), SolutionCrawlerRegistrationService)
service.GetTestAccessor().WaitUntilCompletion(workspace, SpecializedCollections.SingletonEnumerable(analyzerService.CreateIncrementalAnalyzer(workspace)).WhereNotNull().ToImmutableArray())
Return analyzerService
End Function
Private Shared Function GetExpectedDiagnostics(workspace As TestWorkspace, diagnostics As XElement) As List(Of DiagnosticData)
Dim result As New List(Of DiagnosticData)
Dim mappedLine As Integer, mappedColumn As Integer, originalLine As Integer, originalColumn As Integer
Dim Id As String, message As String, originalFile As String, mappedFile As String
Dim documentId As DocumentId
For Each diagnostic As XElement In diagnostics.Elements()
mappedLine = Integer.Parse(diagnostic.Attribute(s_mappedLineAttributeName).Value)
mappedColumn = Integer.Parse(diagnostic.Attribute(s_mappedColumnAttributeName).Value)
originalLine = Integer.Parse(diagnostic.Attribute(s_originalLineAttributeName).Value)
originalColumn = Integer.Parse(diagnostic.Attribute(s_originalColumnAttributeName).Value)
Id = diagnostic.Attribute(s_idAttributeName).Value
message = diagnostic.Attribute(s_messageAttributeName).Value
originalFile = diagnostic.Attribute(s_originalFileAttributeName).Value
mappedFile = diagnostic.Attribute(s_mappedFileAttributeName).Value
documentId = GetDocumentId(workspace, originalFile)
If diagnostic.Name.LocalName.Equals(s_errorElementName) Then
result.Add(SourceError(Id, message, documentId, documentId.ProjectId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile))
Else
result.Add(SourceWarning(Id, message, documentId, documentId.ProjectId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile))
End If
Next
Return result
End Function
Private Shared Function GetProjectId(workspace As TestWorkspace, projectName As String) As ProjectId
Return (From doc In workspace.Documents
Where doc.Project.AssemblyName.Equals(projectName)
Select doc.Project.Id).Single()
End Function
Private Shared Function GetDocumentId(workspace As TestWorkspace, document As String) As DocumentId
Return (From doc In workspace.Documents
Where doc.FilePath.Equals(document)
Select doc.Id).Single()
End Function
Private Shared Function SourceError(id As String, message As String, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return CreateDiagnostic(id, message, DiagnosticSeverity.Error, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
End Function
Private Shared Function SourceWarning(id As String, message As String, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return CreateDiagnostic(id, message, DiagnosticSeverity.Warning, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
End Function
Private Shared Function CreateDiagnostic(id As String, message As String, severity As DiagnosticSeverity, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return New DiagnosticData(
id:=id,
category:="test",
message:=message,
enuMessageForBingSearch:=message,
severity:=severity,
defaultSeverity:=severity,
isEnabledByDefault:=True,
warningLevel:=0,
customTags:=ImmutableArray(Of String).Empty,
properties:=ImmutableDictionary(Of String, String).Empty,
projectId:=projId,
location:=New DiagnosticDataLocation(docId, Nothing, originalFile, originalLine, originalColumn, originalLine, originalColumn, mappedFile, mappedLine, mappedColumn, mappedLine, mappedColumn),
additionalLocations:=Nothing,
language:=LanguageNames.VisualBasic,
title:=Nothing)
End Function
Private Class Comparer
Implements IEqualityComparer(Of DiagnosticData)
Public Overloads Function Equals(x As DiagnosticData, y As DiagnosticData) As Boolean Implements IEqualityComparer(Of DiagnosticData).Equals
Return x.Id = y.Id AndAlso
x.Message = y.Message AndAlso
x.Severity = y.Severity AndAlso
x.ProjectId = y.ProjectId AndAlso
x.DocumentId = y.DocumentId AndAlso
Equals(x.DataLocation?.OriginalStartLine, y.DataLocation?.OriginalStartLine) AndAlso
Equals(x.DataLocation?.OriginalStartColumn, y.DataLocation?.OriginalStartColumn)
End Function
Public Overloads Function GetHashCode(obj As DiagnosticData) As Integer Implements IEqualityComparer(Of DiagnosticData).GetHashCode
Return Hash.Combine(obj.Id,
Hash.Combine(obj.Message,
Hash.Combine(obj.ProjectId,
Hash.Combine(obj.DocumentId,
Hash.Combine(If(obj.DataLocation?.OriginalStartLine, 0),
Hash.Combine(If(obj.DataLocation?.OriginalStartColumn, 0), obj.Severity))))))
End Function
End Class
End Class
End Namespace
| 1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/Core/Portable/Diagnostics/DefaultDiagnosticAnalyzerService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
[Shared]
[ExportIncrementalAnalyzerProvider(WellKnownSolutionCrawlerAnalyzers.Diagnostic, workspaceKinds: null)]
internal partial class DefaultDiagnosticAnalyzerService : IIncrementalAnalyzerProvider, IDiagnosticUpdateSource
{
private readonly DiagnosticAnalyzerInfoCache _analyzerInfoCache;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultDiagnosticAnalyzerService(
IDiagnosticUpdateSourceRegistrationService registrationService)
{
_analyzerInfoCache = new DiagnosticAnalyzerInfoCache();
registrationService.Register(this);
}
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
{
if (!workspace.Options.GetOption(ServiceComponentOnOffOptions.DiagnosticProvider))
{
return null;
}
return new DefaultDiagnosticIncrementalAnalyzer(this, workspace);
}
public event EventHandler<DiagnosticsUpdatedArgs> DiagnosticsUpdated;
public event EventHandler DiagnosticsCleared { add { } remove { } }
// this only support push model, pull model will be provided by DiagnosticService by caching everything this one pushed
public bool SupportGetDiagnostics => false;
public ValueTask<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(Workspace workspace, ProjectId projectId, DocumentId documentId, object id, bool includeSuppressedDiagnostics = false, CancellationToken cancellationToken = default)
{
// pull model not supported
return new ValueTask<ImmutableArray<DiagnosticData>>(ImmutableArray<DiagnosticData>.Empty);
}
internal void RaiseDiagnosticsUpdated(DiagnosticsUpdatedArgs state)
=> DiagnosticsUpdated?.Invoke(this, state);
private class DefaultDiagnosticIncrementalAnalyzer : IIncrementalAnalyzer2
{
private readonly DefaultDiagnosticAnalyzerService _service;
private readonly Workspace _workspace;
private readonly InProcOrRemoteHostAnalyzerRunner _diagnosticAnalyzerRunner;
public DefaultDiagnosticIncrementalAnalyzer(DefaultDiagnosticAnalyzerService service, Workspace workspace)
{
_service = service;
_workspace = workspace;
_diagnosticAnalyzerRunner = new InProcOrRemoteHostAnalyzerRunner(service._analyzerInfoCache);
}
public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
{
if (e.Option == InternalRuntimeDiagnosticOptions.Syntax ||
e.Option == InternalRuntimeDiagnosticOptions.Semantic ||
e.Option == InternalRuntimeDiagnosticOptions.ScriptSemantic)
{
return true;
}
return false;
}
public Task AnalyzeSyntaxAsync(Document document, InvocationReasons reasons, CancellationToken cancellationToken)
=> AnalyzeSyntaxOrNonSourceDocumentAsync(document, cancellationToken);
public Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, InvocationReasons reasons, CancellationToken cancellationToken)
=> AnalyzeSyntaxOrNonSourceDocumentAsync(textDocument, cancellationToken);
private async Task AnalyzeSyntaxOrNonSourceDocumentAsync(TextDocument textDocument, CancellationToken cancellationToken)
{
Debug.Assert(textDocument.Project.Solution.Workspace == _workspace);
// right now, there is no way to observe diagnostics for closed file.
if (!_workspace.IsDocumentOpen(textDocument.Id) ||
!_workspace.Options.GetOption(InternalRuntimeDiagnosticOptions.Syntax))
{
return;
}
await AnalyzeForKindAsync(textDocument, AnalysisKind.Syntax, cancellationToken).ConfigureAwait(false);
}
public async Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, InvocationReasons reasons, CancellationToken cancellationToken)
{
Debug.Assert(document.Project.Solution.Workspace == _workspace);
if (!IsSemanticAnalysisOn())
{
return;
}
await AnalyzeForKindAsync(document, AnalysisKind.Semantic, cancellationToken).ConfigureAwait(false);
bool IsSemanticAnalysisOn()
{
// right now, there is no way to observe diagnostics for closed file.
if (!_workspace.IsDocumentOpen(document.Id))
{
return false;
}
if (_workspace.Options.GetOption(InternalRuntimeDiagnosticOptions.Semantic))
{
return true;
}
return _workspace.Options.GetOption(InternalRuntimeDiagnosticOptions.ScriptSemantic) && document.SourceCodeKind == SourceCodeKind.Script;
}
}
private async Task AnalyzeForKindAsync(TextDocument document, AnalysisKind kind, CancellationToken cancellationToken)
{
var diagnosticData = await GetDiagnosticsAsync(document, kind, cancellationToken).ConfigureAwait(false);
_service.RaiseDiagnosticsUpdated(
DiagnosticsUpdatedArgs.DiagnosticsCreated(new DefaultUpdateArgsId(_workspace.Kind, kind, document.Id),
_workspace, document.Project.Solution, document.Project.Id, document.Id, diagnosticData));
}
/// <summary>
/// Get diagnostics for the given document.
///
/// This is a simple API to get all diagnostics for the given document.
///
/// The intended audience for this API is for ones that pefer simplicity over performance such as document that belong to misc project.
/// this doesn't cache nor use cache for anything. it will re-caculate new diagnostics every time for the given document.
/// it will not persist any data on disk nor use OOP to calculate the data.
///
/// This should never be used when performance is a big concern. for such context, use much complex API from IDiagnosticAnalyzerService
/// that provide all kinds of knobs/cache/persistency/OOP to get better perf over simplicity.
/// </summary>
private async Task<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(
TextDocument document, AnalysisKind kind, CancellationToken cancellationToken)
{
var loadDiagnostic = await document.State.GetLoadDiagnosticAsync(cancellationToken).ConfigureAwait(false);
if (loadDiagnostic != null)
return ImmutableArray.Create(DiagnosticData.Create(loadDiagnostic, document));
var project = document.Project;
var analyzers = GetAnalyzers(project.Solution.State.Analyzers, project);
if (analyzers.IsEmpty)
return ImmutableArray<DiagnosticData>.Empty;
var compilationWithAnalyzers = await AnalyzerHelper.CreateCompilationWithAnalyzersAsync(
project, analyzers, includeSuppressedDiagnostics: false, cancellationToken).ConfigureAwait(false);
var analysisScope = new DocumentAnalysisScope(document, span: null, analyzers, kind);
var executor = new DocumentAnalysisExecutor(analysisScope, compilationWithAnalyzers, _diagnosticAnalyzerRunner, logPerformanceInfo: true);
using var _ = ArrayBuilder<DiagnosticData>.GetInstance(out var builder);
foreach (var analyzer in analyzers)
builder.AddRange(await executor.ComputeDiagnosticsAsync(analyzer, cancellationToken).ConfigureAwait(false));
return builder.ToImmutable();
}
private static ImmutableArray<DiagnosticAnalyzer> GetAnalyzers(HostDiagnosticAnalyzers hostAnalyzers, Project project)
{
// C# or VB document that supports compiler
var compilerAnalyzer = hostAnalyzers.GetCompilerDiagnosticAnalyzer(project.Language);
if (compilerAnalyzer != null)
{
return ImmutableArray.Create(compilerAnalyzer);
}
// document that doesn't support compiler diagnostics such as FSharp or TypeScript
return hostAnalyzers.CreateDiagnosticAnalyzersPerReference(project).Values.SelectMany(v => v).ToImmutableArrayOrEmpty();
}
public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken)
{
// a file is removed from a solution
//
// here syntax and semantic indicates type of errors not where it is originated from.
// Option.Semantic or Option.ScriptSemantic indicates what kind of document we will produce semantic errors from.
// Option.Semantic == true means we will generate semantic errors for all document type
// Option.ScriptSemantic == true means we will generate semantic errors only for script document type
// both of them at the end generates semantic errors
RaiseEmptyDiagnosticUpdated(AnalysisKind.Syntax, documentId);
RaiseEmptyDiagnosticUpdated(AnalysisKind.Semantic, documentId);
return Task.CompletedTask;
}
public Task DocumentResetAsync(Document document, CancellationToken cancellationToken)
{
// no closed file diagnostic and file is not opened, remove any existing diagnostics
return RemoveDocumentAsync(document.Id, cancellationToken);
}
public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken)
{
// no closed file diagnostic and file is not opened, remove any existing diagnostics
return RemoveDocumentAsync(textDocument.Id, cancellationToken);
}
public Task DocumentCloseAsync(Document document, CancellationToken cancellationToken)
=> DocumentResetAsync(document, cancellationToken);
public Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken)
=> NonSourceDocumentResetAsync(textDocument, cancellationToken);
private void RaiseEmptyDiagnosticUpdated(AnalysisKind kind, DocumentId documentId)
{
_service.RaiseDiagnosticsUpdated(DiagnosticsUpdatedArgs.DiagnosticsRemoved(
new DefaultUpdateArgsId(_workspace.Kind, kind, documentId), _workspace, null, documentId.ProjectId, documentId));
}
public Task AnalyzeProjectAsync(Project project, bool semanticsChanged, InvocationReasons reasons, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task DocumentOpenAsync(Document document, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken)
=> Task.CompletedTask;
private class DefaultUpdateArgsId : BuildToolId.Base<int, DocumentId>, ISupportLiveUpdate
{
private readonly string _workspaceKind;
public DefaultUpdateArgsId(string workspaceKind, AnalysisKind kind, DocumentId documentId) : base((int)kind, documentId)
=> _workspaceKind = workspaceKind;
public override string BuildTool => PredefinedBuildTools.Live;
public override bool Equals(object obj)
{
if (obj is not DefaultUpdateArgsId other)
{
return false;
}
return _workspaceKind == other._workspaceKind && base.Equals(obj);
}
public override int GetHashCode()
=> Hash.Combine(_workspaceKind.GetHashCode(), base.GetHashCode());
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
[Shared]
[ExportIncrementalAnalyzerProvider(WellKnownSolutionCrawlerAnalyzers.Diagnostic, workspaceKinds: null)]
internal partial class DefaultDiagnosticAnalyzerService : IIncrementalAnalyzerProvider, IDiagnosticUpdateSource
{
private readonly DiagnosticAnalyzerInfoCache _analyzerInfoCache;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultDiagnosticAnalyzerService(
IDiagnosticUpdateSourceRegistrationService registrationService)
{
_analyzerInfoCache = new DiagnosticAnalyzerInfoCache();
registrationService.Register(this);
}
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
=> new DefaultDiagnosticIncrementalAnalyzer(this, workspace);
public event EventHandler<DiagnosticsUpdatedArgs> DiagnosticsUpdated;
public event EventHandler DiagnosticsCleared { add { } remove { } }
// this only support push model, pull model will be provided by DiagnosticService by caching everything this one pushed
public bool SupportGetDiagnostics => false;
public ValueTask<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(Workspace workspace, ProjectId projectId, DocumentId documentId, object id, bool includeSuppressedDiagnostics = false, CancellationToken cancellationToken = default)
{
// pull model not supported
return new ValueTask<ImmutableArray<DiagnosticData>>(ImmutableArray<DiagnosticData>.Empty);
}
internal void RaiseDiagnosticsUpdated(DiagnosticsUpdatedArgs state)
=> DiagnosticsUpdated?.Invoke(this, state);
private class DefaultDiagnosticIncrementalAnalyzer : IIncrementalAnalyzer2
{
private readonly DefaultDiagnosticAnalyzerService _service;
private readonly Workspace _workspace;
private readonly InProcOrRemoteHostAnalyzerRunner _diagnosticAnalyzerRunner;
public DefaultDiagnosticIncrementalAnalyzer(DefaultDiagnosticAnalyzerService service, Workspace workspace)
{
_service = service;
_workspace = workspace;
_diagnosticAnalyzerRunner = new InProcOrRemoteHostAnalyzerRunner(service._analyzerInfoCache);
}
public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
{
if (e.Option == InternalRuntimeDiagnosticOptions.Syntax ||
e.Option == InternalRuntimeDiagnosticOptions.Semantic ||
e.Option == InternalRuntimeDiagnosticOptions.ScriptSemantic)
{
return true;
}
return false;
}
public Task AnalyzeSyntaxAsync(Document document, InvocationReasons reasons, CancellationToken cancellationToken)
=> AnalyzeSyntaxOrNonSourceDocumentAsync(document, cancellationToken);
public Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, InvocationReasons reasons, CancellationToken cancellationToken)
=> AnalyzeSyntaxOrNonSourceDocumentAsync(textDocument, cancellationToken);
private async Task AnalyzeSyntaxOrNonSourceDocumentAsync(TextDocument textDocument, CancellationToken cancellationToken)
{
Debug.Assert(textDocument.Project.Solution.Workspace == _workspace);
// right now, there is no way to observe diagnostics for closed file.
if (!_workspace.IsDocumentOpen(textDocument.Id) ||
!_workspace.Options.GetOption(InternalRuntimeDiagnosticOptions.Syntax))
{
return;
}
await AnalyzeForKindAsync(textDocument, AnalysisKind.Syntax, cancellationToken).ConfigureAwait(false);
}
public async Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, InvocationReasons reasons, CancellationToken cancellationToken)
{
Debug.Assert(document.Project.Solution.Workspace == _workspace);
if (!IsSemanticAnalysisOn())
{
return;
}
await AnalyzeForKindAsync(document, AnalysisKind.Semantic, cancellationToken).ConfigureAwait(false);
bool IsSemanticAnalysisOn()
{
// right now, there is no way to observe diagnostics for closed file.
if (!_workspace.IsDocumentOpen(document.Id))
{
return false;
}
if (_workspace.Options.GetOption(InternalRuntimeDiagnosticOptions.Semantic))
{
return true;
}
return _workspace.Options.GetOption(InternalRuntimeDiagnosticOptions.ScriptSemantic) && document.SourceCodeKind == SourceCodeKind.Script;
}
}
private async Task AnalyzeForKindAsync(TextDocument document, AnalysisKind kind, CancellationToken cancellationToken)
{
var diagnosticData = await GetDiagnosticsAsync(document, kind, cancellationToken).ConfigureAwait(false);
_service.RaiseDiagnosticsUpdated(
DiagnosticsUpdatedArgs.DiagnosticsCreated(new DefaultUpdateArgsId(_workspace.Kind, kind, document.Id),
_workspace, document.Project.Solution, document.Project.Id, document.Id, diagnosticData));
}
/// <summary>
/// Get diagnostics for the given document.
///
/// This is a simple API to get all diagnostics for the given document.
///
/// The intended audience for this API is for ones that pefer simplicity over performance such as document that belong to misc project.
/// this doesn't cache nor use cache for anything. it will re-caculate new diagnostics every time for the given document.
/// it will not persist any data on disk nor use OOP to calculate the data.
///
/// This should never be used when performance is a big concern. for such context, use much complex API from IDiagnosticAnalyzerService
/// that provide all kinds of knobs/cache/persistency/OOP to get better perf over simplicity.
/// </summary>
private async Task<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(
TextDocument document, AnalysisKind kind, CancellationToken cancellationToken)
{
var loadDiagnostic = await document.State.GetLoadDiagnosticAsync(cancellationToken).ConfigureAwait(false);
if (loadDiagnostic != null)
return ImmutableArray.Create(DiagnosticData.Create(loadDiagnostic, document));
var project = document.Project;
var analyzers = GetAnalyzers(project.Solution.State.Analyzers, project);
if (analyzers.IsEmpty)
return ImmutableArray<DiagnosticData>.Empty;
var compilationWithAnalyzers = await AnalyzerHelper.CreateCompilationWithAnalyzersAsync(
project, analyzers, includeSuppressedDiagnostics: false, cancellationToken).ConfigureAwait(false);
var analysisScope = new DocumentAnalysisScope(document, span: null, analyzers, kind);
var executor = new DocumentAnalysisExecutor(analysisScope, compilationWithAnalyzers, _diagnosticAnalyzerRunner, logPerformanceInfo: true);
using var _ = ArrayBuilder<DiagnosticData>.GetInstance(out var builder);
foreach (var analyzer in analyzers)
builder.AddRange(await executor.ComputeDiagnosticsAsync(analyzer, cancellationToken).ConfigureAwait(false));
return builder.ToImmutable();
}
private static ImmutableArray<DiagnosticAnalyzer> GetAnalyzers(HostDiagnosticAnalyzers hostAnalyzers, Project project)
{
// C# or VB document that supports compiler
var compilerAnalyzer = hostAnalyzers.GetCompilerDiagnosticAnalyzer(project.Language);
if (compilerAnalyzer != null)
{
return ImmutableArray.Create(compilerAnalyzer);
}
// document that doesn't support compiler diagnostics such as FSharp or TypeScript
return hostAnalyzers.CreateDiagnosticAnalyzersPerReference(project).Values.SelectMany(v => v).ToImmutableArrayOrEmpty();
}
public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken)
{
// a file is removed from a solution
//
// here syntax and semantic indicates type of errors not where it is originated from.
// Option.Semantic or Option.ScriptSemantic indicates what kind of document we will produce semantic errors from.
// Option.Semantic == true means we will generate semantic errors for all document type
// Option.ScriptSemantic == true means we will generate semantic errors only for script document type
// both of them at the end generates semantic errors
RaiseEmptyDiagnosticUpdated(AnalysisKind.Syntax, documentId);
RaiseEmptyDiagnosticUpdated(AnalysisKind.Semantic, documentId);
return Task.CompletedTask;
}
public Task DocumentResetAsync(Document document, CancellationToken cancellationToken)
{
// no closed file diagnostic and file is not opened, remove any existing diagnostics
return RemoveDocumentAsync(document.Id, cancellationToken);
}
public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken)
{
// no closed file diagnostic and file is not opened, remove any existing diagnostics
return RemoveDocumentAsync(textDocument.Id, cancellationToken);
}
public Task DocumentCloseAsync(Document document, CancellationToken cancellationToken)
=> DocumentResetAsync(document, cancellationToken);
public Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken)
=> NonSourceDocumentResetAsync(textDocument, cancellationToken);
private void RaiseEmptyDiagnosticUpdated(AnalysisKind kind, DocumentId documentId)
{
_service.RaiseDiagnosticsUpdated(DiagnosticsUpdatedArgs.DiagnosticsRemoved(
new DefaultUpdateArgsId(_workspace.Kind, kind, documentId), _workspace, null, documentId.ProjectId, documentId));
}
public Task AnalyzeProjectAsync(Project project, bool semanticsChanged, InvocationReasons reasons, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task DocumentOpenAsync(Document document, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken)
=> Task.CompletedTask;
public Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken)
=> Task.CompletedTask;
private class DefaultUpdateArgsId : BuildToolId.Base<int, DocumentId>, ISupportLiveUpdate
{
private readonly string _workspaceKind;
public DefaultUpdateArgsId(string workspaceKind, AnalysisKind kind, DocumentId documentId) : base((int)kind, documentId)
=> _workspaceKind = workspaceKind;
public override string BuildTool => PredefinedBuildTools.Live;
public override bool Equals(object obj)
{
if (obj is not DefaultUpdateArgsId other)
{
return false;
}
return _workspaceKind == other._workspaceKind && base.Equals(obj);
}
public override int GetHashCode()
=> Hash.Combine(_workspaceKind.GetHashCode(), base.GetHashCode());
}
}
}
}
| 1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService_IncrementalAnalyzer.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using Microsoft.CodeAnalysis.Diagnostics.EngineV2;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
[ExportIncrementalAnalyzerProvider(
highPriorityForActiveFile: true, name: WellKnownSolutionCrawlerAnalyzers.Diagnostic,
workspaceKinds: new string[] { WorkspaceKind.Host, WorkspaceKind.Interactive })]
internal partial class DiagnosticAnalyzerService : IIncrementalAnalyzerProvider
{
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
{
if (!workspace.Options.GetOption(ServiceComponentOnOffOptions.DiagnosticProvider))
{
return null;
}
return _map.GetValue(workspace, _createIncrementalAnalyzer);
}
public void ShutdownAnalyzerFrom(Workspace workspace)
{
// this should be only called once analyzer associated with the workspace is done.
if (_map.TryGetValue(workspace, out var analyzer))
{
analyzer.Shutdown();
}
}
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
private DiagnosticIncrementalAnalyzer CreateIncrementalAnalyzerCallback(Workspace workspace)
{
// subscribe to active context changed event for new workspace
workspace.DocumentActiveContextChanged += OnDocumentActiveContextChanged;
return new DiagnosticIncrementalAnalyzer(this, LogAggregator.GetNextId(), workspace, AnalyzerInfoCache);
}
private void OnDocumentActiveContextChanged(object sender, DocumentActiveContextChangedEventArgs e)
=> Reanalyze(e.Solution.Workspace, documentIds: SpecializedCollections.SingletonEnumerable(e.NewActiveContextDocumentId), highPriority: true);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using Microsoft.CodeAnalysis.Diagnostics.EngineV2;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
[ExportIncrementalAnalyzerProvider(
highPriorityForActiveFile: true, name: WellKnownSolutionCrawlerAnalyzers.Diagnostic,
workspaceKinds: new string[] { WorkspaceKind.Host, WorkspaceKind.Interactive })]
internal partial class DiagnosticAnalyzerService : IIncrementalAnalyzerProvider
{
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
=> _map.GetValue(workspace, _createIncrementalAnalyzer);
public void ShutdownAnalyzerFrom(Workspace workspace)
{
// this should be only called once analyzer associated with the workspace is done.
if (_map.TryGetValue(workspace, out var analyzer))
{
analyzer.Shutdown();
}
}
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
private DiagnosticIncrementalAnalyzer CreateIncrementalAnalyzerCallback(Workspace workspace)
{
// subscribe to active context changed event for new workspace
workspace.DocumentActiveContextChanged += OnDocumentActiveContextChanged;
return new DiagnosticIncrementalAnalyzer(this, LogAggregator.GetNextId(), workspace, AnalyzerInfoCache);
}
private void OnDocumentActiveContextChanged(object sender, DocumentActiveContextChangedEventArgs e)
=> Reanalyze(e.Solution.Workspace, documentIds: SpecializedCollections.SingletonEnumerable(e.NewActiveContextDocumentId), highPriority: true);
}
}
| 1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Core/Portable/ReferenceManager/AssemblyReferenceCandidate.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CodeAnalysis
{
internal partial class CommonReferenceManager<TCompilation, TAssemblySymbol>
{
/// <summary>
/// Private helper class to capture information about AssemblySymbol instance we
/// should check for suitability. Used by the Bind method.
/// </summary>
private readonly struct AssemblyReferenceCandidate
{
/// <summary>
/// An index of the AssemblyData object in the input array. AssemblySymbol instance should
/// be checked for suitability against assembly described by that object, taking into account
/// assemblies described by other AssemblyData objects in the input array.
/// </summary>
public readonly int DefinitionIndex;
/// <summary>
/// AssemblySymbol instance to check for suitability.
/// </summary>
public readonly TAssemblySymbol? AssemblySymbol;
/// <summary>
/// Convenience constructor to initialize fields of this structure.
/// </summary>
public AssemblyReferenceCandidate(int definitionIndex, TAssemblySymbol symbol)
{
DefinitionIndex = definitionIndex;
AssemblySymbol = symbol;
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CodeAnalysis
{
internal partial class CommonReferenceManager<TCompilation, TAssemblySymbol>
{
/// <summary>
/// Private helper class to capture information about AssemblySymbol instance we
/// should check for suitability. Used by the Bind method.
/// </summary>
private readonly struct AssemblyReferenceCandidate
{
/// <summary>
/// An index of the AssemblyData object in the input array. AssemblySymbol instance should
/// be checked for suitability against assembly described by that object, taking into account
/// assemblies described by other AssemblyData objects in the input array.
/// </summary>
public readonly int DefinitionIndex;
/// <summary>
/// AssemblySymbol instance to check for suitability.
/// </summary>
public readonly TAssemblySymbol? AssemblySymbol;
/// <summary>
/// Convenience constructor to initialize fields of this structure.
/// </summary>
public AssemblyReferenceCandidate(int definitionIndex, TAssemblySymbol symbol)
{
DefinitionIndex = definitionIndex;
AssemblySymbol = symbol;
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListener+AsyncToken.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
namespace Microsoft.CodeAnalysis.Shared.TestHooks
{
internal partial class AsynchronousOperationListener
{
internal class AsyncToken : IAsyncToken
{
private readonly AsynchronousOperationListener _listener;
private bool _disposed;
public AsyncToken(AsynchronousOperationListener listener)
{
_listener = listener;
listener.Increment_NoLock();
}
public void Dispose()
{
using (_listener._gate.DisposableWait(CancellationToken.None))
{
if (_disposed)
{
throw new InvalidOperationException("Double disposing of an async token");
}
_disposed = true;
_listener.Decrement_NoLock(this);
}
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
namespace Microsoft.CodeAnalysis.Shared.TestHooks
{
internal partial class AsynchronousOperationListener
{
internal class AsyncToken : IAsyncToken
{
private readonly AsynchronousOperationListener _listener;
private bool _disposed;
public AsyncToken(AsynchronousOperationListener listener)
{
_listener = listener;
listener.Increment_NoLock();
}
public void Dispose()
{
using (_listener._gate.DisposableWait(CancellationToken.None))
{
if (_disposed)
{
throw new InvalidOperationException("Double disposing of an async token");
}
_disposed = true;
_listener.Decrement_NoLock(this);
}
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Interactive/Host/Interactive/Core/InteractiveHost.LazyRemoteService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
extern alias Scripting;
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Pipes;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ErrorReporting;
using Roslyn.Utilities;
using StreamJsonRpc;
using Scripting::Microsoft.CodeAnalysis.Scripting.Hosting;
namespace Microsoft.CodeAnalysis.Interactive
{
internal partial class InteractiveHost
{
private sealed class LazyRemoteService
{
private readonly AsyncLazy<InitializedRemoteService> _lazyInitializedService;
private readonly CancellationTokenSource _cancellationSource;
public readonly InteractiveHostOptions Options;
public readonly InteractiveHost Host;
public readonly bool SkipInitialization;
public readonly int InstanceId;
public LazyRemoteService(InteractiveHost host, InteractiveHostOptions options, int instanceId, bool skipInitialization)
{
_lazyInitializedService = new AsyncLazy<InitializedRemoteService>(TryStartAndInitializeProcessAsync, cacheResult: true);
_cancellationSource = new CancellationTokenSource();
InstanceId = instanceId;
Options = options;
Host = host;
SkipInitialization = skipInitialization;
}
public void Dispose()
{
// Cancel the creation of the process if it is in progress.
// If it is the cancellation will clean up all resources allocated during the creation.
_cancellationSource.Cancel();
// If the value has been calculated already, dispose the service.
if (_lazyInitializedService.TryGetValue(out var initializedService))
{
initializedService.Service?.Dispose();
}
}
internal Task<InitializedRemoteService> GetInitializedServiceAsync()
=> _lazyInitializedService.GetValueAsync(_cancellationSource.Token);
internal InitializedRemoteService? TryGetInitializedService()
=> _lazyInitializedService.TryGetValue(out var service) ? service : default;
private async Task<InitializedRemoteService> TryStartAndInitializeProcessAsync(CancellationToken cancellationToken)
{
try
{
var remoteService = await TryStartProcessAsync(Options.HostPath, Options.Culture, cancellationToken).ConfigureAwait(false);
if (remoteService == null)
{
return default;
}
RemoteExecutionResult result;
if (SkipInitialization)
{
result = new RemoteExecutionResult(
success: true,
sourcePaths: ImmutableArray<string>.Empty,
referencePaths: ImmutableArray<string>.Empty,
workingDirectory: Host._initialWorkingDirectory,
initializationResult: new RemoteInitializationResult(
initializationScript: null,
metadataReferencePaths: ImmutableArray.Create(typeof(object).Assembly.Location, typeof(InteractiveScriptGlobals).Assembly.Location),
imports: ImmutableArray<string>.Empty));
Host.ProcessInitialized?.Invoke(remoteService.PlatformInfo, Options, result);
return new InitializedRemoteService(remoteService, result);
}
bool initializing = true;
cancellationToken.Register(() =>
{
if (initializing)
{
// kill the process without triggering auto-reset:
remoteService.Dispose();
}
});
// try to execute initialization script:
var isRestarting = InstanceId > 1;
result = await ExecuteRemoteAsync(remoteService, nameof(Service.InitializeContextAsync), Options.InitializationFilePath, isRestarting).ConfigureAwait(false);
initializing = false;
if (!result.Success)
{
Host.ReportProcessExited(remoteService.Process);
remoteService.Dispose();
return default;
}
Contract.ThrowIfNull(result.InitializationResult);
// Hook up a handler that initiates restart when the process exits.
// Note that this is just so that we restart the process as soon as we see it dying and it doesn't need to be 100% bullet-proof.
// If we don't receive the "process exited" event we will restart the process upon the next remote operation.
remoteService.HookAutoRestartEvent();
Host.ProcessInitialized?.Invoke(remoteService.PlatformInfo, Options, result);
return new InitializedRemoteService(remoteService, result);
}
#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods
// await ExecuteRemoteAsync above does not take cancellationToken
// - we don't currently support cancellation of the RPC call,
// but JsonRpc.InvokeAsync that we use still claims it may throw OperationCanceledException..
catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e))
#pragma warning restore CA2016
{
throw ExceptionUtilities.Unreachable;
}
}
private async Task<RemoteService?> TryStartProcessAsync(string hostPath, CultureInfo culture, CancellationToken cancellationToken)
{
int currentProcessId = Process.GetCurrentProcess().Id;
var pipeName = typeof(InteractiveHost).FullName + Guid.NewGuid();
var newProcess = new Process
{
StartInfo = new ProcessStartInfo(hostPath)
{
Arguments = pipeName + " " + currentProcessId,
WorkingDirectory = Host._initialWorkingDirectory,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardErrorEncoding = OutputEncoding,
StandardOutputEncoding = OutputEncoding
},
// enables Process.Exited event to be raised:
EnableRaisingEvents = true
};
try
{
newProcess.Start();
}
catch (Exception e)
{
Host.WriteOutputInBackground(
isError: true,
string.Format(InteractiveHostResources.Failed_to_create_a_remote_process_for_interactive_code_execution, hostPath),
e.Message);
Host.InteractiveHostProcessCreationFailed?.Invoke(e, TryGetExitCode(newProcess));
return null;
}
Host.InteractiveHostProcessCreated?.Invoke(newProcess);
int newProcessId = -1;
try
{
newProcessId = newProcess.Id;
}
catch
{
newProcessId = 0;
}
var clientStream = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
JsonRpc? jsonRpc = null;
void ProcessExitedBeforeEstablishingConnection(object sender, EventArgs e)
{
Host.InteractiveHostProcessCreationFailed?.Invoke(null, TryGetExitCode(newProcess));
_cancellationSource.Cancel();
}
// Connecting the named pipe client would block if the process exits before the connection is established,
// as the client waits for the server to become available. We signal the cancellation token to abort.
newProcess.Exited += ProcessExitedBeforeEstablishingConnection;
InteractiveHostPlatformInfo platformInfo;
try
{
if (!CheckAlive(newProcess, hostPath))
{
Host.InteractiveHostProcessCreationFailed?.Invoke(null, TryGetExitCode(newProcess));
return null;
}
await clientStream.ConnectAsync(cancellationToken).ConfigureAwait(false);
jsonRpc = CreateRpc(clientStream, incomingCallTarget: null);
platformInfo = (await jsonRpc.InvokeWithCancellationAsync<InteractiveHostPlatformInfo.Data>(
nameof(Service.InitializeAsync),
new object[] { Host._replServiceProviderType.AssemblyQualifiedName, culture.Name },
cancellationToken).ConfigureAwait(false)).Deserialize();
}
catch (Exception e)
{
if (CheckAlive(newProcess, hostPath))
{
RemoteService.InitiateTermination(newProcess, newProcessId);
}
jsonRpc?.Dispose();
Host.InteractiveHostProcessCreationFailed?.Invoke(e, TryGetExitCode(newProcess));
return null;
}
finally
{
newProcess.Exited -= ProcessExitedBeforeEstablishingConnection;
}
return new RemoteService(Host, newProcess, newProcessId, jsonRpc, platformInfo, Options);
}
private bool CheckAlive(Process process, string hostPath)
{
bool alive = process.IsAlive();
if (!alive)
{
string errorString = process.StandardError.ReadToEnd();
Host.WriteOutputInBackground(
isError: true,
string.Format(InteractiveHostResources.Failed_to_launch_0_process_exit_code_colon_1_with_output_colon, hostPath, process.ExitCode),
errorString);
}
return alive;
}
private static int? TryGetExitCode(Process process)
{
try
{
return process.ExitCode;
}
catch
{
return null;
}
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
extern alias Scripting;
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Pipes;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ErrorReporting;
using Roslyn.Utilities;
using StreamJsonRpc;
using Scripting::Microsoft.CodeAnalysis.Scripting.Hosting;
namespace Microsoft.CodeAnalysis.Interactive
{
internal partial class InteractiveHost
{
private sealed class LazyRemoteService
{
private readonly AsyncLazy<InitializedRemoteService> _lazyInitializedService;
private readonly CancellationTokenSource _cancellationSource;
public readonly InteractiveHostOptions Options;
public readonly InteractiveHost Host;
public readonly bool SkipInitialization;
public readonly int InstanceId;
public LazyRemoteService(InteractiveHost host, InteractiveHostOptions options, int instanceId, bool skipInitialization)
{
_lazyInitializedService = new AsyncLazy<InitializedRemoteService>(TryStartAndInitializeProcessAsync, cacheResult: true);
_cancellationSource = new CancellationTokenSource();
InstanceId = instanceId;
Options = options;
Host = host;
SkipInitialization = skipInitialization;
}
public void Dispose()
{
// Cancel the creation of the process if it is in progress.
// If it is the cancellation will clean up all resources allocated during the creation.
_cancellationSource.Cancel();
// If the value has been calculated already, dispose the service.
if (_lazyInitializedService.TryGetValue(out var initializedService))
{
initializedService.Service?.Dispose();
}
}
internal Task<InitializedRemoteService> GetInitializedServiceAsync()
=> _lazyInitializedService.GetValueAsync(_cancellationSource.Token);
internal InitializedRemoteService? TryGetInitializedService()
=> _lazyInitializedService.TryGetValue(out var service) ? service : default;
private async Task<InitializedRemoteService> TryStartAndInitializeProcessAsync(CancellationToken cancellationToken)
{
try
{
var remoteService = await TryStartProcessAsync(Options.HostPath, Options.Culture, cancellationToken).ConfigureAwait(false);
if (remoteService == null)
{
return default;
}
RemoteExecutionResult result;
if (SkipInitialization)
{
result = new RemoteExecutionResult(
success: true,
sourcePaths: ImmutableArray<string>.Empty,
referencePaths: ImmutableArray<string>.Empty,
workingDirectory: Host._initialWorkingDirectory,
initializationResult: new RemoteInitializationResult(
initializationScript: null,
metadataReferencePaths: ImmutableArray.Create(typeof(object).Assembly.Location, typeof(InteractiveScriptGlobals).Assembly.Location),
imports: ImmutableArray<string>.Empty));
Host.ProcessInitialized?.Invoke(remoteService.PlatformInfo, Options, result);
return new InitializedRemoteService(remoteService, result);
}
bool initializing = true;
cancellationToken.Register(() =>
{
if (initializing)
{
// kill the process without triggering auto-reset:
remoteService.Dispose();
}
});
// try to execute initialization script:
var isRestarting = InstanceId > 1;
result = await ExecuteRemoteAsync(remoteService, nameof(Service.InitializeContextAsync), Options.InitializationFilePath, isRestarting).ConfigureAwait(false);
initializing = false;
if (!result.Success)
{
Host.ReportProcessExited(remoteService.Process);
remoteService.Dispose();
return default;
}
Contract.ThrowIfNull(result.InitializationResult);
// Hook up a handler that initiates restart when the process exits.
// Note that this is just so that we restart the process as soon as we see it dying and it doesn't need to be 100% bullet-proof.
// If we don't receive the "process exited" event we will restart the process upon the next remote operation.
remoteService.HookAutoRestartEvent();
Host.ProcessInitialized?.Invoke(remoteService.PlatformInfo, Options, result);
return new InitializedRemoteService(remoteService, result);
}
#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods
// await ExecuteRemoteAsync above does not take cancellationToken
// - we don't currently support cancellation of the RPC call,
// but JsonRpc.InvokeAsync that we use still claims it may throw OperationCanceledException..
catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e))
#pragma warning restore CA2016
{
throw ExceptionUtilities.Unreachable;
}
}
private async Task<RemoteService?> TryStartProcessAsync(string hostPath, CultureInfo culture, CancellationToken cancellationToken)
{
int currentProcessId = Process.GetCurrentProcess().Id;
var pipeName = typeof(InteractiveHost).FullName + Guid.NewGuid();
var newProcess = new Process
{
StartInfo = new ProcessStartInfo(hostPath)
{
Arguments = pipeName + " " + currentProcessId,
WorkingDirectory = Host._initialWorkingDirectory,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardErrorEncoding = OutputEncoding,
StandardOutputEncoding = OutputEncoding
},
// enables Process.Exited event to be raised:
EnableRaisingEvents = true
};
try
{
newProcess.Start();
}
catch (Exception e)
{
Host.WriteOutputInBackground(
isError: true,
string.Format(InteractiveHostResources.Failed_to_create_a_remote_process_for_interactive_code_execution, hostPath),
e.Message);
Host.InteractiveHostProcessCreationFailed?.Invoke(e, TryGetExitCode(newProcess));
return null;
}
Host.InteractiveHostProcessCreated?.Invoke(newProcess);
int newProcessId = -1;
try
{
newProcessId = newProcess.Id;
}
catch
{
newProcessId = 0;
}
var clientStream = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
JsonRpc? jsonRpc = null;
void ProcessExitedBeforeEstablishingConnection(object sender, EventArgs e)
{
Host.InteractiveHostProcessCreationFailed?.Invoke(null, TryGetExitCode(newProcess));
_cancellationSource.Cancel();
}
// Connecting the named pipe client would block if the process exits before the connection is established,
// as the client waits for the server to become available. We signal the cancellation token to abort.
newProcess.Exited += ProcessExitedBeforeEstablishingConnection;
InteractiveHostPlatformInfo platformInfo;
try
{
if (!CheckAlive(newProcess, hostPath))
{
Host.InteractiveHostProcessCreationFailed?.Invoke(null, TryGetExitCode(newProcess));
return null;
}
await clientStream.ConnectAsync(cancellationToken).ConfigureAwait(false);
jsonRpc = CreateRpc(clientStream, incomingCallTarget: null);
platformInfo = (await jsonRpc.InvokeWithCancellationAsync<InteractiveHostPlatformInfo.Data>(
nameof(Service.InitializeAsync),
new object[] { Host._replServiceProviderType.AssemblyQualifiedName, culture.Name },
cancellationToken).ConfigureAwait(false)).Deserialize();
}
catch (Exception e)
{
if (CheckAlive(newProcess, hostPath))
{
RemoteService.InitiateTermination(newProcess, newProcessId);
}
jsonRpc?.Dispose();
Host.InteractiveHostProcessCreationFailed?.Invoke(e, TryGetExitCode(newProcess));
return null;
}
finally
{
newProcess.Exited -= ProcessExitedBeforeEstablishingConnection;
}
return new RemoteService(Host, newProcess, newProcessId, jsonRpc, platformInfo, Options);
}
private bool CheckAlive(Process process, string hostPath)
{
bool alive = process.IsAlive();
if (!alive)
{
string errorString = process.StandardError.ReadToEnd();
Host.WriteOutputInBackground(
isError: true,
string.Format(InteractiveHostResources.Failed_to_launch_0_process_exit_code_colon_1_with_output_colon, hostPath, process.ExitCode),
errorString);
}
return alive;
}
private static int? TryGetExitCode(Process process)
{
try
{
return process.ExitCode;
}
catch
{
return null;
}
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/VisualBasic/Portable/Symbols/EventSignatureComparer.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Generic
Imports System.Diagnostics
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Implementation of IEqualityComparer for EventSymbol, with options for various aspects
''' to compare.
''' </summary>
Friend Class EventSignatureComparer
Implements IEqualityComparer(Of EventSymbol)
''' <summary>
''' This instance is used when trying to determine which implemented interface event is implemented
''' by a event with an Implements clause, according to VB rules.
''' This comparer uses event signature that may come from As clause delegate or from a parameter list.
''' The event signatures are compared without regard to name (including the interface part, if any)
''' and the return type must match. (NOTE: that return type of implementing event is always Void)
''' </summary>
Public Shared ReadOnly ExplicitEventImplementationComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=False,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=False)
Public Shared ReadOnly ExplicitEventImplementationWithTupleNamesComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=False,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=True)
''' <summary>
''' This instance is used to check whether one event overrides another, according to the VB definition.
''' </summary>
Public Shared ReadOnly OverrideSignatureComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=True,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=False)
''' <summary>
''' This instance is intended to reflect the definition of signature equality used by the runtime (ECMA 335 Section 8.6.1.6).
''' It considers type, name, parameters, and custom modifiers.
''' </summary>
Public Shared ReadOnly RuntimeEventSignatureComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=True,
considerType:=True,
considerCustomModifiers:=True,
considerTupleNames:=False)
''' <summary>
''' This instance is used to compare potential WinRT fake events in type projection.
'''
''' FIXME(angocke): This is almost certainly wrong. The semantics of WinRT conflict
''' comparison should probably match overload resolution (i.e., we should not add a member
''' to lookup that would result in ambiguity), but this is closer to what Dev12 does.
'''
''' The real fix here is to establish a spec for how WinRT conflict comparison should be
''' performed. Once this is done we should remove these comments.
''' </summary>
Public Shared ReadOnly WinRTConflictComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=True,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=False)
' Compare the event name (no explicit part)
Private ReadOnly _considerName As Boolean
' Compare the event type
Private ReadOnly _considerType As Boolean
' Consider custom modifiers on/in parameters and return types (if return is considered).
Private ReadOnly _considerCustomModifiers As Boolean
' Consider tuple names in parameters and return types (if return is considered).
Private ReadOnly _considerTupleNames As Boolean
Private Sub New(considerName As Boolean,
considerType As Boolean,
considerCustomModifiers As Boolean,
considerTupleNames As Boolean)
Me._considerName = considerName
Me._considerType = considerType
Me._considerCustomModifiers = considerCustomModifiers
Me._considerTupleNames = considerTupleNames
End Sub
#Region "IEqualityComparer(Of EventSymbol) Members"
Public Overloads Function Equals(event1 As EventSymbol, event2 As EventSymbol) As Boolean _
Implements IEqualityComparer(Of EventSymbol).Equals
If event1 = event2 Then
Return True
End If
If event1 Is Nothing OrElse event2 Is Nothing Then
Return False
End If
If _considerName AndAlso Not IdentifierComparison.Equals(event1.Name, event2.Name) Then
Return False
End If
If _considerType Then
Dim comparison As TypeCompareKind = MethodSignatureComparer.MakeTypeCompareKind(_considerCustomModifiers, _considerTupleNames)
If Not event1.Type.IsSameType(event2.Type, comparison) Then
Return False
End If
End If
If event1.DelegateParameters.Length > 0 OrElse event2.DelegateParameters.Length > 0 Then
If Not MethodSignatureComparer.HaveSameParameterTypes(event1.DelegateParameters,
Nothing,
event2.DelegateParameters,
Nothing,
considerByRef:=True,
considerCustomModifiers:=_considerCustomModifiers,
considerTupleNames:=_considerTupleNames) Then
Return False
End If
End If
Return True
End Function
Public Overloads Function GetHashCode([event] As EventSymbol) As Integer _
Implements IEqualityComparer(Of EventSymbol).GetHashCode
Dim _hash As Integer = 1
If [event] IsNot Nothing Then
If _considerName Then
_hash = Hash.Combine([event].Name, _hash)
End If
If _considerType AndAlso Not _considerCustomModifiers Then
_hash = Hash.Combine([event].Type, _hash)
End If
_hash = Hash.Combine(_hash, [event].DelegateParameters.Length)
End If
Return _hash
End Function
#End Region
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Generic
Imports System.Diagnostics
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Implementation of IEqualityComparer for EventSymbol, with options for various aspects
''' to compare.
''' </summary>
Friend Class EventSignatureComparer
Implements IEqualityComparer(Of EventSymbol)
''' <summary>
''' This instance is used when trying to determine which implemented interface event is implemented
''' by a event with an Implements clause, according to VB rules.
''' This comparer uses event signature that may come from As clause delegate or from a parameter list.
''' The event signatures are compared without regard to name (including the interface part, if any)
''' and the return type must match. (NOTE: that return type of implementing event is always Void)
''' </summary>
Public Shared ReadOnly ExplicitEventImplementationComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=False,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=False)
Public Shared ReadOnly ExplicitEventImplementationWithTupleNamesComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=False,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=True)
''' <summary>
''' This instance is used to check whether one event overrides another, according to the VB definition.
''' </summary>
Public Shared ReadOnly OverrideSignatureComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=True,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=False)
''' <summary>
''' This instance is intended to reflect the definition of signature equality used by the runtime (ECMA 335 Section 8.6.1.6).
''' It considers type, name, parameters, and custom modifiers.
''' </summary>
Public Shared ReadOnly RuntimeEventSignatureComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=True,
considerType:=True,
considerCustomModifiers:=True,
considerTupleNames:=False)
''' <summary>
''' This instance is used to compare potential WinRT fake events in type projection.
'''
''' FIXME(angocke): This is almost certainly wrong. The semantics of WinRT conflict
''' comparison should probably match overload resolution (i.e., we should not add a member
''' to lookup that would result in ambiguity), but this is closer to what Dev12 does.
'''
''' The real fix here is to establish a spec for how WinRT conflict comparison should be
''' performed. Once this is done we should remove these comments.
''' </summary>
Public Shared ReadOnly WinRTConflictComparer As EventSignatureComparer =
New EventSignatureComparer(considerName:=True,
considerType:=False,
considerCustomModifiers:=False,
considerTupleNames:=False)
' Compare the event name (no explicit part)
Private ReadOnly _considerName As Boolean
' Compare the event type
Private ReadOnly _considerType As Boolean
' Consider custom modifiers on/in parameters and return types (if return is considered).
Private ReadOnly _considerCustomModifiers As Boolean
' Consider tuple names in parameters and return types (if return is considered).
Private ReadOnly _considerTupleNames As Boolean
Private Sub New(considerName As Boolean,
considerType As Boolean,
considerCustomModifiers As Boolean,
considerTupleNames As Boolean)
Me._considerName = considerName
Me._considerType = considerType
Me._considerCustomModifiers = considerCustomModifiers
Me._considerTupleNames = considerTupleNames
End Sub
#Region "IEqualityComparer(Of EventSymbol) Members"
Public Overloads Function Equals(event1 As EventSymbol, event2 As EventSymbol) As Boolean _
Implements IEqualityComparer(Of EventSymbol).Equals
If event1 = event2 Then
Return True
End If
If event1 Is Nothing OrElse event2 Is Nothing Then
Return False
End If
If _considerName AndAlso Not IdentifierComparison.Equals(event1.Name, event2.Name) Then
Return False
End If
If _considerType Then
Dim comparison As TypeCompareKind = MethodSignatureComparer.MakeTypeCompareKind(_considerCustomModifiers, _considerTupleNames)
If Not event1.Type.IsSameType(event2.Type, comparison) Then
Return False
End If
End If
If event1.DelegateParameters.Length > 0 OrElse event2.DelegateParameters.Length > 0 Then
If Not MethodSignatureComparer.HaveSameParameterTypes(event1.DelegateParameters,
Nothing,
event2.DelegateParameters,
Nothing,
considerByRef:=True,
considerCustomModifiers:=_considerCustomModifiers,
considerTupleNames:=_considerTupleNames) Then
Return False
End If
End If
Return True
End Function
Public Overloads Function GetHashCode([event] As EventSymbol) As Integer _
Implements IEqualityComparer(Of EventSymbol).GetHashCode
Dim _hash As Integer = 1
If [event] IsNot Nothing Then
If _considerName Then
_hash = Hash.Combine([event].Name, _hash)
End If
If _considerType AndAlso Not _considerCustomModifiers Then
_hash = Hash.Combine([event].Type, _hash)
End If
_hash = Hash.Combine(_hash, [event].DelegateParameters.Length)
End If
Return _hash
End Function
#End Region
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
namespace Microsoft.CodeAnalysis.Editor.FindUsages
{
internal abstract partial class AbstractFindUsagesService : IFindUsagesService, IFindUsagesLSPService
{
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
namespace Microsoft.CodeAnalysis.Editor.FindUsages
{
internal abstract partial class AbstractFindUsagesService : IFindUsagesService, IFindUsagesLSPService
{
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/PersistentStorageOptionsProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Host
{
[ExportOptionProvider, Shared]
internal class PersistentStorageOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public PersistentStorageOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } =
ImmutableArray.Create<IOption>(PersistentStorageOptions.Enabled);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Host
{
[ExportOptionProvider, Shared]
internal class PersistentStorageOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public PersistentStorageOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } =
ImmutableArray.Create<IOption>(PersistentStorageOptions.Enabled);
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Core/ModernCommands/SortAndRemoveUnnecessaryImportsCommandArgs.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Editor.Commanding;
namespace Microsoft.CodeAnalysis.Editor.Commanding.Commands
{
/// <summary>
/// Arguments for the Sort and Remove Unused Usings command being invoked.
/// </summary>
[ExcludeFromCodeCoverage]
internal class SortAndRemoveUnnecessaryImportsCommandArgs : EditorCommandArgs
{
public SortAndRemoveUnnecessaryImportsCommandArgs(ITextView textView, ITextBuffer subjectBuffer)
: base(textView, subjectBuffer)
{
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Editor.Commanding;
namespace Microsoft.CodeAnalysis.Editor.Commanding.Commands
{
/// <summary>
/// Arguments for the Sort and Remove Unused Usings command being invoked.
/// </summary>
[ExcludeFromCodeCoverage]
internal class SortAndRemoveUnnecessaryImportsCommandArgs : EditorCommandArgs
{
public SortAndRemoveUnnecessaryImportsCommandArgs(ITextView textView, ITextBuffer subjectBuffer)
: base(textView, subjectBuffer)
{
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHandler.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Roslyn.Utilities;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens
{
/// <summary>
/// Computes the semantic tokens for a whole document.
/// </summary>
/// <remarks>
/// This handler is invoked when a user opens a file. Depending on the size of the file, the full token set may be
/// slow to compute, so the <see cref="SemanticTokensRangeHandler"/> is also called when a file is opened in order
/// to render UI results quickly until this handler finishes running.
/// Unlike the range handler, the whole document handler may be called again if the LSP client finds an edit that
/// is difficult to correctly apply to their tags cache. This allows for reliable recovery from errors and accounts
/// for limitations in the edits application logic.
/// </remarks>
internal class SemanticTokensHandler : IRequestHandler<LSP.SemanticTokensParams, LSP.SemanticTokens>
{
private readonly SemanticTokensCache _tokensCache;
public SemanticTokensHandler(SemanticTokensCache tokensCache)
{
_tokensCache = tokensCache;
}
public string Method => LSP.Methods.TextDocumentSemanticTokensFullName;
public bool MutatesSolutionState => false;
public bool RequiresLSPSolution => true;
public LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.SemanticTokensParams request)
{
Contract.ThrowIfNull(request.TextDocument);
return request.TextDocument;
}
public async Task<LSP.SemanticTokens> HandleRequestAsync(
LSP.SemanticTokensParams request,
RequestContext context,
CancellationToken cancellationToken)
{
Contract.ThrowIfNull(request.TextDocument, "TextDocument is null.");
Contract.ThrowIfNull(context.Document, "Document is null.");
var resultId = _tokensCache.GetNextResultId();
var (tokensData, isFinalized) = await SemanticTokensHelpers.ComputeSemanticTokensDataAsync(
context.Document, SemanticTokensCache.TokenTypeToIndex,
range: null, cancellationToken).ConfigureAwait(false);
var tokens = new RoslynSemanticTokens { ResultId = resultId, Data = tokensData, IsFinalized = isFinalized };
if (tokensData.Length > 0)
{
await _tokensCache.UpdateCacheAsync(request.TextDocument.Uri, tokens, cancellationToken).ConfigureAwait(false);
}
return tokens;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Roslyn.Utilities;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens
{
/// <summary>
/// Computes the semantic tokens for a whole document.
/// </summary>
/// <remarks>
/// This handler is invoked when a user opens a file. Depending on the size of the file, the full token set may be
/// slow to compute, so the <see cref="SemanticTokensRangeHandler"/> is also called when a file is opened in order
/// to render UI results quickly until this handler finishes running.
/// Unlike the range handler, the whole document handler may be called again if the LSP client finds an edit that
/// is difficult to correctly apply to their tags cache. This allows for reliable recovery from errors and accounts
/// for limitations in the edits application logic.
/// </remarks>
internal class SemanticTokensHandler : IRequestHandler<LSP.SemanticTokensParams, LSP.SemanticTokens>
{
private readonly SemanticTokensCache _tokensCache;
public SemanticTokensHandler(SemanticTokensCache tokensCache)
{
_tokensCache = tokensCache;
}
public string Method => LSP.Methods.TextDocumentSemanticTokensFullName;
public bool MutatesSolutionState => false;
public bool RequiresLSPSolution => true;
public LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.SemanticTokensParams request)
{
Contract.ThrowIfNull(request.TextDocument);
return request.TextDocument;
}
public async Task<LSP.SemanticTokens> HandleRequestAsync(
LSP.SemanticTokensParams request,
RequestContext context,
CancellationToken cancellationToken)
{
Contract.ThrowIfNull(request.TextDocument, "TextDocument is null.");
Contract.ThrowIfNull(context.Document, "Document is null.");
var resultId = _tokensCache.GetNextResultId();
var (tokensData, isFinalized) = await SemanticTokensHelpers.ComputeSemanticTokensDataAsync(
context.Document, SemanticTokensCache.TokenTypeToIndex,
range: null, cancellationToken).ConfigureAwait(false);
var tokens = new RoslynSemanticTokens { ResultId = resultId, Data = tokensData, IsFinalized = isFinalized };
if (tokensData.Length > 0)
{
await _tokensCache.UpdateCacheAsync(request.TextDocument.Uri, tokens, cancellationToken).ConfigureAwait(false);
}
return tokens;
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Scripting/Core/Hosting/AssemblyLoader/CoreAssemblyLoaderImpl.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.Loader;
namespace Microsoft.CodeAnalysis.Scripting.Hosting
{
internal sealed class CoreAssemblyLoaderImpl : AssemblyLoaderImpl
{
private readonly LoadContext _inMemoryAssemblyContext;
internal CoreAssemblyLoaderImpl(InteractiveAssemblyLoader loader)
: base(loader)
{
_inMemoryAssemblyContext = new LoadContext(Loader, null);
}
public override Assembly LoadFromStream(Stream peStream, Stream pdbStream)
{
return _inMemoryAssemblyContext.LoadFromStream(peStream, pdbStream);
}
public override AssemblyAndLocation LoadFromPath(string path)
{
// Create a new context that knows the directory where the assembly was loaded from
// and uses it to resolve dependencies of the assembly. We could create one context per directory,
// but there is no need to reuse contexts.
var assembly = new LoadContext(Loader, Path.GetDirectoryName(path)).LoadFromAssemblyPath(path);
return new AssemblyAndLocation(assembly, path, fromGac: false);
}
public override void Dispose()
{
// nop
}
private sealed class LoadContext : AssemblyLoadContext
{
private readonly string _loadDirectoryOpt;
private readonly InteractiveAssemblyLoader _loader;
internal LoadContext(InteractiveAssemblyLoader loader, string loadDirectoryOpt)
{
Debug.Assert(loader != null);
_loader = loader;
_loadDirectoryOpt = loadDirectoryOpt;
// CoreCLR resolves assemblies in steps:
//
// 1) Call AssemblyLoadContext.Load -- our context returns null
// 2) TPA list
// 3) Default.Resolving event
// 4) AssemblyLoadContext.Resolving event -- hooked below
//
// What we want is to let the default context load assemblies it knows about (this includes already loaded assemblies,
// assemblies in AppPath, platform assemblies, assemblies explciitly resolved by the App by hooking Default.Resolving, etc.).
// Only if the assembly can't be resolved that way, the interactive resolver steps in.
//
// This order is necessary to avoid loading assemblies twice (by the host App and by interactive loader).
Resolving += (_, assemblyName) =>
_loader.ResolveAssembly(AssemblyIdentity.FromAssemblyReference(assemblyName), _loadDirectoryOpt);
}
protected override Assembly Load(AssemblyName assemblyName) => null;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.Loader;
namespace Microsoft.CodeAnalysis.Scripting.Hosting
{
internal sealed class CoreAssemblyLoaderImpl : AssemblyLoaderImpl
{
private readonly LoadContext _inMemoryAssemblyContext;
internal CoreAssemblyLoaderImpl(InteractiveAssemblyLoader loader)
: base(loader)
{
_inMemoryAssemblyContext = new LoadContext(Loader, null);
}
public override Assembly LoadFromStream(Stream peStream, Stream pdbStream)
{
return _inMemoryAssemblyContext.LoadFromStream(peStream, pdbStream);
}
public override AssemblyAndLocation LoadFromPath(string path)
{
// Create a new context that knows the directory where the assembly was loaded from
// and uses it to resolve dependencies of the assembly. We could create one context per directory,
// but there is no need to reuse contexts.
var assembly = new LoadContext(Loader, Path.GetDirectoryName(path)).LoadFromAssemblyPath(path);
return new AssemblyAndLocation(assembly, path, fromGac: false);
}
public override void Dispose()
{
// nop
}
private sealed class LoadContext : AssemblyLoadContext
{
private readonly string _loadDirectoryOpt;
private readonly InteractiveAssemblyLoader _loader;
internal LoadContext(InteractiveAssemblyLoader loader, string loadDirectoryOpt)
{
Debug.Assert(loader != null);
_loader = loader;
_loadDirectoryOpt = loadDirectoryOpt;
// CoreCLR resolves assemblies in steps:
//
// 1) Call AssemblyLoadContext.Load -- our context returns null
// 2) TPA list
// 3) Default.Resolving event
// 4) AssemblyLoadContext.Resolving event -- hooked below
//
// What we want is to let the default context load assemblies it knows about (this includes already loaded assemblies,
// assemblies in AppPath, platform assemblies, assemblies explciitly resolved by the App by hooking Default.Resolving, etc.).
// Only if the assembly can't be resolved that way, the interactive resolver steps in.
//
// This order is necessary to avoid loading assemblies twice (by the host App and by interactive loader).
Resolving += (_, assemblyName) =>
_loader.ResolveAssembly(AssemblyIdentity.FromAssemblyReference(assemblyName), _loadDirectoryOpt);
}
protected override Assembly Load(AssemblyName assemblyName) => null;
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
[CompilerTrait(CompilerFeature.ReadOnlyReferences)]
public class CodeGenRefReadOnlyReturnTests : CompilingTestBase
{
[Fact]
public void RefReadonlyLocalToField()
{
var source = @"
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
readonly struct S2
{
public readonly int X;
public S2(int x) => X = x;
public void AddOne() { }
}
class C
{
static S s1 = new S(0);
readonly static S s2 = new S(0);
static S2 s3 = new S2(0);
readonly S2 s4 = new S2(0);
ref readonly S M()
{
ref readonly S rs1 = ref s1;
rs1.AddOne();
ref readonly S rs2 = ref s2;
rs2.AddOne();
ref readonly S2 rs3 = ref s3;
rs3.AddOne();
ref readonly S2 rs4 = ref s4;
rs4.AddOne();
return ref rs1;
}
}";
// WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref assignments
var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: Verification.Fails);
comp.VerifyIL("C.M", @"
{
// Code size 59 (0x3b)
.maxstack 2
.locals init (S V_0)
IL_0000: ldsflda ""S C.s1""
IL_0005: dup
IL_0006: ldobj ""S""
IL_000b: stloc.0
IL_000c: ldloca.s V_0
IL_000e: call ""void S.AddOne()""
IL_0013: ldsflda ""S C.s2""
IL_0018: ldobj ""S""
IL_001d: stloc.0
IL_001e: ldloca.s V_0
IL_0020: call ""void S.AddOne()""
IL_0025: ldsflda ""S2 C.s3""
IL_002a: call ""void S2.AddOne()""
IL_002f: ldarg.0
IL_0030: ldflda ""S2 C.s4""
IL_0035: call ""void S2.AddOne()""
IL_003a: ret
}");
comp = CompileAndVerify(source, verify: Verification.Fails);
comp.VerifyIL("C.M", @"
{
// Code size 59 (0x3b)
.maxstack 2
.locals init (S V_0)
IL_0000: ldsflda ""S C.s1""
IL_0005: dup
IL_0006: ldobj ""S""
IL_000b: stloc.0
IL_000c: ldloca.s V_0
IL_000e: call ""void S.AddOne()""
IL_0013: ldsflda ""S C.s2""
IL_0018: ldobj ""S""
IL_001d: stloc.0
IL_001e: ldloca.s V_0
IL_0020: call ""void S.AddOne()""
IL_0025: ldsflda ""S2 C.s3""
IL_002a: call ""void S2.AddOne()""
IL_002f: ldarg.0
IL_0030: ldflda ""S2 C.s4""
IL_0035: call ""void S2.AddOne()""
IL_003a: ret
}");
}
[Fact]
public void CallsOnRefReadonlyCopyReceiver()
{
var comp = CompileAndVerify(@"
using System;
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
class C
{
public static void Main()
{
S s = new S(0);
ref readonly S rs = ref s;
Console.WriteLine(rs.X);
rs.AddOne();
Console.WriteLine(rs.X);
rs.AddOne();
rs.AddOne();
rs.AddOne();
}
}", expectedOutput: @"0
0");
comp.VerifyIL("C.Main", @"
{
// Code size 88 (0x58)
.maxstack 2
.locals init (S V_0, //s
S V_1)
IL_0000: ldloca.s V_0
IL_0002: ldc.i4.0
IL_0003: call ""S..ctor(int)""
IL_0008: ldloca.s V_0
IL_000a: dup
IL_000b: ldfld ""int S.X""
IL_0010: call ""void System.Console.WriteLine(int)""
IL_0015: dup
IL_0016: ldobj ""S""
IL_001b: stloc.1
IL_001c: ldloca.s V_1
IL_001e: call ""void S.AddOne()""
IL_0023: dup
IL_0024: ldfld ""int S.X""
IL_0029: call ""void System.Console.WriteLine(int)""
IL_002e: dup
IL_002f: ldobj ""S""
IL_0034: stloc.1
IL_0035: ldloca.s V_1
IL_0037: call ""void S.AddOne()""
IL_003c: dup
IL_003d: ldobj ""S""
IL_0042: stloc.1
IL_0043: ldloca.s V_1
IL_0045: call ""void S.AddOne()""
IL_004a: ldobj ""S""
IL_004f: stloc.1
IL_0050: ldloca.s V_1
IL_0052: call ""void S.AddOne()""
IL_0057: ret
}");
// This should generate similar IL to the previous
comp = CompileAndVerify(@"
using System;
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
class C
{
public static void Main()
{
S s = new S(0);
ref S sr = ref s;
var temp = sr;
temp.AddOne();
Console.WriteLine(temp.X);
temp = sr;
temp.AddOne();
Console.WriteLine(temp.X);
}
}", expectedOutput: @"1
1");
comp.VerifyIL("C.Main", @"
{
// Code size 60 (0x3c)
.maxstack 2
.locals init (S V_0, //s
S V_1) //temp
IL_0000: ldloca.s V_0
IL_0002: ldc.i4.0
IL_0003: call ""S..ctor(int)""
IL_0008: ldloca.s V_0
IL_000a: dup
IL_000b: ldobj ""S""
IL_0010: stloc.1
IL_0011: ldloca.s V_1
IL_0013: call ""void S.AddOne()""
IL_0018: ldloc.1
IL_0019: ldfld ""int S.X""
IL_001e: call ""void System.Console.WriteLine(int)""
IL_0023: ldobj ""S""
IL_0028: stloc.1
IL_0029: ldloca.s V_1
IL_002b: call ""void S.AddOne()""
IL_0030: ldloc.1
IL_0031: ldfld ""int S.X""
IL_0036: call ""void System.Console.WriteLine(int)""
IL_003b: ret
}");
}
[Fact]
public void RefReadOnlyParamCopyReceiver()
{
var comp = CompileAndVerify(@"
using System;
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
class C
{
public static void Main()
{
M(new S(0));
}
static void M(in S rs)
{
Console.WriteLine(rs.X);
rs.AddOne();
Console.WriteLine(rs.X);
}
}", expectedOutput: @"0
0");
comp.VerifyIL(@"C.M", @"
{
// Code size 37 (0x25)
.maxstack 1
.locals init (S V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""int S.X""
IL_0006: call ""void System.Console.WriteLine(int)""
IL_000b: ldarg.0
IL_000c: ldobj ""S""
IL_0011: stloc.0
IL_0012: ldloca.s V_0
IL_0014: call ""void S.AddOne()""
IL_0019: ldarg.0
IL_001a: ldfld ""int S.X""
IL_001f: call ""void System.Console.WriteLine(int)""
IL_0024: ret
}");
}
[Fact]
public void CarryThroughLifetime()
{
var comp = CompileAndVerify(@"
class C
{
static ref readonly int M(ref int p)
{
ref readonly int rp = ref p;
return ref rp;
}
}", verify: Verification.Fails);
comp.VerifyIL("C.M", @"
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}");
}
[Fact]
public void TempForReadonly()
{
var comp = CompileAndVerify(@"
using System;
class C
{
public static void Main()
{
void L(in int p)
{
Console.WriteLine(p);
}
for (int i = 0; i < 3; i++)
{
L(10);
L(i);
}
}
}", expectedOutput: @"10
0
10
1
10
2");
comp.VerifyIL("C.Main()", @"
{
// Code size 30 (0x1e)
.maxstack 2
.locals init (int V_0, //i
int V_1)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: br.s IL_0019
IL_0004: ldc.i4.s 10
IL_0006: stloc.1
IL_0007: ldloca.s V_1
IL_0009: call ""void C.<Main>g__L|0_0(in int)""
IL_000e: ldloca.s V_0
IL_0010: call ""void C.<Main>g__L|0_0(in int)""
IL_0015: ldloc.0
IL_0016: ldc.i4.1
IL_0017: add
IL_0018: stloc.0
IL_0019: ldloc.0
IL_001a: ldc.i4.3
IL_001b: blt.s IL_0004
IL_001d: ret
}");
}
[Fact]
public void RefReturnAssign()
{
var verifier = CompileAndVerify(@"
class C
{
static void M()
{
ref readonly int x = ref Helper();
int y = x + 1;
}
static ref readonly int Helper()
=> ref (new int[1])[0];
}");
verifier.VerifyIL("C.M()", @"
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: call ""ref readonly int C.Helper()""
IL_0005: pop
IL_0006: ret
}");
}
[Fact]
public void RefReturnAssign2()
{
var verifier = CompileAndVerify(@"
class C
{
static void M()
{
ref readonly int x = ref Helper();
int y = x + 1;
}
static ref int Helper()
=> ref (new int[1])[0];
}");
verifier.VerifyIL("C.M()", @"
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: call ""ref int C.Helper()""
IL_0005: pop
IL_0006: ret
}");
}
[Fact]
public void RefReturnArrayAccess()
{
var text = @"
class Program
{
static ref readonly int M()
{
return ref (new int[1])[0];
}
}
";
var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular);
comp.VerifyIL("Program.M()", @"
{
// Code size 13 (0xd)
.maxstack 2
IL_0000: ldc.i4.1
IL_0001: newarr ""int""
IL_0006: ldc.i4.0
IL_0007: ldelema ""int""
IL_000c: ret
}");
}
[Fact]
public void BindingInvalidRefRoCombination()
{
var text = @"
class Program
{
// should be a syntax error
// just make sure binder is ok with this
static ref readonly ref int M(int x)
{
return ref M(x);
}
// should be a syntax error
// just make sure binder is ok with this
static readonly int M1(int x)
{
return ref M(x);
}
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS1031: Type expected
// static ref readonly ref int M(int x)
Diagnostic(ErrorCode.ERR_TypeExpected, "ref").WithLocation(6, 25),
// (13,25): error CS0106: The modifier 'readonly' is not valid for this item
// static readonly int M1(int x)
Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("readonly").WithLocation(13, 25),
// (15,20): error CS0120: An object reference is required for the non-static field, method, or property 'Program.M(int)'
// return ref M(x);
Diagnostic(ErrorCode.ERR_ObjectRequired, "M").WithArguments("Program.M(int)").WithLocation(15, 20),
// (15,9): error CS8149: By-reference returns may only be used in methods that return by reference
// return ref M(x);
Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(15, 9)
);
}
[Fact]
public void ReadonlyReturnCannotAssign()
{
var text = @"
class Program
{
static void Test()
{
M() = 1;
M1().Alice = 2;
M() ++;
M1().Alice --;
M() += 1;
M1().Alice -= 2;
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 9),
// (7,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(7, 9),
// (9,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(9, 9),
// (10,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(10, 9),
// (12,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 9),
// (13,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(13, 9)
);
}
[Fact]
public void ReadonlyReturnCannotAssign1()
{
var text = @"
class Program
{
static void Test()
{
P = 1;
P1.Alice = 2;
P ++;
P1.Alice --;
P += 1;
P1.Alice -= 2;
}
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
// P = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(6, 9),
// (7,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(7, 9),
// (9,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
// P ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(9, 9),
// (10,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(10, 9),
// (12,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
// P += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(12, 9),
// (13,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(13, 9)
);
}
[Fact]
public void ReadonlyReturnCannotAssignByref()
{
var text = @"
class Program
{
static void Test()
{
ref var y = ref M();
ref int a = ref M1.Alice;
ref var y1 = ref P;
ref int a1 = ref P1.Alice;
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8329: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
// ref var y = ref M();
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 25),
// (7,25): error CS0119: 'Program.M1()' is a method, which is not valid in the given context
// ref int a = ref M1.Alice;
Diagnostic(ErrorCode.ERR_BadSKunknown, "M1").WithArguments("Program.M1()", "method").WithLocation(7, 25),
// (8,26): error CS8329: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
// ref var y1 = ref P;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(8, 26),
// (9,26): error CS8330: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
// ref int a1 = ref P1.Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(9, 26)
);
}
[Fact]
public void ReadonlyReturnCannotTakePtr()
{
var text = @"
class Program
{
unsafe static void Test()
{
int* a = & M();
int* b = & M1().Alice;
int* a1 = & P;
int* b2 = & P1.Alice;
fixed(int* c = & M())
{
}
fixed(int* d = & M1().Alice)
{
}
fixed(int* c = & P)
{
}
fixed(int* d = & P1.Alice)
{
}
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (6,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* a = & M();
Diagnostic(ErrorCode.ERR_FixedNeeded, "& M()").WithLocation(6, 18),
// (7,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* b = & M1().Alice;
Diagnostic(ErrorCode.ERR_FixedNeeded, "& M1().Alice").WithLocation(7, 18),
// (9,19): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* a1 = & P;
Diagnostic(ErrorCode.ERR_FixedNeeded, "& P").WithLocation(9, 19),
// (10,19): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* b2 = & P1.Alice;
Diagnostic(ErrorCode.ERR_FixedNeeded, "& P1.Alice").WithLocation(10, 19)
);
}
[Fact]
public void ReadonlyReturnCannotReturnByOrdinaryRef()
{
var text = @"
class Program
{
static ref int Test()
{
bool b = true;
if (b)
{
if (b)
{
return ref M();
}
else
{
return ref M1().Alice;
}
}
else
{
if (b)
{
return ref P;
}
else
{
return ref P1.Alice;
}
}
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (12,28): error CS8333: Cannot return method 'Program.M()' by writable reference because it is a readonly variable
// return ref M();
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 28),
// (16,28): error CS8334: Members of method 'Program.M1()' cannot be returned by writable reference because it is a readonly variable
// return ref M1().Alice;
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(16, 28),
// (23,28): error CS8333: Cannot return property 'Program.P' by writable reference because it is a readonly variable
// return ref P;
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(23, 28),
// (27,28): error CS8334: Members of property 'Program.P1' cannot be returned by writable reference because it is a readonly variable
// return ref P1.Alice;
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(27, 28)
);
}
[Fact]
public void ReadonlyReturnCanReturnByRefReadonly()
{
var text = @"
class Program
{
static ref readonly int Test()
{
bool b = true;
if (b)
{
if (b)
{
return ref M();
}
else
{
return ref M1().Alice;
}
}
else
{
if (b)
{
return ref P;
}
else
{
return ref P1.Alice;
}
}
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CompileAndVerifyWithMscorlib40(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular, verify: Verification.Passes);
comp.VerifyIL("Program.Test", @"
{
// Code size 45 (0x2d)
.maxstack 1
.locals init (bool V_0) //b
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: brfalse.s IL_0019
IL_0005: ldloc.0
IL_0006: brfalse.s IL_000e
IL_0008: call ""ref readonly int Program.M()""
IL_000d: ret
IL_000e: call ""ref readonly System.ValueTuple<int, int> Program.M1()""
IL_0013: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0018: ret
IL_0019: ldloc.0
IL_001a: brfalse.s IL_0022
IL_001c: call ""ref readonly int Program.P.get""
IL_0021: ret
IL_0022: call ""ref readonly System.ValueTuple<int, int> Program.P1.get""
IL_0027: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_002c: ret
}");
}
[Fact]
[CompilerTrait(CompilerFeature.PEVerifyCompat)]
public void ReadonlyFieldCanReturnByRefReadonly()
{
var text = @"
class Program
{
ref readonly int Test()
{
bool b = true;
if (b)
{
if (b)
{
return ref F;
}
else
{
return ref F1.Alice;
}
}
else
{
if (b)
{
return ref S1.F;
}
else
{
return ref S2.F1.Alice;
}
}
}
readonly int F = 1;
static readonly (int Alice, int Bob) F1 = (2,3);
readonly S S1 = new S();
static readonly S S2 = new S();
struct S
{
public readonly int F;
public readonly (int Alice, int Bob) F1;
}
}
";
var comp = CompileAndVerifyWithMscorlib40(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular, verify: Verification.Fails);
comp.VerifyIL("Program.Test", @"
{
// Code size 57 (0x39)
.maxstack 1
.locals init (bool V_0) //b
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: brfalse.s IL_001a
IL_0005: ldloc.0
IL_0006: brfalse.s IL_000f
IL_0008: ldarg.0
IL_0009: ldflda ""int Program.F""
IL_000e: ret
IL_000f: ldsflda ""System.ValueTuple<int, int> Program.F1""
IL_0014: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0019: ret
IL_001a: ldloc.0
IL_001b: brfalse.s IL_0029
IL_001d: ldarg.0
IL_001e: ldflda ""Program.S Program.S1""
IL_0023: ldflda ""int Program.S.F""
IL_0028: ret
IL_0029: ldsflda ""Program.S Program.S2""
IL_002e: ldflda ""System.ValueTuple<int, int> Program.S.F1""
IL_0033: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0038: ret
}");
// WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref returns
comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: Verification.Fails, targetFramework: TargetFramework.Mscorlib40);
comp.VerifyIL("Program.Test", @"
{
// Code size 57 (0x39)
.maxstack 1
.locals init (bool V_0) //b
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: brfalse.s IL_001a
IL_0005: ldloc.0
IL_0006: brfalse.s IL_000f
IL_0008: ldarg.0
IL_0009: ldflda ""int Program.F""
IL_000e: ret
IL_000f: ldsflda ""System.ValueTuple<int, int> Program.F1""
IL_0014: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0019: ret
IL_001a: ldloc.0
IL_001b: brfalse.s IL_0029
IL_001d: ldarg.0
IL_001e: ldflda ""Program.S Program.S1""
IL_0023: ldflda ""int Program.S.F""
IL_0028: ret
IL_0029: ldsflda ""Program.S Program.S2""
IL_002e: ldflda ""System.ValueTuple<int, int> Program.S.F1""
IL_0033: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0038: ret
}");
}
[Fact]
public void ReadonlyReturnByRefReadonlyLocalSafety()
{
var text = @"
class Program
{
ref readonly int Test()
{
bool b = true;
int local = 42;
if (b)
{
return ref M(ref local);
}
else
{
return ref M1(out local).Alice;
}
}
static ref readonly int M(ref int x) => throw null;
static ref readonly (int Alice, int Bob) M1(out int x) => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (11,30): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref M(ref local);
Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(11, 30),
// (11,24): error CS8347: Cannot use a result of 'Program.M(ref int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M(ref local);
Diagnostic(ErrorCode.ERR_EscapeCall, "M(ref local)").WithArguments("Program.M(ref int)", "x").WithLocation(11, 24),
// (15,31): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref M1(out local).Alice;
Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(15, 31),
// (15,24): error CS8348: Cannot use a member of result of 'Program.M1(out int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M1(out local).Alice;
Diagnostic(ErrorCode.ERR_EscapeCall2, "M1(out local)").WithArguments("Program.M1(out int)", "x").WithLocation(15, 24)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyLocalSafety1()
{
var text = @"
class Program
{
ref readonly int Test()
{
int local = 42;
return ref this[local];
}
ref readonly int this[in int x] => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (8,25): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref this[local];
Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(8, 25),
// (8,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref this[local];
Diagnostic(ErrorCode.ERR_EscapeCall, "this[local]").WithArguments("Program.this[in int]", "x").WithLocation(8, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyLiteralSafety1()
{
var text = @"
class Program
{
ref readonly int Test()
{
return ref this[42];
}
ref readonly int this[in int x] => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref this[42];
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 25),
// (6,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref this[42];
Diagnostic(ErrorCode.ERR_EscapeCall, "this[42]").WithArguments("Program.this[in int]", "x").WithLocation(6, 20)
);
}
[WorkItem(19930, "https://github.com/dotnet/roslyn/issues/19930")]
[Fact]
public void ReadonlyReturnByRefInStruct()
{
var text = @"
struct S1
{
readonly int x;
ref readonly S1 Test()
{
return ref this;
}
ref readonly int this[in int i] => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (8,20): error CS8170: Struct members cannot return 'this' or other instance members by reference
// return ref this;
Diagnostic(ErrorCode.ERR_RefReturnStructThis, "this").WithArguments("this").WithLocation(8, 20),
// (11,44): error CS8170: Struct members cannot return 'this' or other instance members by reference
// in int this[in int i] => ref x;
Diagnostic(ErrorCode.ERR_RefReturnStructThis, "x").WithArguments("this").WithLocation(11, 44)
);
}
[WorkItem(19930, "https://github.com/dotnet/roslyn/issues/19930")]
[Fact]
public void ReadonlyReturnByRefRValue()
{
var text = @"
struct S1
{
ref readonly int Test()
{
return ref 42;
}
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,20): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref 42;
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyLiteralSafety2()
{
var text = @"
class Program
{
ref readonly int Test()
{
return ref M(42);
}
ref readonly int M(in int x) => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref M(42);
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 22),
// (6,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M(42);
Diagnostic(ErrorCode.ERR_EscapeCall, "M(42)").WithArguments("Program.M(in int)", "x").WithLocation(6, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyOptSafety()
{
var text = @"
class Program
{
ref readonly int Test()
{
return ref M();
}
ref readonly int M(in int x = 42) => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,20): error CS8156: An expression cannot be used in this context because it may not be passed or returned by reference
// return ref M();
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "M()").WithLocation(6, 20),
// (6,20): error CS8347: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M();
Diagnostic(ErrorCode.ERR_EscapeCall, "M()").WithArguments("Program.M(in int)", "x").WithLocation(6, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyConvSafety()
{
var text = @"
class Program
{
ref readonly int Test()
{
byte b = 42;
return ref M(b);
}
ref readonly int M(in int x) => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (7,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref M(b);
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "b").WithLocation(7, 22),
// (7,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M(b);
Diagnostic(ErrorCode.ERR_EscapeCall, "M(b)").WithArguments("Program.M(in int)", "x").WithLocation(7, 20)
);
}
[Fact]
public void RefReturnThrow()
{
var text = @"
class Program
{
static ref readonly int M1() => throw null;
static ref int M2() => throw null;
}
";
var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular);
comp.VerifyIL("Program.M1()", @"
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldnull
IL_0001: throw
}");
comp.VerifyIL("Program.M2()", @"
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldnull
IL_0001: throw
}");
}
[Fact]
public void RefExtensionMethod_PassThrough_LocalNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref int M(ref this int p) => ref p;
}
class Test
{
void M()
{
int x = 5;
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
.locals init (int V_0) //x
IL_0000: ldc.i4.5
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""ref int Ext.M(ref int)""
IL_0009: pop
IL_000a: ret
}");
}
[Fact]
public void RefExtensionMethod_PassThrough_FieldNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref int M(ref this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref int Ext.M(ref int)""
IL_000b: pop
IL_000c: ret
}");
}
[Fact]
public void RefExtensionMethod_PassThrough_ChainNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref int M(ref this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M().M().M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 23 (0x17)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref int Ext.M(ref int)""
IL_000b: call ""ref int Ext.M(ref int)""
IL_0010: call ""ref int Ext.M(ref int)""
IL_0015: pop
IL_0016: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_TempCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
void M()
{
5.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
.locals init (int V_0)
IL_0000: ldc.i4.5
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""ref readonly int Ext.M(in int)""
IL_0009: pop
IL_000a: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_LocalNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
void M()
{
int x = 5;
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
.locals init (int V_0) //x
IL_0000: ldc.i4.5
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""ref readonly int Ext.M(in int)""
IL_0009: pop
IL_000a: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_FieldNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref readonly int Ext.M(in int)""
IL_000b: pop
IL_000c: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_ChainNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M().M().M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 23 (0x17)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref readonly int Ext.M(in int)""
IL_000b: call ""ref readonly int Ext.M(in int)""
IL_0010: call ""ref readonly int Ext.M(in int)""
IL_0015: pop
IL_0016: ret
}");
}
[Fact]
public void RefReadOnlyReturnOptionalValue()
{
CompileAndVerify(@"
class Program
{
static ref readonly string M(in string s = ""optional"") => ref s;
static void Main()
{
System.Console.Write(M());
System.Console.Write(""-"");
System.Console.Write(M(""provided""));
}
}", verify: Verification.Fails, expectedOutput: "optional-provided");
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
[CompilerTrait(CompilerFeature.ReadOnlyReferences)]
public class CodeGenRefReadOnlyReturnTests : CompilingTestBase
{
[Fact]
public void RefReadonlyLocalToField()
{
var source = @"
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
readonly struct S2
{
public readonly int X;
public S2(int x) => X = x;
public void AddOne() { }
}
class C
{
static S s1 = new S(0);
readonly static S s2 = new S(0);
static S2 s3 = new S2(0);
readonly S2 s4 = new S2(0);
ref readonly S M()
{
ref readonly S rs1 = ref s1;
rs1.AddOne();
ref readonly S rs2 = ref s2;
rs2.AddOne();
ref readonly S2 rs3 = ref s3;
rs3.AddOne();
ref readonly S2 rs4 = ref s4;
rs4.AddOne();
return ref rs1;
}
}";
// WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref assignments
var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: Verification.Fails);
comp.VerifyIL("C.M", @"
{
// Code size 59 (0x3b)
.maxstack 2
.locals init (S V_0)
IL_0000: ldsflda ""S C.s1""
IL_0005: dup
IL_0006: ldobj ""S""
IL_000b: stloc.0
IL_000c: ldloca.s V_0
IL_000e: call ""void S.AddOne()""
IL_0013: ldsflda ""S C.s2""
IL_0018: ldobj ""S""
IL_001d: stloc.0
IL_001e: ldloca.s V_0
IL_0020: call ""void S.AddOne()""
IL_0025: ldsflda ""S2 C.s3""
IL_002a: call ""void S2.AddOne()""
IL_002f: ldarg.0
IL_0030: ldflda ""S2 C.s4""
IL_0035: call ""void S2.AddOne()""
IL_003a: ret
}");
comp = CompileAndVerify(source, verify: Verification.Fails);
comp.VerifyIL("C.M", @"
{
// Code size 59 (0x3b)
.maxstack 2
.locals init (S V_0)
IL_0000: ldsflda ""S C.s1""
IL_0005: dup
IL_0006: ldobj ""S""
IL_000b: stloc.0
IL_000c: ldloca.s V_0
IL_000e: call ""void S.AddOne()""
IL_0013: ldsflda ""S C.s2""
IL_0018: ldobj ""S""
IL_001d: stloc.0
IL_001e: ldloca.s V_0
IL_0020: call ""void S.AddOne()""
IL_0025: ldsflda ""S2 C.s3""
IL_002a: call ""void S2.AddOne()""
IL_002f: ldarg.0
IL_0030: ldflda ""S2 C.s4""
IL_0035: call ""void S2.AddOne()""
IL_003a: ret
}");
}
[Fact]
public void CallsOnRefReadonlyCopyReceiver()
{
var comp = CompileAndVerify(@"
using System;
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
class C
{
public static void Main()
{
S s = new S(0);
ref readonly S rs = ref s;
Console.WriteLine(rs.X);
rs.AddOne();
Console.WriteLine(rs.X);
rs.AddOne();
rs.AddOne();
rs.AddOne();
}
}", expectedOutput: @"0
0");
comp.VerifyIL("C.Main", @"
{
// Code size 88 (0x58)
.maxstack 2
.locals init (S V_0, //s
S V_1)
IL_0000: ldloca.s V_0
IL_0002: ldc.i4.0
IL_0003: call ""S..ctor(int)""
IL_0008: ldloca.s V_0
IL_000a: dup
IL_000b: ldfld ""int S.X""
IL_0010: call ""void System.Console.WriteLine(int)""
IL_0015: dup
IL_0016: ldobj ""S""
IL_001b: stloc.1
IL_001c: ldloca.s V_1
IL_001e: call ""void S.AddOne()""
IL_0023: dup
IL_0024: ldfld ""int S.X""
IL_0029: call ""void System.Console.WriteLine(int)""
IL_002e: dup
IL_002f: ldobj ""S""
IL_0034: stloc.1
IL_0035: ldloca.s V_1
IL_0037: call ""void S.AddOne()""
IL_003c: dup
IL_003d: ldobj ""S""
IL_0042: stloc.1
IL_0043: ldloca.s V_1
IL_0045: call ""void S.AddOne()""
IL_004a: ldobj ""S""
IL_004f: stloc.1
IL_0050: ldloca.s V_1
IL_0052: call ""void S.AddOne()""
IL_0057: ret
}");
// This should generate similar IL to the previous
comp = CompileAndVerify(@"
using System;
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
class C
{
public static void Main()
{
S s = new S(0);
ref S sr = ref s;
var temp = sr;
temp.AddOne();
Console.WriteLine(temp.X);
temp = sr;
temp.AddOne();
Console.WriteLine(temp.X);
}
}", expectedOutput: @"1
1");
comp.VerifyIL("C.Main", @"
{
// Code size 60 (0x3c)
.maxstack 2
.locals init (S V_0, //s
S V_1) //temp
IL_0000: ldloca.s V_0
IL_0002: ldc.i4.0
IL_0003: call ""S..ctor(int)""
IL_0008: ldloca.s V_0
IL_000a: dup
IL_000b: ldobj ""S""
IL_0010: stloc.1
IL_0011: ldloca.s V_1
IL_0013: call ""void S.AddOne()""
IL_0018: ldloc.1
IL_0019: ldfld ""int S.X""
IL_001e: call ""void System.Console.WriteLine(int)""
IL_0023: ldobj ""S""
IL_0028: stloc.1
IL_0029: ldloca.s V_1
IL_002b: call ""void S.AddOne()""
IL_0030: ldloc.1
IL_0031: ldfld ""int S.X""
IL_0036: call ""void System.Console.WriteLine(int)""
IL_003b: ret
}");
}
[Fact]
public void RefReadOnlyParamCopyReceiver()
{
var comp = CompileAndVerify(@"
using System;
struct S
{
public int X;
public S(int x) => X = x;
public void AddOne() => this.X++;
}
class C
{
public static void Main()
{
M(new S(0));
}
static void M(in S rs)
{
Console.WriteLine(rs.X);
rs.AddOne();
Console.WriteLine(rs.X);
}
}", expectedOutput: @"0
0");
comp.VerifyIL(@"C.M", @"
{
// Code size 37 (0x25)
.maxstack 1
.locals init (S V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""int S.X""
IL_0006: call ""void System.Console.WriteLine(int)""
IL_000b: ldarg.0
IL_000c: ldobj ""S""
IL_0011: stloc.0
IL_0012: ldloca.s V_0
IL_0014: call ""void S.AddOne()""
IL_0019: ldarg.0
IL_001a: ldfld ""int S.X""
IL_001f: call ""void System.Console.WriteLine(int)""
IL_0024: ret
}");
}
[Fact]
public void CarryThroughLifetime()
{
var comp = CompileAndVerify(@"
class C
{
static ref readonly int M(ref int p)
{
ref readonly int rp = ref p;
return ref rp;
}
}", verify: Verification.Fails);
comp.VerifyIL("C.M", @"
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}");
}
[Fact]
public void TempForReadonly()
{
var comp = CompileAndVerify(@"
using System;
class C
{
public static void Main()
{
void L(in int p)
{
Console.WriteLine(p);
}
for (int i = 0; i < 3; i++)
{
L(10);
L(i);
}
}
}", expectedOutput: @"10
0
10
1
10
2");
comp.VerifyIL("C.Main()", @"
{
// Code size 30 (0x1e)
.maxstack 2
.locals init (int V_0, //i
int V_1)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: br.s IL_0019
IL_0004: ldc.i4.s 10
IL_0006: stloc.1
IL_0007: ldloca.s V_1
IL_0009: call ""void C.<Main>g__L|0_0(in int)""
IL_000e: ldloca.s V_0
IL_0010: call ""void C.<Main>g__L|0_0(in int)""
IL_0015: ldloc.0
IL_0016: ldc.i4.1
IL_0017: add
IL_0018: stloc.0
IL_0019: ldloc.0
IL_001a: ldc.i4.3
IL_001b: blt.s IL_0004
IL_001d: ret
}");
}
[Fact]
public void RefReturnAssign()
{
var verifier = CompileAndVerify(@"
class C
{
static void M()
{
ref readonly int x = ref Helper();
int y = x + 1;
}
static ref readonly int Helper()
=> ref (new int[1])[0];
}");
verifier.VerifyIL("C.M()", @"
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: call ""ref readonly int C.Helper()""
IL_0005: pop
IL_0006: ret
}");
}
[Fact]
public void RefReturnAssign2()
{
var verifier = CompileAndVerify(@"
class C
{
static void M()
{
ref readonly int x = ref Helper();
int y = x + 1;
}
static ref int Helper()
=> ref (new int[1])[0];
}");
verifier.VerifyIL("C.M()", @"
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: call ""ref int C.Helper()""
IL_0005: pop
IL_0006: ret
}");
}
[Fact]
public void RefReturnArrayAccess()
{
var text = @"
class Program
{
static ref readonly int M()
{
return ref (new int[1])[0];
}
}
";
var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular);
comp.VerifyIL("Program.M()", @"
{
// Code size 13 (0xd)
.maxstack 2
IL_0000: ldc.i4.1
IL_0001: newarr ""int""
IL_0006: ldc.i4.0
IL_0007: ldelema ""int""
IL_000c: ret
}");
}
[Fact]
public void BindingInvalidRefRoCombination()
{
var text = @"
class Program
{
// should be a syntax error
// just make sure binder is ok with this
static ref readonly ref int M(int x)
{
return ref M(x);
}
// should be a syntax error
// just make sure binder is ok with this
static readonly int M1(int x)
{
return ref M(x);
}
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS1031: Type expected
// static ref readonly ref int M(int x)
Diagnostic(ErrorCode.ERR_TypeExpected, "ref").WithLocation(6, 25),
// (13,25): error CS0106: The modifier 'readonly' is not valid for this item
// static readonly int M1(int x)
Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("readonly").WithLocation(13, 25),
// (15,20): error CS0120: An object reference is required for the non-static field, method, or property 'Program.M(int)'
// return ref M(x);
Diagnostic(ErrorCode.ERR_ObjectRequired, "M").WithArguments("Program.M(int)").WithLocation(15, 20),
// (15,9): error CS8149: By-reference returns may only be used in methods that return by reference
// return ref M(x);
Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(15, 9)
);
}
[Fact]
public void ReadonlyReturnCannotAssign()
{
var text = @"
class Program
{
static void Test()
{
M() = 1;
M1().Alice = 2;
M() ++;
M1().Alice --;
M() += 1;
M1().Alice -= 2;
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 9),
// (7,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(7, 9),
// (9,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(9, 9),
// (10,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(10, 9),
// (12,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 9),
// (13,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(13, 9)
);
}
[Fact]
public void ReadonlyReturnCannotAssign1()
{
var text = @"
class Program
{
static void Test()
{
P = 1;
P1.Alice = 2;
P ++;
P1.Alice --;
P += 1;
P1.Alice -= 2;
}
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
// P = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(6, 9),
// (7,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(7, 9),
// (9,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
// P ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(9, 9),
// (10,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(10, 9),
// (12,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
// P += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(12, 9),
// (13,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(13, 9)
);
}
[Fact]
public void ReadonlyReturnCannotAssignByref()
{
var text = @"
class Program
{
static void Test()
{
ref var y = ref M();
ref int a = ref M1.Alice;
ref var y1 = ref P;
ref int a1 = ref P1.Alice;
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8329: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
// ref var y = ref M();
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 25),
// (7,25): error CS0119: 'Program.M1()' is a method, which is not valid in the given context
// ref int a = ref M1.Alice;
Diagnostic(ErrorCode.ERR_BadSKunknown, "M1").WithArguments("Program.M1()", "method").WithLocation(7, 25),
// (8,26): error CS8329: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
// ref var y1 = ref P;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(8, 26),
// (9,26): error CS8330: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
// ref int a1 = ref P1.Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(9, 26)
);
}
[Fact]
public void ReadonlyReturnCannotTakePtr()
{
var text = @"
class Program
{
unsafe static void Test()
{
int* a = & M();
int* b = & M1().Alice;
int* a1 = & P;
int* b2 = & P1.Alice;
fixed(int* c = & M())
{
}
fixed(int* d = & M1().Alice)
{
}
fixed(int* c = & P)
{
}
fixed(int* d = & P1.Alice)
{
}
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (6,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* a = & M();
Diagnostic(ErrorCode.ERR_FixedNeeded, "& M()").WithLocation(6, 18),
// (7,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* b = & M1().Alice;
Diagnostic(ErrorCode.ERR_FixedNeeded, "& M1().Alice").WithLocation(7, 18),
// (9,19): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* a1 = & P;
Diagnostic(ErrorCode.ERR_FixedNeeded, "& P").WithLocation(9, 19),
// (10,19): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* b2 = & P1.Alice;
Diagnostic(ErrorCode.ERR_FixedNeeded, "& P1.Alice").WithLocation(10, 19)
);
}
[Fact]
public void ReadonlyReturnCannotReturnByOrdinaryRef()
{
var text = @"
class Program
{
static ref int Test()
{
bool b = true;
if (b)
{
if (b)
{
return ref M();
}
else
{
return ref M1().Alice;
}
}
else
{
if (b)
{
return ref P;
}
else
{
return ref P1.Alice;
}
}
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (12,28): error CS8333: Cannot return method 'Program.M()' by writable reference because it is a readonly variable
// return ref M();
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 28),
// (16,28): error CS8334: Members of method 'Program.M1()' cannot be returned by writable reference because it is a readonly variable
// return ref M1().Alice;
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(16, 28),
// (23,28): error CS8333: Cannot return property 'Program.P' by writable reference because it is a readonly variable
// return ref P;
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(23, 28),
// (27,28): error CS8334: Members of property 'Program.P1' cannot be returned by writable reference because it is a readonly variable
// return ref P1.Alice;
Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(27, 28)
);
}
[Fact]
public void ReadonlyReturnCanReturnByRefReadonly()
{
var text = @"
class Program
{
static ref readonly int Test()
{
bool b = true;
if (b)
{
if (b)
{
return ref M();
}
else
{
return ref M1().Alice;
}
}
else
{
if (b)
{
return ref P;
}
else
{
return ref P1.Alice;
}
}
}
static ref readonly int M() => throw null;
static ref readonly (int Alice, int Bob) M1() => throw null;
static ref readonly int P => throw null;
static ref readonly (int Alice, int Bob) P1 => throw null;
}
";
var comp = CompileAndVerifyWithMscorlib40(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular, verify: Verification.Passes);
comp.VerifyIL("Program.Test", @"
{
// Code size 45 (0x2d)
.maxstack 1
.locals init (bool V_0) //b
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: brfalse.s IL_0019
IL_0005: ldloc.0
IL_0006: brfalse.s IL_000e
IL_0008: call ""ref readonly int Program.M()""
IL_000d: ret
IL_000e: call ""ref readonly System.ValueTuple<int, int> Program.M1()""
IL_0013: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0018: ret
IL_0019: ldloc.0
IL_001a: brfalse.s IL_0022
IL_001c: call ""ref readonly int Program.P.get""
IL_0021: ret
IL_0022: call ""ref readonly System.ValueTuple<int, int> Program.P1.get""
IL_0027: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_002c: ret
}");
}
[Fact]
[CompilerTrait(CompilerFeature.PEVerifyCompat)]
public void ReadonlyFieldCanReturnByRefReadonly()
{
var text = @"
class Program
{
ref readonly int Test()
{
bool b = true;
if (b)
{
if (b)
{
return ref F;
}
else
{
return ref F1.Alice;
}
}
else
{
if (b)
{
return ref S1.F;
}
else
{
return ref S2.F1.Alice;
}
}
}
readonly int F = 1;
static readonly (int Alice, int Bob) F1 = (2,3);
readonly S S1 = new S();
static readonly S S2 = new S();
struct S
{
public readonly int F;
public readonly (int Alice, int Bob) F1;
}
}
";
var comp = CompileAndVerifyWithMscorlib40(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular, verify: Verification.Fails);
comp.VerifyIL("Program.Test", @"
{
// Code size 57 (0x39)
.maxstack 1
.locals init (bool V_0) //b
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: brfalse.s IL_001a
IL_0005: ldloc.0
IL_0006: brfalse.s IL_000f
IL_0008: ldarg.0
IL_0009: ldflda ""int Program.F""
IL_000e: ret
IL_000f: ldsflda ""System.ValueTuple<int, int> Program.F1""
IL_0014: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0019: ret
IL_001a: ldloc.0
IL_001b: brfalse.s IL_0029
IL_001d: ldarg.0
IL_001e: ldflda ""Program.S Program.S1""
IL_0023: ldflda ""int Program.S.F""
IL_0028: ret
IL_0029: ldsflda ""Program.S Program.S2""
IL_002e: ldflda ""System.ValueTuple<int, int> Program.S.F1""
IL_0033: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0038: ret
}");
// WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref returns
comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: Verification.Fails, targetFramework: TargetFramework.Mscorlib40);
comp.VerifyIL("Program.Test", @"
{
// Code size 57 (0x39)
.maxstack 1
.locals init (bool V_0) //b
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: brfalse.s IL_001a
IL_0005: ldloc.0
IL_0006: brfalse.s IL_000f
IL_0008: ldarg.0
IL_0009: ldflda ""int Program.F""
IL_000e: ret
IL_000f: ldsflda ""System.ValueTuple<int, int> Program.F1""
IL_0014: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0019: ret
IL_001a: ldloc.0
IL_001b: brfalse.s IL_0029
IL_001d: ldarg.0
IL_001e: ldflda ""Program.S Program.S1""
IL_0023: ldflda ""int Program.S.F""
IL_0028: ret
IL_0029: ldsflda ""Program.S Program.S2""
IL_002e: ldflda ""System.ValueTuple<int, int> Program.S.F1""
IL_0033: ldflda ""int System.ValueTuple<int, int>.Item1""
IL_0038: ret
}");
}
[Fact]
public void ReadonlyReturnByRefReadonlyLocalSafety()
{
var text = @"
class Program
{
ref readonly int Test()
{
bool b = true;
int local = 42;
if (b)
{
return ref M(ref local);
}
else
{
return ref M1(out local).Alice;
}
}
static ref readonly int M(ref int x) => throw null;
static ref readonly (int Alice, int Bob) M1(out int x) => throw null;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (11,30): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref M(ref local);
Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(11, 30),
// (11,24): error CS8347: Cannot use a result of 'Program.M(ref int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M(ref local);
Diagnostic(ErrorCode.ERR_EscapeCall, "M(ref local)").WithArguments("Program.M(ref int)", "x").WithLocation(11, 24),
// (15,31): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref M1(out local).Alice;
Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(15, 31),
// (15,24): error CS8348: Cannot use a member of result of 'Program.M1(out int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M1(out local).Alice;
Diagnostic(ErrorCode.ERR_EscapeCall2, "M1(out local)").WithArguments("Program.M1(out int)", "x").WithLocation(15, 24)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyLocalSafety1()
{
var text = @"
class Program
{
ref readonly int Test()
{
int local = 42;
return ref this[local];
}
ref readonly int this[in int x] => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (8,25): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref this[local];
Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(8, 25),
// (8,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref this[local];
Diagnostic(ErrorCode.ERR_EscapeCall, "this[local]").WithArguments("Program.this[in int]", "x").WithLocation(8, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyLiteralSafety1()
{
var text = @"
class Program
{
ref readonly int Test()
{
return ref this[42];
}
ref readonly int this[in int x] => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref this[42];
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 25),
// (6,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref this[42];
Diagnostic(ErrorCode.ERR_EscapeCall, "this[42]").WithArguments("Program.this[in int]", "x").WithLocation(6, 20)
);
}
[WorkItem(19930, "https://github.com/dotnet/roslyn/issues/19930")]
[Fact]
public void ReadonlyReturnByRefInStruct()
{
var text = @"
struct S1
{
readonly int x;
ref readonly S1 Test()
{
return ref this;
}
ref readonly int this[in int i] => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (8,20): error CS8170: Struct members cannot return 'this' or other instance members by reference
// return ref this;
Diagnostic(ErrorCode.ERR_RefReturnStructThis, "this").WithArguments("this").WithLocation(8, 20),
// (11,44): error CS8170: Struct members cannot return 'this' or other instance members by reference
// in int this[in int i] => ref x;
Diagnostic(ErrorCode.ERR_RefReturnStructThis, "x").WithArguments("this").WithLocation(11, 44)
);
}
[WorkItem(19930, "https://github.com/dotnet/roslyn/issues/19930")]
[Fact]
public void ReadonlyReturnByRefRValue()
{
var text = @"
struct S1
{
ref readonly int Test()
{
return ref 42;
}
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,20): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref 42;
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyLiteralSafety2()
{
var text = @"
class Program
{
ref readonly int Test()
{
return ref M(42);
}
ref readonly int M(in int x) => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref M(42);
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 22),
// (6,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M(42);
Diagnostic(ErrorCode.ERR_EscapeCall, "M(42)").WithArguments("Program.M(in int)", "x").WithLocation(6, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyOptSafety()
{
var text = @"
class Program
{
ref readonly int Test()
{
return ref M();
}
ref readonly int M(in int x = 42) => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,20): error CS8156: An expression cannot be used in this context because it may not be passed or returned by reference
// return ref M();
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "M()").WithLocation(6, 20),
// (6,20): error CS8347: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M();
Diagnostic(ErrorCode.ERR_EscapeCall, "M()").WithArguments("Program.M(in int)", "x").WithLocation(6, 20)
);
}
[Fact]
public void ReadonlyReturnByRefReadonlyConvSafety()
{
var text = @"
class Program
{
ref readonly int Test()
{
byte b = 42;
return ref M(b);
}
ref readonly int M(in int x) => ref x;
}
";
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (7,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref M(b);
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "b").WithLocation(7, 22),
// (7,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// return ref M(b);
Diagnostic(ErrorCode.ERR_EscapeCall, "M(b)").WithArguments("Program.M(in int)", "x").WithLocation(7, 20)
);
}
[Fact]
public void RefReturnThrow()
{
var text = @"
class Program
{
static ref readonly int M1() => throw null;
static ref int M2() => throw null;
}
";
var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular);
comp.VerifyIL("Program.M1()", @"
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldnull
IL_0001: throw
}");
comp.VerifyIL("Program.M2()", @"
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldnull
IL_0001: throw
}");
}
[Fact]
public void RefExtensionMethod_PassThrough_LocalNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref int M(ref this int p) => ref p;
}
class Test
{
void M()
{
int x = 5;
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
.locals init (int V_0) //x
IL_0000: ldc.i4.5
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""ref int Ext.M(ref int)""
IL_0009: pop
IL_000a: ret
}");
}
[Fact]
public void RefExtensionMethod_PassThrough_FieldNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref int M(ref this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref int Ext.M(ref int)""
IL_000b: pop
IL_000c: ret
}");
}
[Fact]
public void RefExtensionMethod_PassThrough_ChainNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref int M(ref this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M().M().M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 23 (0x17)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref int Ext.M(ref int)""
IL_000b: call ""ref int Ext.M(ref int)""
IL_0010: call ""ref int Ext.M(ref int)""
IL_0015: pop
IL_0016: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_TempCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
void M()
{
5.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
.locals init (int V_0)
IL_0000: ldc.i4.5
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""ref readonly int Ext.M(in int)""
IL_0009: pop
IL_000a: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_LocalNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
void M()
{
int x = 5;
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
.locals init (int V_0) //x
IL_0000: ldc.i4.5
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call ""ref readonly int Ext.M(in int)""
IL_0009: pop
IL_000a: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_FieldNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 13 (0xd)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref readonly int Ext.M(in int)""
IL_000b: pop
IL_000c: ret
}");
}
[Fact]
public void RefReadOnlyExtensionMethod_PassThrough_ChainNoCopying()
{
CompileAndVerify(@"
public static class Ext
{
public static ref readonly int M(in this int p) => ref p;
}
class Test
{
private int x = 5;
void M()
{
x.M().M().M();
}
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 23 (0x17)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldflda ""int Test.x""
IL_0006: call ""ref readonly int Ext.M(in int)""
IL_000b: call ""ref readonly int Ext.M(in int)""
IL_0010: call ""ref readonly int Ext.M(in int)""
IL_0015: pop
IL_0016: ret
}");
}
[Fact]
public void RefReadOnlyReturnOptionalValue()
{
CompileAndVerify(@"
class Program
{
static ref readonly string M(in string s = ""optional"") => ref s;
static void Main()
{
System.Console.Write(M());
System.Console.Write(""-"");
System.Console.Write(M(""provided""));
}
}", verify: Verification.Fails, expectedOutput: "optional-provided");
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/CSharp/Portable/Symbols/EmbeddableAttributes.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
namespace Microsoft.CodeAnalysis.CSharp
{
[Flags]
internal enum EmbeddableAttributes
{
IsReadOnlyAttribute = 0x01,
IsByRefLikeAttribute = 0x02,
IsUnmanagedAttribute = 0x04,
NullableAttribute = 0x08,
NullableContextAttribute = 0x10,
NullablePublicOnlyAttribute = 0x20,
NativeIntegerAttribute = 0x40,
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
namespace Microsoft.CodeAnalysis.CSharp
{
[Flags]
internal enum EmbeddableAttributes
{
IsReadOnlyAttribute = 0x01,
IsByRefLikeAttribute = 0x02,
IsUnmanagedAttribute = 0x04,
NullableAttribute = 0x08,
NullableContextAttribute = 0x10,
NullablePublicOnlyAttribute = 0x20,
NativeIntegerAttribute = 0x40,
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/Core/Portable/MoveToNamespace/MoveToNamespaceResult.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.MoveToNamespace
{
internal class MoveToNamespaceResult
{
public static readonly MoveToNamespaceResult Failed = new();
public bool Succeeded { get; }
public Solution UpdatedSolution { get; }
public Solution OriginalSolution { get; }
public DocumentId UpdatedDocumentId { get; }
public ImmutableDictionary<string, ISymbol> NewNameOriginalSymbolMapping { get; }
public string NewName { get; }
public MoveToNamespaceResult(
Solution originalSolution,
Solution updatedSolution,
DocumentId updatedDocumentId,
ImmutableDictionary<string, ISymbol> newNameOriginalSymbolMapping)
{
OriginalSolution = originalSolution;
UpdatedSolution = updatedSolution;
UpdatedDocumentId = updatedDocumentId;
NewNameOriginalSymbolMapping = newNameOriginalSymbolMapping;
Succeeded = true;
}
private MoveToNamespaceResult()
=> Succeeded = false;
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.MoveToNamespace
{
internal class MoveToNamespaceResult
{
public static readonly MoveToNamespaceResult Failed = new();
public bool Succeeded { get; }
public Solution UpdatedSolution { get; }
public Solution OriginalSolution { get; }
public DocumentId UpdatedDocumentId { get; }
public ImmutableDictionary<string, ISymbol> NewNameOriginalSymbolMapping { get; }
public string NewName { get; }
public MoveToNamespaceResult(
Solution originalSolution,
Solution updatedSolution,
DocumentId updatedDocumentId,
ImmutableDictionary<string, ISymbol> newNameOriginalSymbolMapping)
{
OriginalSolution = originalSolution;
UpdatedSolution = updatedSolution;
UpdatedDocumentId = updatedDocumentId;
NewNameOriginalSymbolMapping = newNameOriginalSymbolMapping;
Succeeded = true;
}
private MoveToNamespaceResult()
=> Succeeded = false;
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Analyzers/CSharp/Analyzers/UseExpressionBody/Helpers/UseExpressionBodyForMethodsHelper.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.UseExpressionBody
{
internal class UseExpressionBodyForMethodsHelper :
UseExpressionBodyHelper<MethodDeclarationSyntax>
{
public static readonly UseExpressionBodyForMethodsHelper Instance = new();
private UseExpressionBodyForMethodsHelper()
: base(IDEDiagnosticIds.UseExpressionBodyForMethodsDiagnosticId,
EnforceOnBuildValues.UseExpressionBodyForMethods,
new LocalizableResourceString(nameof(CSharpAnalyzersResources.Use_expression_body_for_methods), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)),
new LocalizableResourceString(nameof(CSharpAnalyzersResources.Use_block_body_for_methods), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)),
CSharpCodeStyleOptions.PreferExpressionBodiedMethods,
ImmutableArray.Create(SyntaxKind.MethodDeclaration))
{
}
protected override BlockSyntax GetBody(MethodDeclarationSyntax declaration)
=> declaration.Body;
protected override ArrowExpressionClauseSyntax GetExpressionBody(MethodDeclarationSyntax declaration)
=> declaration.ExpressionBody;
protected override SyntaxToken GetSemicolonToken(MethodDeclarationSyntax declaration)
=> declaration.SemicolonToken;
protected override MethodDeclarationSyntax WithSemicolonToken(MethodDeclarationSyntax declaration, SyntaxToken token)
=> declaration.WithSemicolonToken(token);
protected override MethodDeclarationSyntax WithExpressionBody(MethodDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody)
=> declaration.WithExpressionBody(expressionBody);
protected override MethodDeclarationSyntax WithBody(MethodDeclarationSyntax declaration, BlockSyntax body)
=> declaration.WithBody(body);
protected override bool CreateReturnStatementForExpression(
SemanticModel semanticModel, MethodDeclarationSyntax declaration)
{
if (declaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
{
// if it's 'async TaskLike' (where TaskLike is non-generic) we do *not* want to
// create a return statement. This is just the 'async' version of a 'void' method.
var method = semanticModel.GetDeclaredSymbol(declaration);
return method.ReturnType is INamedTypeSymbol namedType && namedType.Arity != 0;
}
return !declaration.ReturnType.IsVoid();
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.UseExpressionBody
{
internal class UseExpressionBodyForMethodsHelper :
UseExpressionBodyHelper<MethodDeclarationSyntax>
{
public static readonly UseExpressionBodyForMethodsHelper Instance = new();
private UseExpressionBodyForMethodsHelper()
: base(IDEDiagnosticIds.UseExpressionBodyForMethodsDiagnosticId,
EnforceOnBuildValues.UseExpressionBodyForMethods,
new LocalizableResourceString(nameof(CSharpAnalyzersResources.Use_expression_body_for_methods), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)),
new LocalizableResourceString(nameof(CSharpAnalyzersResources.Use_block_body_for_methods), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)),
CSharpCodeStyleOptions.PreferExpressionBodiedMethods,
ImmutableArray.Create(SyntaxKind.MethodDeclaration))
{
}
protected override BlockSyntax GetBody(MethodDeclarationSyntax declaration)
=> declaration.Body;
protected override ArrowExpressionClauseSyntax GetExpressionBody(MethodDeclarationSyntax declaration)
=> declaration.ExpressionBody;
protected override SyntaxToken GetSemicolonToken(MethodDeclarationSyntax declaration)
=> declaration.SemicolonToken;
protected override MethodDeclarationSyntax WithSemicolonToken(MethodDeclarationSyntax declaration, SyntaxToken token)
=> declaration.WithSemicolonToken(token);
protected override MethodDeclarationSyntax WithExpressionBody(MethodDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody)
=> declaration.WithExpressionBody(expressionBody);
protected override MethodDeclarationSyntax WithBody(MethodDeclarationSyntax declaration, BlockSyntax body)
=> declaration.WithBody(body);
protected override bool CreateReturnStatementForExpression(
SemanticModel semanticModel, MethodDeclarationSyntax declaration)
{
if (declaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
{
// if it's 'async TaskLike' (where TaskLike is non-generic) we do *not* want to
// create a return statement. This is just the 'async' version of a 'void' method.
var method = semanticModel.GetDeclaredSymbol(declaration);
return method.ReturnType is INamedTypeSymbol namedType && namedType.Arity != 0;
}
return !declaration.ReturnType.IsVoid();
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/CSharp/Portable/Symbols/AnonymousTypes/AnonymousTypeField.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Describes anonymous type field in terms of its name, type and other attributes
/// </summary>
internal struct AnonymousTypeField
{
/// <summary>Anonymous type field name, not nothing and not empty</summary>
public readonly string Name;
/// <summary>Anonymous type field location</summary>
public readonly Location Location;
/// <summary>Anonymous type field type with annotations</summary>
public readonly TypeWithAnnotations TypeWithAnnotations;
/// <summary>Anonymous type field type</summary>
public TypeSymbol Type => TypeWithAnnotations.Type;
public AnonymousTypeField(string name, Location location, TypeWithAnnotations typeWithAnnotations)
{
this.Name = name;
this.Location = location;
this.TypeWithAnnotations = typeWithAnnotations;
}
[Conditional("DEBUG")]
internal void AssertIsGood()
{
Debug.Assert(this.Name != null && this.Location != null && this.TypeWithAnnotations.HasType);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Describes anonymous type field in terms of its name, type and other attributes
/// </summary>
internal struct AnonymousTypeField
{
/// <summary>Anonymous type field name, not nothing and not empty</summary>
public readonly string Name;
/// <summary>Anonymous type field location</summary>
public readonly Location Location;
/// <summary>Anonymous type field type with annotations</summary>
public readonly TypeWithAnnotations TypeWithAnnotations;
/// <summary>Anonymous type field type</summary>
public TypeSymbol Type => TypeWithAnnotations.Type;
public AnonymousTypeField(string name, Location location, TypeWithAnnotations typeWithAnnotations)
{
this.Name = name;
this.Location = location;
this.TypeWithAnnotations = typeWithAnnotations;
}
[Conditional("DEBUG")]
internal void AssertIsGood()
{
Debug.Assert(this.Name != null && this.Location != null && this.TypeWithAnnotations.HasType);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/ICodeRefactoringSuggestedAction.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.CodeRefactorings;
namespace Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
{
/// <summary>
/// Common interface used by both local Roslyn and LSP to implement
/// their specific versions of CodeRefactoringSuggestedAction.
/// </summary>
internal interface ICodeRefactoringSuggestedAction
{
CodeRefactoringProvider CodeRefactoringProvider { get; }
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.CodeRefactorings;
namespace Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions
{
/// <summary>
/// Common interface used by both local Roslyn and LSP to implement
/// their specific versions of CodeRefactoringSuggestedAction.
/// </summary>
internal interface ICodeRefactoringSuggestedAction
{
CodeRefactoringProvider CodeRefactoringProvider { get; }
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/Core/Portable/Shared/Utilities/ExtensionOrderer.Graph.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Shared.Utilities
{
internal partial class ExtensionOrderer
{
private class Graph<TExtension, TMetadata>
where TMetadata : OrderableMetadata
{
public readonly Dictionary<Lazy<TExtension, TMetadata>, Node<TExtension, TMetadata>> Nodes =
new();
public IEnumerable<Lazy<TExtension, TMetadata>> FindExtensions(string name)
{
Contract.ThrowIfNull(name);
return this.Nodes.Keys.Where(k => k.Metadata.Name == name);
}
public void CheckForCycles()
{
foreach (var node in this.Nodes.Values)
{
node.CheckForCycles();
}
}
public IList<Lazy<TExtension, TMetadata>> TopologicalSort()
{
var result = new List<Lazy<TExtension, TMetadata>>();
var seenNodes = new HashSet<Node<TExtension, TMetadata>>();
foreach (var node in this.Nodes.Values)
{
Visit(node, result, seenNodes);
}
return result;
}
private static void Visit(
Node<TExtension, TMetadata> node,
List<Lazy<TExtension, TMetadata>> result,
HashSet<Node<TExtension, TMetadata>> seenNodes)
{
if (seenNodes.Add(node))
{
foreach (var before in node.ExtensionsBeforeMeSet)
{
Visit(before, result, seenNodes);
}
result.Add(node.Extension);
}
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Shared.Utilities
{
internal partial class ExtensionOrderer
{
private class Graph<TExtension, TMetadata>
where TMetadata : OrderableMetadata
{
public readonly Dictionary<Lazy<TExtension, TMetadata>, Node<TExtension, TMetadata>> Nodes =
new();
public IEnumerable<Lazy<TExtension, TMetadata>> FindExtensions(string name)
{
Contract.ThrowIfNull(name);
return this.Nodes.Keys.Where(k => k.Metadata.Name == name);
}
public void CheckForCycles()
{
foreach (var node in this.Nodes.Values)
{
node.CheckForCycles();
}
}
public IList<Lazy<TExtension, TMetadata>> TopologicalSort()
{
var result = new List<Lazy<TExtension, TMetadata>>();
var seenNodes = new HashSet<Node<TExtension, TMetadata>>();
foreach (var node in this.Nodes.Values)
{
Visit(node, result, seenNodes);
}
return result;
}
private static void Visit(
Node<TExtension, TMetadata> node,
List<Lazy<TExtension, TMetadata>> result,
HashSet<Node<TExtension, TMetadata>> seenNodes)
{
if (seenNodes.Add(node))
{
foreach (var before in node.ExtensionsBeforeMeSet)
{
Visit(before, result, seenNodes);
}
result.Add(node.Extension);
}
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Core/Portable/InternalUtilities/SharedStopwatch.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics;
namespace Roslyn.Utilities
{
internal readonly struct SharedStopwatch
{
private static readonly Stopwatch s_stopwatch = Stopwatch.StartNew();
private readonly TimeSpan _started;
private SharedStopwatch(TimeSpan started)
{
_started = started;
}
public TimeSpan Elapsed => s_stopwatch.Elapsed - _started;
public static SharedStopwatch StartNew()
=> new SharedStopwatch(s_stopwatch.Elapsed);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics;
namespace Roslyn.Utilities
{
internal readonly struct SharedStopwatch
{
private static readonly Stopwatch s_stopwatch = Stopwatch.StartNew();
private readonly TimeSpan _started;
private SharedStopwatch(TimeSpan started)
{
_started = started;
}
public TimeSpan Elapsed => s_stopwatch.Elapsed - _started;
public static SharedStopwatch StartNew()
=> new SharedStopwatch(s_stopwatch.Elapsed);
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/Remote/ServiceHub/Services/Renamer/RemoteRenamerService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Rename;
using Microsoft.CodeAnalysis.Rename.ConflictEngine;
namespace Microsoft.CodeAnalysis.Remote
{
internal sealed class RemoteRenamerService : BrokeredServiceBase, IRemoteRenamerService
{
internal sealed class Factory : FactoryBase<IRemoteRenamerService>
{
protected override IRemoteRenamerService CreateService(in ServiceConstructionArguments arguments)
=> new RemoteRenamerService(arguments);
}
public RemoteRenamerService(in ServiceConstructionArguments arguments)
: base(arguments)
{
}
public ValueTask<SerializableConflictResolution?> RenameSymbolAsync(
PinnedSolutionInfo solutionInfo,
SerializableSymbolAndProjectId symbolAndProjectId,
string newName,
SerializableRenameOptionSet options,
ImmutableArray<SerializableSymbolAndProjectId> nonConflictSymbolIds,
CancellationToken cancellationToken)
{
return RunServiceAsync(async cancellationToken =>
{
var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);
var symbol = await symbolAndProjectId.TryRehydrateAsync(
solution, cancellationToken).ConfigureAwait(false);
if (symbol == null)
return null;
var nonConflictSymbols = await GetNonConflictSymbolsAsync(solution, nonConflictSymbolIds, cancellationToken).ConfigureAwait(false);
var result = await Renamer.RenameSymbolAsync(
solution, symbol, newName, options.Rehydrate(),
nonConflictSymbols, cancellationToken).ConfigureAwait(false);
return await result.DehydrateAsync(cancellationToken).ConfigureAwait(false);
}, cancellationToken);
}
public ValueTask<SerializableRenameLocations?> FindRenameLocationsAsync(
PinnedSolutionInfo solutionInfo,
SerializableSymbolAndProjectId symbolAndProjectId,
SerializableRenameOptionSet options,
CancellationToken cancellationToken)
{
return RunServiceAsync(async cancellationToken =>
{
var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);
var symbol = await symbolAndProjectId.TryRehydrateAsync(
solution, cancellationToken).ConfigureAwait(false);
if (symbol == null)
return null;
var result = await RenameLocations.FindLocationsAsync(
symbol, solution, options.Rehydrate(), cancellationToken).ConfigureAwait(false);
return result.Dehydrate(solution, cancellationToken);
}, cancellationToken);
}
public ValueTask<SerializableConflictResolution?> ResolveConflictsAsync(
PinnedSolutionInfo solutionInfo,
SerializableRenameLocations renameLocationSet,
string replacementText,
ImmutableArray<SerializableSymbolAndProjectId> nonConflictSymbolIds,
CancellationToken cancellationToken)
{
return RunServiceAsync(async cancellationToken =>
{
var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);
var nonConflictSymbols = await GetNonConflictSymbolsAsync(solution, nonConflictSymbolIds, cancellationToken).ConfigureAwait(false);
var rehydratedSet = await RenameLocations.TryRehydrateAsync(solution, renameLocationSet, cancellationToken).ConfigureAwait(false);
if (rehydratedSet == null)
return null;
var result = await ConflictResolver.ResolveConflictsAsync(
rehydratedSet,
replacementText,
nonConflictSymbols,
cancellationToken).ConfigureAwait(false);
return await result.DehydrateAsync(cancellationToken).ConfigureAwait(false);
}, cancellationToken);
}
private static async Task<ImmutableHashSet<ISymbol>?> GetNonConflictSymbolsAsync(Solution solution, ImmutableArray<SerializableSymbolAndProjectId> nonConflictSymbolIds, CancellationToken cancellationToken)
{
if (nonConflictSymbolIds.IsDefault)
{
return null;
}
var builder = ImmutableHashSet.CreateBuilder<ISymbol>();
foreach (var id in nonConflictSymbolIds)
{
var symbol = await id.TryRehydrateAsync(solution, cancellationToken).ConfigureAwait(false);
if (symbol != null)
builder.Add(symbol);
}
return builder.ToImmutable();
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Rename;
using Microsoft.CodeAnalysis.Rename.ConflictEngine;
namespace Microsoft.CodeAnalysis.Remote
{
internal sealed class RemoteRenamerService : BrokeredServiceBase, IRemoteRenamerService
{
internal sealed class Factory : FactoryBase<IRemoteRenamerService>
{
protected override IRemoteRenamerService CreateService(in ServiceConstructionArguments arguments)
=> new RemoteRenamerService(arguments);
}
public RemoteRenamerService(in ServiceConstructionArguments arguments)
: base(arguments)
{
}
public ValueTask<SerializableConflictResolution?> RenameSymbolAsync(
PinnedSolutionInfo solutionInfo,
SerializableSymbolAndProjectId symbolAndProjectId,
string newName,
SerializableRenameOptionSet options,
ImmutableArray<SerializableSymbolAndProjectId> nonConflictSymbolIds,
CancellationToken cancellationToken)
{
return RunServiceAsync(async cancellationToken =>
{
var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);
var symbol = await symbolAndProjectId.TryRehydrateAsync(
solution, cancellationToken).ConfigureAwait(false);
if (symbol == null)
return null;
var nonConflictSymbols = await GetNonConflictSymbolsAsync(solution, nonConflictSymbolIds, cancellationToken).ConfigureAwait(false);
var result = await Renamer.RenameSymbolAsync(
solution, symbol, newName, options.Rehydrate(),
nonConflictSymbols, cancellationToken).ConfigureAwait(false);
return await result.DehydrateAsync(cancellationToken).ConfigureAwait(false);
}, cancellationToken);
}
public ValueTask<SerializableRenameLocations?> FindRenameLocationsAsync(
PinnedSolutionInfo solutionInfo,
SerializableSymbolAndProjectId symbolAndProjectId,
SerializableRenameOptionSet options,
CancellationToken cancellationToken)
{
return RunServiceAsync(async cancellationToken =>
{
var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);
var symbol = await symbolAndProjectId.TryRehydrateAsync(
solution, cancellationToken).ConfigureAwait(false);
if (symbol == null)
return null;
var result = await RenameLocations.FindLocationsAsync(
symbol, solution, options.Rehydrate(), cancellationToken).ConfigureAwait(false);
return result.Dehydrate(solution, cancellationToken);
}, cancellationToken);
}
public ValueTask<SerializableConflictResolution?> ResolveConflictsAsync(
PinnedSolutionInfo solutionInfo,
SerializableRenameLocations renameLocationSet,
string replacementText,
ImmutableArray<SerializableSymbolAndProjectId> nonConflictSymbolIds,
CancellationToken cancellationToken)
{
return RunServiceAsync(async cancellationToken =>
{
var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);
var nonConflictSymbols = await GetNonConflictSymbolsAsync(solution, nonConflictSymbolIds, cancellationToken).ConfigureAwait(false);
var rehydratedSet = await RenameLocations.TryRehydrateAsync(solution, renameLocationSet, cancellationToken).ConfigureAwait(false);
if (rehydratedSet == null)
return null;
var result = await ConflictResolver.ResolveConflictsAsync(
rehydratedSet,
replacementText,
nonConflictSymbols,
cancellationToken).ConfigureAwait(false);
return await result.DehydrateAsync(cancellationToken).ConfigureAwait(false);
}, cancellationToken);
}
private static async Task<ImmutableHashSet<ISymbol>?> GetNonConflictSymbolsAsync(Solution solution, ImmutableArray<SerializableSymbolAndProjectId> nonConflictSymbolIds, CancellationToken cancellationToken)
{
if (nonConflictSymbolIds.IsDefault)
{
return null;
}
var builder = ImmutableHashSet.CreateBuilder<ISymbol>();
foreach (var id in nonConflictSymbolIds)
{
var symbol = await id.TryRehydrateAsync(solution, cancellationToken).ConfigureAwait(false);
if (symbol != null)
builder.Add(symbol);
}
return builder.ToImmutable();
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/Remote/Core/ExternalAccess/UnitTesting/Api/UnitTestingPinnedSolutionInfoWrapper.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
[DataContract]
internal readonly struct UnitTestingPinnedSolutionInfoWrapper
{
[DataMember(Order = 0)]
internal readonly PinnedSolutionInfo UnderlyingObject;
public UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo underlyingObject)
=> UnderlyingObject = underlyingObject;
public static implicit operator UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo info)
=> new(info);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
[DataContract]
internal readonly struct UnitTestingPinnedSolutionInfoWrapper
{
[DataMember(Order = 0)]
internal readonly PinnedSolutionInfo UnderlyingObject;
public UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo underlyingObject)
=> UnderlyingObject = underlyingObject;
public static implicit operator UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo info)
=> new(info);
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/CSharp/Portable/Completion/KeywordRecommenders/TypeKeywordRecommender.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;
namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders
{
internal class TypeKeywordRecommender : AbstractSyntacticSingleKeywordRecommender
{
public TypeKeywordRecommender()
: base(SyntaxKind.TypeKeyword)
{
}
protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)
=> context.IsTypeAttributeContext(cancellationToken);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;
namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders
{
internal class TypeKeywordRecommender : AbstractSyntacticSingleKeywordRecommender
{
public TypeKeywordRecommender()
: base(SyntaxKind.TypeKeyword)
{
}
protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)
=> context.IsTypeAttributeContext(cancellationToken);
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptFindUsagesService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api
{
internal interface IVSTypeScriptFindUsagesService : ILanguageService
{
/// <summary>
/// Finds the references for the symbol at the specific position in the document,
/// pushing the results into the context instance.
/// </summary>
Task FindReferencesAsync(Document document, int position, IVSTypeScriptFindUsagesContext context, CancellationToken cancellationToken);
/// <summary>
/// Finds the implementations for the symbol at the specific position in the document,
/// pushing the results into the context instance.
/// </summary>
Task FindImplementationsAsync(Document document, int position, IVSTypeScriptFindUsagesContext context, CancellationToken cancellationToken);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api
{
internal interface IVSTypeScriptFindUsagesService : ILanguageService
{
/// <summary>
/// Finds the references for the symbol at the specific position in the document,
/// pushing the results into the context instance.
/// </summary>
Task FindReferencesAsync(Document document, int position, IVSTypeScriptFindUsagesContext context, CancellationToken cancellationToken);
/// <summary>
/// Finds the implementations for the symbol at the specific position in the document,
/// pushing the results into the context instance.
/// </summary>
Task FindImplementationsAsync(Document document, int position, IVSTypeScriptFindUsagesContext context, CancellationToken cancellationToken);
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Engine/Trivia/CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Formatting;
namespace Microsoft.CodeAnalysis.CSharp.Formatting
{
internal partial class CSharpTriviaFormatter
{
private class DocumentationCommentExteriorCommentRewriter : CSharpSyntaxRewriter
{
private readonly bool _forceIndentation;
private readonly int _indentation;
private readonly int _indentationDelta;
private readonly AnalyzerConfigOptions _options;
public DocumentationCommentExteriorCommentRewriter(
bool forceIndentation,
int indentation,
int indentationDelta,
AnalyzerConfigOptions options,
bool visitStructuredTrivia = true)
: base(visitIntoStructuredTrivia: visitStructuredTrivia)
{
_forceIndentation = forceIndentation;
_indentation = indentation;
_indentationDelta = indentationDelta;
_options = options;
}
public override SyntaxTrivia VisitTrivia(SyntaxTrivia trivia)
{
if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
{
if (IsBeginningOrEndOfDocumentComment(trivia))
{
return base.VisitTrivia(trivia);
}
else
{
var triviaText = trivia.ToFullString();
var newTriviaText = triviaText.AdjustIndentForXmlDocExteriorTrivia(
_forceIndentation,
_indentation,
_indentationDelta,
_options.GetOption(FormattingOptions2.UseTabs),
_options.GetOption(FormattingOptions2.TabSize));
if (triviaText == newTriviaText)
{
return base.VisitTrivia(trivia);
}
var parsedNewTrivia = SyntaxFactory.DocumentationCommentExterior(newTriviaText);
return parsedNewTrivia;
}
}
return base.VisitTrivia(trivia);
}
private static bool IsBeginningOrEndOfDocumentComment(SyntaxTrivia trivia)
{
var currentParent = trivia.Token.Parent;
while (currentParent != null)
{
if (currentParent.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia ||
currentParent.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia)
{
if (trivia.Span.End == currentParent.SpanStart ||
trivia.Span.End == currentParent.Span.End)
{
return true;
}
else
{
return false;
}
}
currentParent = currentParent.Parent;
}
return false;
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Formatting;
namespace Microsoft.CodeAnalysis.CSharp.Formatting
{
internal partial class CSharpTriviaFormatter
{
private class DocumentationCommentExteriorCommentRewriter : CSharpSyntaxRewriter
{
private readonly bool _forceIndentation;
private readonly int _indentation;
private readonly int _indentationDelta;
private readonly AnalyzerConfigOptions _options;
public DocumentationCommentExteriorCommentRewriter(
bool forceIndentation,
int indentation,
int indentationDelta,
AnalyzerConfigOptions options,
bool visitStructuredTrivia = true)
: base(visitIntoStructuredTrivia: visitStructuredTrivia)
{
_forceIndentation = forceIndentation;
_indentation = indentation;
_indentationDelta = indentationDelta;
_options = options;
}
public override SyntaxTrivia VisitTrivia(SyntaxTrivia trivia)
{
if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
{
if (IsBeginningOrEndOfDocumentComment(trivia))
{
return base.VisitTrivia(trivia);
}
else
{
var triviaText = trivia.ToFullString();
var newTriviaText = triviaText.AdjustIndentForXmlDocExteriorTrivia(
_forceIndentation,
_indentation,
_indentationDelta,
_options.GetOption(FormattingOptions2.UseTabs),
_options.GetOption(FormattingOptions2.TabSize));
if (triviaText == newTriviaText)
{
return base.VisitTrivia(trivia);
}
var parsedNewTrivia = SyntaxFactory.DocumentationCommentExterior(newTriviaText);
return parsedNewTrivia;
}
}
return base.VisitTrivia(trivia);
}
private static bool IsBeginningOrEndOfDocumentComment(SyntaxTrivia trivia)
{
var currentParent = trivia.Token.Parent;
while (currentParent != null)
{
if (currentParent.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia ||
currentParent.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia)
{
if (trivia.Span.End == currentParent.SpanStart ||
trivia.Span.End == currentParent.Span.End)
{
return true;
}
else
{
return false;
}
}
currentParent = currentParent.Parent;
}
return false;
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/VisualStudio/Core/Def/Implementation/ProjectSystem/MetadataReferences/FileWatchedPortableExecutableReferenceFactory.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.MetadataReferences
{
[Export]
internal sealed class FileWatchedPortableExecutableReferenceFactory
{
private readonly object _gate = new();
/// <summary>
/// This right now acquires the entire VisualStudioWorkspace because right now the production
/// of metadata references depends on other workspace services. See the comments on
/// <see cref="VisualStudioMetadataReferenceManagerFactory"/> that this strictly shouldn't be necessary
/// but for now is quite the tangle to fix.
/// </summary>
private readonly Lazy<VisualStudioWorkspace> _visualStudioWorkspace;
/// <summary>
/// A file change context used to watch metadata references.
/// </summary>
private readonly FileChangeWatcher.IContext _fileReferenceChangeContext;
/// <summary>
/// File watching tokens from <see cref="_fileReferenceChangeContext"/> that are watching metadata references. These are only created once we are actually applying a batch because
/// we don't determine until the batch is applied if the file reference will actually be a file reference or it'll be a converted project reference.
/// </summary>
private readonly Dictionary<PortableExecutableReference, FileChangeWatcher.IFileWatchingToken> _metadataReferenceFileWatchingTokens = new();
/// <summary>
/// <see cref="CancellationTokenSource"/>s for in-flight refreshing of metadata references. When we see a file change, we wait a bit before trying to actually
/// update the workspace. We need cancellation tokens for those so we can cancel them either when a flurry of events come in (so we only do the delay after the last
/// modification), or when we know the project is going away entirely.
/// </summary>
private readonly Dictionary<string, CancellationTokenSource> _metadataReferenceRefreshCancellationTokenSources = new();
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public FileWatchedPortableExecutableReferenceFactory(
Lazy<VisualStudioWorkspace> visualStudioWorkspace,
FileChangeWatcherProvider fileChangeWatcherProvider)
{
_visualStudioWorkspace = visualStudioWorkspace;
// We will do a single directory watch on the Reference Assemblies folder to avoid having to create separate file
// watches on individual .dlls that effectively never change.
var referenceAssembliesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Reference Assemblies", "Microsoft", "Framework");
var referenceAssemblies = new FileChangeWatcher.WatchedDirectory(referenceAssembliesPath, ".dll");
// TODO: set this to watch the NuGet directory as well; there's some concern that watching the entire directory
// might make restores take longer because we'll be watching changes that may not impact your project.
_fileReferenceChangeContext = fileChangeWatcherProvider.Watcher.CreateContext(referenceAssemblies);
_fileReferenceChangeContext.FileChanged += FileReferenceChangeContext_FileChanged;
}
public event EventHandler<string> ReferenceChanged;
public PortableExecutableReference CreateReferenceAndStartWatchingFile(string fullFilePath, MetadataReferenceProperties properties)
{
lock (_gate)
{
var reference = _visualStudioWorkspace.Value.CreatePortableExecutableReference(fullFilePath, properties);
var fileWatchingToken = _fileReferenceChangeContext.EnqueueWatchingFile(fullFilePath);
_metadataReferenceFileWatchingTokens.Add(reference, fileWatchingToken);
return reference;
}
}
public void StopWatchingReference(PortableExecutableReference reference)
{
lock (_gate)
{
if (!_metadataReferenceFileWatchingTokens.TryGetValue(reference, out var token))
{
throw new ArgumentException("The reference was already not being watched.");
}
_fileReferenceChangeContext.StopWatchingFile(token);
_metadataReferenceFileWatchingTokens.Remove(reference);
// Note we still potentially have an outstanding change that we haven't raised a notification
// for due to the delay we use. We could cancel the notification for that file path,
// but we may still have another outstanding PortableExecutableReference that isn't this one
// that does want that notification. We're OK just leaving the delay still running for two
// reasons:
//
// 1. Technically, we did see a file change before the call to StopWatchingReference, so
// arguably we should still raise it.
// 2. Since we raise the notification for a file path, it's up to the consumer of this to still
// track down which actual reference needs to be changed. That'll automatically handle any
// race where the event comes late, which is a scenario this must always deal with no matter
// what -- another thread might already be gearing up to notify the caller of this reference
// and we can't stop it.
}
}
private void FileReferenceChangeContext_FileChanged(object sender, string fullFilePath)
{
lock (_gate)
{
if (_metadataReferenceRefreshCancellationTokenSources.TryGetValue(fullFilePath, out var cancellationTokenSource))
{
cancellationTokenSource.Cancel();
_metadataReferenceRefreshCancellationTokenSources.Remove(fullFilePath);
}
cancellationTokenSource = new CancellationTokenSource();
_metadataReferenceRefreshCancellationTokenSources.Add(fullFilePath, cancellationTokenSource);
Task.Delay(TimeSpan.FromSeconds(5), cancellationTokenSource.Token).ContinueWith(_ =>
{
var needsNotification = false;
lock (_gate)
{
// We need to re-check the cancellation token source under the lock, since it might have been cancelled and restarted
// due to another event
cancellationTokenSource.Token.ThrowIfCancellationRequested();
needsNotification = true;
_metadataReferenceRefreshCancellationTokenSources.Remove(fullFilePath);
}
if (needsNotification)
{
ReferenceChanged?.Invoke(this, fullFilePath);
}
}, cancellationTokenSource.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default);
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.MetadataReferences
{
[Export]
internal sealed class FileWatchedPortableExecutableReferenceFactory
{
private readonly object _gate = new();
/// <summary>
/// This right now acquires the entire VisualStudioWorkspace because right now the production
/// of metadata references depends on other workspace services. See the comments on
/// <see cref="VisualStudioMetadataReferenceManagerFactory"/> that this strictly shouldn't be necessary
/// but for now is quite the tangle to fix.
/// </summary>
private readonly Lazy<VisualStudioWorkspace> _visualStudioWorkspace;
/// <summary>
/// A file change context used to watch metadata references.
/// </summary>
private readonly FileChangeWatcher.IContext _fileReferenceChangeContext;
/// <summary>
/// File watching tokens from <see cref="_fileReferenceChangeContext"/> that are watching metadata references. These are only created once we are actually applying a batch because
/// we don't determine until the batch is applied if the file reference will actually be a file reference or it'll be a converted project reference.
/// </summary>
private readonly Dictionary<PortableExecutableReference, FileChangeWatcher.IFileWatchingToken> _metadataReferenceFileWatchingTokens = new();
/// <summary>
/// <see cref="CancellationTokenSource"/>s for in-flight refreshing of metadata references. When we see a file change, we wait a bit before trying to actually
/// update the workspace. We need cancellation tokens for those so we can cancel them either when a flurry of events come in (so we only do the delay after the last
/// modification), or when we know the project is going away entirely.
/// </summary>
private readonly Dictionary<string, CancellationTokenSource> _metadataReferenceRefreshCancellationTokenSources = new();
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public FileWatchedPortableExecutableReferenceFactory(
Lazy<VisualStudioWorkspace> visualStudioWorkspace,
FileChangeWatcherProvider fileChangeWatcherProvider)
{
_visualStudioWorkspace = visualStudioWorkspace;
// We will do a single directory watch on the Reference Assemblies folder to avoid having to create separate file
// watches on individual .dlls that effectively never change.
var referenceAssembliesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Reference Assemblies", "Microsoft", "Framework");
var referenceAssemblies = new FileChangeWatcher.WatchedDirectory(referenceAssembliesPath, ".dll");
// TODO: set this to watch the NuGet directory as well; there's some concern that watching the entire directory
// might make restores take longer because we'll be watching changes that may not impact your project.
_fileReferenceChangeContext = fileChangeWatcherProvider.Watcher.CreateContext(referenceAssemblies);
_fileReferenceChangeContext.FileChanged += FileReferenceChangeContext_FileChanged;
}
public event EventHandler<string> ReferenceChanged;
public PortableExecutableReference CreateReferenceAndStartWatchingFile(string fullFilePath, MetadataReferenceProperties properties)
{
lock (_gate)
{
var reference = _visualStudioWorkspace.Value.CreatePortableExecutableReference(fullFilePath, properties);
var fileWatchingToken = _fileReferenceChangeContext.EnqueueWatchingFile(fullFilePath);
_metadataReferenceFileWatchingTokens.Add(reference, fileWatchingToken);
return reference;
}
}
public void StopWatchingReference(PortableExecutableReference reference)
{
lock (_gate)
{
if (!_metadataReferenceFileWatchingTokens.TryGetValue(reference, out var token))
{
throw new ArgumentException("The reference was already not being watched.");
}
_fileReferenceChangeContext.StopWatchingFile(token);
_metadataReferenceFileWatchingTokens.Remove(reference);
// Note we still potentially have an outstanding change that we haven't raised a notification
// for due to the delay we use. We could cancel the notification for that file path,
// but we may still have another outstanding PortableExecutableReference that isn't this one
// that does want that notification. We're OK just leaving the delay still running for two
// reasons:
//
// 1. Technically, we did see a file change before the call to StopWatchingReference, so
// arguably we should still raise it.
// 2. Since we raise the notification for a file path, it's up to the consumer of this to still
// track down which actual reference needs to be changed. That'll automatically handle any
// race where the event comes late, which is a scenario this must always deal with no matter
// what -- another thread might already be gearing up to notify the caller of this reference
// and we can't stop it.
}
}
private void FileReferenceChangeContext_FileChanged(object sender, string fullFilePath)
{
lock (_gate)
{
if (_metadataReferenceRefreshCancellationTokenSources.TryGetValue(fullFilePath, out var cancellationTokenSource))
{
cancellationTokenSource.Cancel();
_metadataReferenceRefreshCancellationTokenSources.Remove(fullFilePath);
}
cancellationTokenSource = new CancellationTokenSource();
_metadataReferenceRefreshCancellationTokenSources.Add(fullFilePath, cancellationTokenSource);
Task.Delay(TimeSpan.FromSeconds(5), cancellationTokenSource.Token).ContinueWith(_ =>
{
var needsNotification = false;
lock (_gate)
{
// We need to re-check the cancellation token source under the lock, since it might have been cancelled and restarted
// due to another event
cancellationTokenSource.Token.ThrowIfCancellationRequested();
needsNotification = true;
_metadataReferenceRefreshCancellationTokenSources.Remove(fullFilePath);
}
if (needsNotification)
{
ReferenceChanged?.Invoke(this, fullFilePath);
}
}, cancellationTokenSource.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default);
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableArrayExtensionsTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.Collections
{
public class ImmutableArrayExtensionsTests
{
[Fact]
public void CreateFrom()
{
ImmutableArray<int> a;
a = ImmutableArray.Create<int>(2);
Assert.Equal(1, a.Length);
Assert.Equal(2, a[0]);
Assert.Throws<ArgumentNullException>(() => ImmutableArray.CreateRange<int>((IEnumerable<int>)null));
a = ImmutableArray.CreateRange<int>(Enumerable.Range(1, 2));
Assert.Equal(2, a.Length);
Assert.Equal(1, a[0]);
Assert.Equal(2, a[1]);
}
[Fact]
public void ReadOnlyArraysBroken()
{
var b = new ArrayBuilder<String>();
b.Add("hello");
b.Add("world");
Assert.Equal("hello", b[0]);
var a = b.AsImmutable();
Assert.Equal("hello", a[0]);
var e = (IEnumerable<string>)a;
Assert.Equal("hello", e.First());
var aa = e.ToArray();
Assert.Equal("hello", aa[0]);
var first = b.FirstOrDefault((x) => true);
Assert.Equal("hello", first);
ImmutableArray<int> nullOrEmpty = default(ImmutableArray<int>);
Assert.True(nullOrEmpty.IsDefault);
Assert.True(nullOrEmpty.IsDefaultOrEmpty);
Assert.Throws<NullReferenceException>(() => nullOrEmpty.IsEmpty);
nullOrEmpty = ImmutableArray.Create<int>();
Assert.True(nullOrEmpty.IsEmpty);
}
[Fact]
public void InsertAt()
{
var builder = new ArrayBuilder<String>();
builder.Insert(0, "candy");
builder.Insert(0, "apple");
builder.Insert(2, "elephant");
builder.Insert(2, "drum");
builder.Insert(1, "banana");
builder.Insert(0, "$$$");
Assert.Equal("$$$", builder[0]);
Assert.Equal("apple", builder[1]);
Assert.Equal("banana", builder[2]);
Assert.Equal("candy", builder[3]);
Assert.Equal("drum", builder[4]);
Assert.Equal("elephant", builder[5]);
}
[Fact]
public void SetEquals()
{
var nul = default(ImmutableArray<int>);
var empty = ImmutableArray.Create<int>();
var original = new int[] { 1, 2, 3, }.AsImmutableOrNull();
var notEqualSubset = new int[] { 1, 2, }.AsImmutableOrNull();
var notEqualSuperset = new int[] { 1, 2, 3, 4, }.AsImmutableOrNull();
var equalOrder = new int[] { 2, 1, 3, }.AsImmutableOrNull();
var equalElements = new int[] { -1, -2, -3 }.AsImmutableOrNull();
var equalDuplicate = new int[] { 1, 2, 3, 3, -3 }.AsImmutableOrNull();
IEqualityComparer<int> comparer = new AbsoluteValueComparer();
Assert.True(nul.SetEquals(nul, comparer));
Assert.True(empty.SetEquals(empty, comparer));
Assert.True(original.SetEquals(original, comparer));
Assert.True(original.SetEquals(equalOrder, comparer));
Assert.True(original.SetEquals(equalElements, comparer));
Assert.True(original.SetEquals(equalDuplicate, comparer));
Assert.False(nul.SetEquals(empty, comparer));
Assert.False(nul.SetEquals(original, comparer));
Assert.False(empty.SetEquals(nul, comparer));
Assert.False(empty.SetEquals(original, comparer));
Assert.False(original.SetEquals(nul, comparer));
Assert.False(original.SetEquals(empty, comparer));
Assert.False(original.SetEquals(notEqualSubset, comparer));
Assert.False(original.SetEquals(notEqualSuperset, comparer));
//there's a special case for this in the impl, so cover it specially
var singleton1 = ImmutableArray.Create<int>(1);
var singleton2 = ImmutableArray.Create<int>(2);
Assert.True(singleton1.SetEquals(singleton1, comparer));
Assert.False(singleton1.SetEquals(singleton2, comparer));
}
private class AbsoluteValueComparer : IEqualityComparer<int>
{
#region IEqualityComparer<int> Members
bool IEqualityComparer<int>.Equals(int x, int y)
{
return Math.Abs(x) == Math.Abs(y);
}
int IEqualityComparer<int>.GetHashCode(int x)
{
return Math.Abs(x);
}
#endregion
}
[Fact]
public void Single()
{
Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single());
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>().Single());
Assert.Equal(1, ImmutableArray.Create<int>(1).Single());
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>(1, 2).Single());
Func<int, bool> isOdd = x => x % 2 == 1;
// BUG:753260 Should this be ArgumentNullException for consistency?
Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single(isOdd));
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>().Single(isOdd));
Assert.Equal(1, ImmutableArray.Create<int>(1, 2).Single(isOdd));
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>(1, 2, 3).Single(isOdd));
}
[Fact]
public void IndexOf()
{
var roa = new int[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Equal(1, roa.IndexOf(2));
}
[Fact]
public void CompareToNull()
{
var roaNull = default(ImmutableArray<int>);
Assert.True(roaNull == null);
Assert.False(roaNull != null);
Assert.True(null == roaNull);
Assert.False(null != roaNull);
var copy = roaNull;
Assert.True(copy == roaNull);
Assert.False(copy != roaNull);
var notnull = ImmutableArray.Create<int>();
Assert.False(notnull == null);
Assert.True(notnull != null);
Assert.False(null == notnull);
Assert.True(null != notnull);
}
[Fact]
public void CopyTo()
{
var roa = new int?[] { 1, null, 3 }.AsImmutableOrNull();
var roaCopy = new int?[4];
roa.CopyTo(roaCopy, 1);
Assert.False(roaCopy[0].HasValue);
Assert.Equal(1, roaCopy[1].Value);
Assert.False(roaCopy[2].HasValue);
Assert.Equal(3, roaCopy[3].Value);
}
[Fact]
public void ElementAt()
{
var roa = new int?[] { 1, null, 3 }.AsImmutableOrNull();
Assert.Equal(1, roa.ElementAt(0).Value);
Assert.False(roa.ElementAt(1).HasValue);
Assert.Equal(3, roa.ElementAt(2).Value);
}
[Fact]
public void ElementAtOrDefault()
{
var roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.False(roa.ElementAtOrDefault(-1).HasValue);
Assert.Equal(1, roa.ElementAtOrDefault(0).Value);
Assert.Equal(2, roa.ElementAtOrDefault(1).Value);
Assert.Equal(3, roa.ElementAtOrDefault(2).Value);
Assert.False(roa.ElementAtOrDefault(10).HasValue);
}
[Fact]
public void Last()
{
var roa = new int?[] { }.AsImmutableOrNull();
Assert.Throws<InvalidOperationException>(() => roa.Last());
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Throws<InvalidOperationException>(() => roa.Last(i => i < 1));
Assert.Equal(3, roa.Last(i => i > 1));
}
[Fact]
public void LastOrDefault()
{
var roa = new int?[] { }.AsImmutableOrNull();
Assert.False(roa.LastOrDefault().HasValue);
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.False(roa.LastOrDefault(i => i < 1).HasValue);
Assert.Equal(3, roa.LastOrDefault(i => i > 1));
}
[Fact]
public void SingleOrDefault()
{
var roa = new int?[] { }.AsImmutableOrNull();
Assert.False(roa.SingleOrDefault().HasValue);
roa = new int?[] { 1 }.AsImmutableOrNull();
Assert.Equal(1, roa.SingleOrDefault());
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Throws<InvalidOperationException>(() => roa.SingleOrDefault());
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Equal(2, roa.SingleOrDefault(i => i == 2));
}
[Fact]
public void Concat()
{
var empty = ImmutableArray.Create<int>();
var a = ImmutableArray.Create<int>(0, 2, 4);
Assert.Equal(empty, empty.Concat(empty));
Assert.Equal(a, a.Concat(empty));
Assert.Equal(a, empty.Concat(a));
Assert.True(a.Concat(a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4, 0, 2, 4)));
}
[Fact]
public void AddRange()
{
var empty = ImmutableArray.Create<int>();
var a = ImmutableArray.Create<int>(0, 2, 4);
Assert.Equal(empty, empty.AddRange(empty));
Assert.Equal(a, a.AddRange(empty));
Assert.Equal(a, empty.AddRange(a));
Assert.True(a.AddRange(a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4, 0, 2, 4)));
Assert.Equal(empty, empty.AddRange((IEnumerable<int>)empty));
Assert.Equal(a, a.AddRange((IEnumerable<int>)empty));
Assert.True(a.SequenceEqual(empty.AddRange((IEnumerable<int>)a)));
Assert.True(a.AddRange((IEnumerable<int>)a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4, 0, 2, 4)));
}
[Fact]
public void InsertRange()
{
var empty = ImmutableArray.Create<int>();
var a = ImmutableArray.Create<int>(0, 2, 4);
Assert.Equal(empty, empty.InsertRange(0, empty));
Assert.Equal(a, a.InsertRange(0, empty));
Assert.Equal(a, a.InsertRange(2, empty));
Assert.True(a.SequenceEqual(empty.InsertRange(0, a)));
Assert.True(a.InsertRange(2, a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 0, 2, 4, 4)));
}
[Fact]
public void ToDictionary()
{
var roa = new string[] { "one:1", "two:2", "three:3" }.AsImmutableOrNull();
// Call extension method directly to resolve the ambiguity with EnumerableExtensions.ToDictionary
var dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First());
Assert.Equal("one:1", dict["one"]);
Assert.Equal("two:2", dict["two"]);
Assert.Equal("three:3", dict["three"]);
Assert.Throws<KeyNotFoundException>(() => dict["One"]);
dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), StringComparer.OrdinalIgnoreCase);
Assert.Equal("one:1", dict["one"]);
Assert.Equal("two:2", dict["Two"]);
Assert.Equal("three:3", dict["THREE"]);
Assert.Throws<KeyNotFoundException>(() => dict[""]);
dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), s => s.Split(':').Last());
Assert.Equal("1", dict["one"]);
Assert.Equal("2", dict["two"]);
Assert.Equal("3", dict["three"]);
Assert.Throws<KeyNotFoundException>(() => dict["THREE"]);
dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), s => s.Split(':').Last(), StringComparer.OrdinalIgnoreCase);
Assert.Equal("1", dict["onE"]);
Assert.Equal("2", dict["Two"]);
Assert.Equal("3", dict["three"]);
Assert.Throws<KeyNotFoundException>(() => dict["four"]);
}
[Fact]
public void SequenceEqual()
{
var a = ImmutableArray.Create<string>("A", "B", "C");
var b = ImmutableArray.Create<string>("A", "b", "c");
var c = ImmutableArray.Create<string>("A", "b");
Assert.False(a.SequenceEqual(b));
Assert.True(a.SequenceEqual(b, StringComparer.OrdinalIgnoreCase));
Assert.False(a.SequenceEqual(c));
Assert.False(a.SequenceEqual(c, StringComparer.OrdinalIgnoreCase));
Assert.False(c.SequenceEqual(a));
var r = ImmutableArray.Create<int>(1, 2, 3);
Assert.True(r.SequenceEqual(Enumerable.Range(1, 3)));
Assert.False(r.SequenceEqual(Enumerable.Range(1, 2)));
Assert.False(r.SequenceEqual(Enumerable.Range(1, 4)));
var s = ImmutableArray.Create<int>(10, 20, 30);
Assert.True(r.SequenceEqual(s, (x, y) => 10 * x == y));
}
[Fact]
public void SelectAsArray()
{
var empty = ImmutableArray.Create<object>();
Assert.True(empty.SequenceEqual(empty.SelectAsArray(item => item)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, arg) => item, 1)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, arg) => arg, 2)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, index, arg) => item, 1)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, index, arg) => arg, 2)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, index, arg) => index, 3)));
var a = ImmutableArray.Create<int>(3, 2, 1, 0);
var b = ImmutableArray.Create<int>(0, 1, 2, 3);
var c = ImmutableArray.Create<int>(2, 2, 2, 2);
Assert.True(a.SequenceEqual(a.SelectAsArray(item => item)));
Assert.True(a.SequenceEqual(a.SelectAsArray((item, arg) => item, 1)));
Assert.True(c.SequenceEqual(a.SelectAsArray((item, arg) => arg, 2)));
Assert.True(a.SequenceEqual(a.SelectAsArray((item, index, arg) => item, 1)));
Assert.True(c.SequenceEqual(a.SelectAsArray((item, index, arg) => arg, 2)));
Assert.True(b.SequenceEqual(a.SelectAsArray((item, index, arg) => index, 3)));
AssertEx.Equal(new[] { 10 }, ImmutableArray.Create(1).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20 }, ImmutableArray.Create(1, 2).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20, 30 }, ImmutableArray.Create(1, 2, 3).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20, 30, 40 }, ImmutableArray.Create(1, 2, 3, 4).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20, 30, 40, 50 }, ImmutableArray.Create(1, 2, 3, 4, 5).SelectAsArray(i => 10 * i));
}
[Fact]
public void SelectAsArrayWithPredicate()
{
Assert.Empty(ImmutableArray<object>.Empty.SelectAsArray<object, int>(item => throw null, item => throw null));
var array = ImmutableArray.Create(1, 2, 3, 4, 5);
AssertEx.Equal(new[] { 2, 3, 4, 5, 6 }, array.SelectAsArray(item => true, item => item + 1));
AssertEx.Equal(new[] { 3, 5 }, array.SelectAsArray(item => item % 2 == 0, item => item + 1));
Assert.Empty(array.SelectAsArray<int, int>(item => item < 0, item => throw null));
}
[Fact]
public void ZipAsArray()
{
var empty = ImmutableArray.Create<object>();
Assert.True(empty.SequenceEqual(empty.ZipAsArray(empty, (item1, item2) => item1)));
var single1 = ImmutableArray.Create(1);
var single2 = ImmutableArray.Create(10);
var single3 = ImmutableArray.Create(11);
Assert.True(single3.SequenceEqual(single1.ZipAsArray(single2, (item1, item2) => item1 + item2)));
var pair1 = ImmutableArray.Create(1, 2);
var pair2 = ImmutableArray.Create(10, 11);
var pair3 = ImmutableArray.Create(11, 13);
Assert.True(pair3.SequenceEqual(pair1.ZipAsArray(pair2, (item1, item2) => item1 + item2)));
var triple1 = ImmutableArray.Create(1, 2, 3);
var triple2 = ImmutableArray.Create(10, 11, 12);
var triple3 = ImmutableArray.Create(11, 13, 15);
Assert.True(triple3.SequenceEqual(triple1.ZipAsArray(triple2, (item1, item2) => item1 + item2)));
var quad1 = ImmutableArray.Create(1, 2, 3, 4);
var quad2 = ImmutableArray.Create(10, 11, 12, 13);
var quad3 = ImmutableArray.Create(11, 13, 15, 17);
Assert.True(quad3.SequenceEqual(quad1.ZipAsArray(quad2, (item1, item2) => item1 + item2)));
var quin1 = ImmutableArray.Create(1, 2, 3, 4, 5);
var quin2 = ImmutableArray.Create(10, 11, 12, 13, 14);
var quin3 = ImmutableArray.Create(11, 13, 15, 17, 19);
Assert.True(quin3.SequenceEqual(quin1.ZipAsArray(quin2, (item1, item2) => item1 + item2)));
}
[Fact]
public void ZipAsArrayWithIndex()
{
var empty = ImmutableArray.Create<object>();
Assert.True(empty.SequenceEqual(empty.ZipAsArray(empty, (item1, item2) => item1)));
var single1 = ImmutableArray.Create(1);
var single2 = ImmutableArray.Create(10);
var single3 = ImmutableArray.Create(13);
Assert.True(single3.SequenceEqual(single1.ZipAsArray(single2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var pair1 = ImmutableArray.Create(1, 2);
var pair2 = ImmutableArray.Create(10, 11);
var pair3 = ImmutableArray.Create(13, 16);
Assert.True(pair3.SequenceEqual(pair1.ZipAsArray(pair2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var triple1 = ImmutableArray.Create(1, 2, 3);
var triple2 = ImmutableArray.Create(10, 11, 12);
var triple3 = ImmutableArray.Create(13, 16, 19);
Assert.True(triple3.SequenceEqual(triple1.ZipAsArray(triple2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var quad1 = ImmutableArray.Create(1, 2, 3, 4);
var quad2 = ImmutableArray.Create(10, 11, 12, 13);
var quad3 = ImmutableArray.Create(13, 16, 19, 22);
Assert.True(quad3.SequenceEqual(quad1.ZipAsArray(quad2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var quin1 = ImmutableArray.Create(1, 2, 3, 4, 5);
var quin2 = ImmutableArray.Create(10, 11, 12, 13, 14);
var quin3 = ImmutableArray.Create(13, 16, 19, 22, 25);
Assert.True(quin3.SequenceEqual(quin1.ZipAsArray(quin2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
}
[Fact]
public void WhereAsArray()
{
var empty = ImmutableArray.Create<object>();
// All.
Assert.Equal(empty, empty.WhereAsArray(o => true));
// None.
Assert.Equal(empty, empty.WhereAsArray(o => false));
var a = ImmutableArray.Create<int>(0, 1, 2, 3, 4, 5);
// All.
Assert.Equal(a, a.WhereAsArray(i => true));
// None.
Assert.True(a.WhereAsArray(i => false).SequenceEqual(ImmutableArray.Create<int>()));
// All but the first.
Assert.True(a.WhereAsArray(i => i > 0).SequenceEqual(ImmutableArray.Create<int>(1, 2, 3, 4, 5)));
// All but the last.
Assert.True(a.WhereAsArray(i => i < 5).SequenceEqual(ImmutableArray.Create<int>(0, 1, 2, 3, 4)));
// First only.
Assert.True(a.WhereAsArray(i => i == 0).SequenceEqual(ImmutableArray.Create<int>(0)));
// Last only.
Assert.True(a.WhereAsArray(i => i == 5).SequenceEqual(ImmutableArray.Create<int>(5)));
// First half.
Assert.True(a.WhereAsArray(i => i < 3).SequenceEqual(ImmutableArray.Create<int>(0, 1, 2)));
// Second half.
Assert.True(a.WhereAsArray(i => i > 2).SequenceEqual(ImmutableArray.Create<int>(3, 4, 5)));
// Even.
Assert.True(a.WhereAsArray(i => i % 2 == 0).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4)));
// Odd.
Assert.True(a.WhereAsArray(i => i % 2 == 1).SequenceEqual(ImmutableArray.Create<int>(1, 3, 5)));
}
[Fact]
public void WhereAsArray_WithArg()
{
var x = new C();
Assert.Same(x, ImmutableArray.Create<object>(x).WhereAsArray((o, arg) => o == arg, x)[0]);
var a = ImmutableArray.Create(0, 1, 2, 3, 4, 5);
AssertEx.Equal(new[] { 3, 4, 5 }, a.WhereAsArray((i, j) => i > j, 2));
}
private class C
{
}
private class D : C
{
}
[Fact]
public void Casting()
{
var arrayOfD = new D[] { new D() }.AsImmutableOrNull();
var arrayOfC = arrayOfD.Cast<D, C>();
var arrayOfD2 = arrayOfC.As<D>();
// the underlying arrays are the same:
//Assert.True(arrayOfD.Equals(arrayOfC));
Assert.True(arrayOfD2.Equals(arrayOfD));
// Trying to cast from base to derived. "As" should return null (default)
Assert.True(new C[] { new C() }.AsImmutableOrNull().As<D>().IsDefault);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.Collections
{
public class ImmutableArrayExtensionsTests
{
[Fact]
public void CreateFrom()
{
ImmutableArray<int> a;
a = ImmutableArray.Create<int>(2);
Assert.Equal(1, a.Length);
Assert.Equal(2, a[0]);
Assert.Throws<ArgumentNullException>(() => ImmutableArray.CreateRange<int>((IEnumerable<int>)null));
a = ImmutableArray.CreateRange<int>(Enumerable.Range(1, 2));
Assert.Equal(2, a.Length);
Assert.Equal(1, a[0]);
Assert.Equal(2, a[1]);
}
[Fact]
public void ReadOnlyArraysBroken()
{
var b = new ArrayBuilder<String>();
b.Add("hello");
b.Add("world");
Assert.Equal("hello", b[0]);
var a = b.AsImmutable();
Assert.Equal("hello", a[0]);
var e = (IEnumerable<string>)a;
Assert.Equal("hello", e.First());
var aa = e.ToArray();
Assert.Equal("hello", aa[0]);
var first = b.FirstOrDefault((x) => true);
Assert.Equal("hello", first);
ImmutableArray<int> nullOrEmpty = default(ImmutableArray<int>);
Assert.True(nullOrEmpty.IsDefault);
Assert.True(nullOrEmpty.IsDefaultOrEmpty);
Assert.Throws<NullReferenceException>(() => nullOrEmpty.IsEmpty);
nullOrEmpty = ImmutableArray.Create<int>();
Assert.True(nullOrEmpty.IsEmpty);
}
[Fact]
public void InsertAt()
{
var builder = new ArrayBuilder<String>();
builder.Insert(0, "candy");
builder.Insert(0, "apple");
builder.Insert(2, "elephant");
builder.Insert(2, "drum");
builder.Insert(1, "banana");
builder.Insert(0, "$$$");
Assert.Equal("$$$", builder[0]);
Assert.Equal("apple", builder[1]);
Assert.Equal("banana", builder[2]);
Assert.Equal("candy", builder[3]);
Assert.Equal("drum", builder[4]);
Assert.Equal("elephant", builder[5]);
}
[Fact]
public void SetEquals()
{
var nul = default(ImmutableArray<int>);
var empty = ImmutableArray.Create<int>();
var original = new int[] { 1, 2, 3, }.AsImmutableOrNull();
var notEqualSubset = new int[] { 1, 2, }.AsImmutableOrNull();
var notEqualSuperset = new int[] { 1, 2, 3, 4, }.AsImmutableOrNull();
var equalOrder = new int[] { 2, 1, 3, }.AsImmutableOrNull();
var equalElements = new int[] { -1, -2, -3 }.AsImmutableOrNull();
var equalDuplicate = new int[] { 1, 2, 3, 3, -3 }.AsImmutableOrNull();
IEqualityComparer<int> comparer = new AbsoluteValueComparer();
Assert.True(nul.SetEquals(nul, comparer));
Assert.True(empty.SetEquals(empty, comparer));
Assert.True(original.SetEquals(original, comparer));
Assert.True(original.SetEquals(equalOrder, comparer));
Assert.True(original.SetEquals(equalElements, comparer));
Assert.True(original.SetEquals(equalDuplicate, comparer));
Assert.False(nul.SetEquals(empty, comparer));
Assert.False(nul.SetEquals(original, comparer));
Assert.False(empty.SetEquals(nul, comparer));
Assert.False(empty.SetEquals(original, comparer));
Assert.False(original.SetEquals(nul, comparer));
Assert.False(original.SetEquals(empty, comparer));
Assert.False(original.SetEquals(notEqualSubset, comparer));
Assert.False(original.SetEquals(notEqualSuperset, comparer));
//there's a special case for this in the impl, so cover it specially
var singleton1 = ImmutableArray.Create<int>(1);
var singleton2 = ImmutableArray.Create<int>(2);
Assert.True(singleton1.SetEquals(singleton1, comparer));
Assert.False(singleton1.SetEquals(singleton2, comparer));
}
private class AbsoluteValueComparer : IEqualityComparer<int>
{
#region IEqualityComparer<int> Members
bool IEqualityComparer<int>.Equals(int x, int y)
{
return Math.Abs(x) == Math.Abs(y);
}
int IEqualityComparer<int>.GetHashCode(int x)
{
return Math.Abs(x);
}
#endregion
}
[Fact]
public void Single()
{
Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single());
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>().Single());
Assert.Equal(1, ImmutableArray.Create<int>(1).Single());
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>(1, 2).Single());
Func<int, bool> isOdd = x => x % 2 == 1;
// BUG:753260 Should this be ArgumentNullException for consistency?
Assert.Throws<NullReferenceException>(() => default(ImmutableArray<int>).Single(isOdd));
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>().Single(isOdd));
Assert.Equal(1, ImmutableArray.Create<int>(1, 2).Single(isOdd));
Assert.Throws<InvalidOperationException>(() => ImmutableArray.Create<int>(1, 2, 3).Single(isOdd));
}
[Fact]
public void IndexOf()
{
var roa = new int[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Equal(1, roa.IndexOf(2));
}
[Fact]
public void CompareToNull()
{
var roaNull = default(ImmutableArray<int>);
Assert.True(roaNull == null);
Assert.False(roaNull != null);
Assert.True(null == roaNull);
Assert.False(null != roaNull);
var copy = roaNull;
Assert.True(copy == roaNull);
Assert.False(copy != roaNull);
var notnull = ImmutableArray.Create<int>();
Assert.False(notnull == null);
Assert.True(notnull != null);
Assert.False(null == notnull);
Assert.True(null != notnull);
}
[Fact]
public void CopyTo()
{
var roa = new int?[] { 1, null, 3 }.AsImmutableOrNull();
var roaCopy = new int?[4];
roa.CopyTo(roaCopy, 1);
Assert.False(roaCopy[0].HasValue);
Assert.Equal(1, roaCopy[1].Value);
Assert.False(roaCopy[2].HasValue);
Assert.Equal(3, roaCopy[3].Value);
}
[Fact]
public void ElementAt()
{
var roa = new int?[] { 1, null, 3 }.AsImmutableOrNull();
Assert.Equal(1, roa.ElementAt(0).Value);
Assert.False(roa.ElementAt(1).HasValue);
Assert.Equal(3, roa.ElementAt(2).Value);
}
[Fact]
public void ElementAtOrDefault()
{
var roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.False(roa.ElementAtOrDefault(-1).HasValue);
Assert.Equal(1, roa.ElementAtOrDefault(0).Value);
Assert.Equal(2, roa.ElementAtOrDefault(1).Value);
Assert.Equal(3, roa.ElementAtOrDefault(2).Value);
Assert.False(roa.ElementAtOrDefault(10).HasValue);
}
[Fact]
public void Last()
{
var roa = new int?[] { }.AsImmutableOrNull();
Assert.Throws<InvalidOperationException>(() => roa.Last());
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Throws<InvalidOperationException>(() => roa.Last(i => i < 1));
Assert.Equal(3, roa.Last(i => i > 1));
}
[Fact]
public void LastOrDefault()
{
var roa = new int?[] { }.AsImmutableOrNull();
Assert.False(roa.LastOrDefault().HasValue);
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.False(roa.LastOrDefault(i => i < 1).HasValue);
Assert.Equal(3, roa.LastOrDefault(i => i > 1));
}
[Fact]
public void SingleOrDefault()
{
var roa = new int?[] { }.AsImmutableOrNull();
Assert.False(roa.SingleOrDefault().HasValue);
roa = new int?[] { 1 }.AsImmutableOrNull();
Assert.Equal(1, roa.SingleOrDefault());
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Throws<InvalidOperationException>(() => roa.SingleOrDefault());
roa = new int?[] { 1, 2, 3 }.AsImmutableOrNull();
Assert.Equal(2, roa.SingleOrDefault(i => i == 2));
}
[Fact]
public void Concat()
{
var empty = ImmutableArray.Create<int>();
var a = ImmutableArray.Create<int>(0, 2, 4);
Assert.Equal(empty, empty.Concat(empty));
Assert.Equal(a, a.Concat(empty));
Assert.Equal(a, empty.Concat(a));
Assert.True(a.Concat(a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4, 0, 2, 4)));
}
[Fact]
public void AddRange()
{
var empty = ImmutableArray.Create<int>();
var a = ImmutableArray.Create<int>(0, 2, 4);
Assert.Equal(empty, empty.AddRange(empty));
Assert.Equal(a, a.AddRange(empty));
Assert.Equal(a, empty.AddRange(a));
Assert.True(a.AddRange(a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4, 0, 2, 4)));
Assert.Equal(empty, empty.AddRange((IEnumerable<int>)empty));
Assert.Equal(a, a.AddRange((IEnumerable<int>)empty));
Assert.True(a.SequenceEqual(empty.AddRange((IEnumerable<int>)a)));
Assert.True(a.AddRange((IEnumerable<int>)a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4, 0, 2, 4)));
}
[Fact]
public void InsertRange()
{
var empty = ImmutableArray.Create<int>();
var a = ImmutableArray.Create<int>(0, 2, 4);
Assert.Equal(empty, empty.InsertRange(0, empty));
Assert.Equal(a, a.InsertRange(0, empty));
Assert.Equal(a, a.InsertRange(2, empty));
Assert.True(a.SequenceEqual(empty.InsertRange(0, a)));
Assert.True(a.InsertRange(2, a).SequenceEqual(ImmutableArray.Create<int>(0, 2, 0, 2, 4, 4)));
}
[Fact]
public void ToDictionary()
{
var roa = new string[] { "one:1", "two:2", "three:3" }.AsImmutableOrNull();
// Call extension method directly to resolve the ambiguity with EnumerableExtensions.ToDictionary
var dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First());
Assert.Equal("one:1", dict["one"]);
Assert.Equal("two:2", dict["two"]);
Assert.Equal("three:3", dict["three"]);
Assert.Throws<KeyNotFoundException>(() => dict["One"]);
dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), StringComparer.OrdinalIgnoreCase);
Assert.Equal("one:1", dict["one"]);
Assert.Equal("two:2", dict["Two"]);
Assert.Equal("three:3", dict["THREE"]);
Assert.Throws<KeyNotFoundException>(() => dict[""]);
dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), s => s.Split(':').Last());
Assert.Equal("1", dict["one"]);
Assert.Equal("2", dict["two"]);
Assert.Equal("3", dict["three"]);
Assert.Throws<KeyNotFoundException>(() => dict["THREE"]);
dict = System.Linq.ImmutableArrayExtensions.ToDictionary(roa, s => s.Split(':').First(), s => s.Split(':').Last(), StringComparer.OrdinalIgnoreCase);
Assert.Equal("1", dict["onE"]);
Assert.Equal("2", dict["Two"]);
Assert.Equal("3", dict["three"]);
Assert.Throws<KeyNotFoundException>(() => dict["four"]);
}
[Fact]
public void SequenceEqual()
{
var a = ImmutableArray.Create<string>("A", "B", "C");
var b = ImmutableArray.Create<string>("A", "b", "c");
var c = ImmutableArray.Create<string>("A", "b");
Assert.False(a.SequenceEqual(b));
Assert.True(a.SequenceEqual(b, StringComparer.OrdinalIgnoreCase));
Assert.False(a.SequenceEqual(c));
Assert.False(a.SequenceEqual(c, StringComparer.OrdinalIgnoreCase));
Assert.False(c.SequenceEqual(a));
var r = ImmutableArray.Create<int>(1, 2, 3);
Assert.True(r.SequenceEqual(Enumerable.Range(1, 3)));
Assert.False(r.SequenceEqual(Enumerable.Range(1, 2)));
Assert.False(r.SequenceEqual(Enumerable.Range(1, 4)));
var s = ImmutableArray.Create<int>(10, 20, 30);
Assert.True(r.SequenceEqual(s, (x, y) => 10 * x == y));
}
[Fact]
public void SelectAsArray()
{
var empty = ImmutableArray.Create<object>();
Assert.True(empty.SequenceEqual(empty.SelectAsArray(item => item)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, arg) => item, 1)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, arg) => arg, 2)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, index, arg) => item, 1)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, index, arg) => arg, 2)));
Assert.True(empty.SequenceEqual(empty.SelectAsArray((item, index, arg) => index, 3)));
var a = ImmutableArray.Create<int>(3, 2, 1, 0);
var b = ImmutableArray.Create<int>(0, 1, 2, 3);
var c = ImmutableArray.Create<int>(2, 2, 2, 2);
Assert.True(a.SequenceEqual(a.SelectAsArray(item => item)));
Assert.True(a.SequenceEqual(a.SelectAsArray((item, arg) => item, 1)));
Assert.True(c.SequenceEqual(a.SelectAsArray((item, arg) => arg, 2)));
Assert.True(a.SequenceEqual(a.SelectAsArray((item, index, arg) => item, 1)));
Assert.True(c.SequenceEqual(a.SelectAsArray((item, index, arg) => arg, 2)));
Assert.True(b.SequenceEqual(a.SelectAsArray((item, index, arg) => index, 3)));
AssertEx.Equal(new[] { 10 }, ImmutableArray.Create(1).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20 }, ImmutableArray.Create(1, 2).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20, 30 }, ImmutableArray.Create(1, 2, 3).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20, 30, 40 }, ImmutableArray.Create(1, 2, 3, 4).SelectAsArray(i => 10 * i));
AssertEx.Equal(new[] { 10, 20, 30, 40, 50 }, ImmutableArray.Create(1, 2, 3, 4, 5).SelectAsArray(i => 10 * i));
}
[Fact]
public void SelectAsArrayWithPredicate()
{
Assert.Empty(ImmutableArray<object>.Empty.SelectAsArray<object, int>(item => throw null, item => throw null));
var array = ImmutableArray.Create(1, 2, 3, 4, 5);
AssertEx.Equal(new[] { 2, 3, 4, 5, 6 }, array.SelectAsArray(item => true, item => item + 1));
AssertEx.Equal(new[] { 3, 5 }, array.SelectAsArray(item => item % 2 == 0, item => item + 1));
Assert.Empty(array.SelectAsArray<int, int>(item => item < 0, item => throw null));
}
[Fact]
public void ZipAsArray()
{
var empty = ImmutableArray.Create<object>();
Assert.True(empty.SequenceEqual(empty.ZipAsArray(empty, (item1, item2) => item1)));
var single1 = ImmutableArray.Create(1);
var single2 = ImmutableArray.Create(10);
var single3 = ImmutableArray.Create(11);
Assert.True(single3.SequenceEqual(single1.ZipAsArray(single2, (item1, item2) => item1 + item2)));
var pair1 = ImmutableArray.Create(1, 2);
var pair2 = ImmutableArray.Create(10, 11);
var pair3 = ImmutableArray.Create(11, 13);
Assert.True(pair3.SequenceEqual(pair1.ZipAsArray(pair2, (item1, item2) => item1 + item2)));
var triple1 = ImmutableArray.Create(1, 2, 3);
var triple2 = ImmutableArray.Create(10, 11, 12);
var triple3 = ImmutableArray.Create(11, 13, 15);
Assert.True(triple3.SequenceEqual(triple1.ZipAsArray(triple2, (item1, item2) => item1 + item2)));
var quad1 = ImmutableArray.Create(1, 2, 3, 4);
var quad2 = ImmutableArray.Create(10, 11, 12, 13);
var quad3 = ImmutableArray.Create(11, 13, 15, 17);
Assert.True(quad3.SequenceEqual(quad1.ZipAsArray(quad2, (item1, item2) => item1 + item2)));
var quin1 = ImmutableArray.Create(1, 2, 3, 4, 5);
var quin2 = ImmutableArray.Create(10, 11, 12, 13, 14);
var quin3 = ImmutableArray.Create(11, 13, 15, 17, 19);
Assert.True(quin3.SequenceEqual(quin1.ZipAsArray(quin2, (item1, item2) => item1 + item2)));
}
[Fact]
public void ZipAsArrayWithIndex()
{
var empty = ImmutableArray.Create<object>();
Assert.True(empty.SequenceEqual(empty.ZipAsArray(empty, (item1, item2) => item1)));
var single1 = ImmutableArray.Create(1);
var single2 = ImmutableArray.Create(10);
var single3 = ImmutableArray.Create(13);
Assert.True(single3.SequenceEqual(single1.ZipAsArray(single2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var pair1 = ImmutableArray.Create(1, 2);
var pair2 = ImmutableArray.Create(10, 11);
var pair3 = ImmutableArray.Create(13, 16);
Assert.True(pair3.SequenceEqual(pair1.ZipAsArray(pair2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var triple1 = ImmutableArray.Create(1, 2, 3);
var triple2 = ImmutableArray.Create(10, 11, 12);
var triple3 = ImmutableArray.Create(13, 16, 19);
Assert.True(triple3.SequenceEqual(triple1.ZipAsArray(triple2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var quad1 = ImmutableArray.Create(1, 2, 3, 4);
var quad2 = ImmutableArray.Create(10, 11, 12, 13);
var quad3 = ImmutableArray.Create(13, 16, 19, 22);
Assert.True(quad3.SequenceEqual(quad1.ZipAsArray(quad2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
var quin1 = ImmutableArray.Create(1, 2, 3, 4, 5);
var quin2 = ImmutableArray.Create(10, 11, 12, 13, 14);
var quin3 = ImmutableArray.Create(13, 16, 19, 22, 25);
Assert.True(quin3.SequenceEqual(quin1.ZipAsArray(quin2, 2, (item1, item2, i, arg) => item1 + item2 + i + arg)));
}
[Fact]
public void WhereAsArray()
{
var empty = ImmutableArray.Create<object>();
// All.
Assert.Equal(empty, empty.WhereAsArray(o => true));
// None.
Assert.Equal(empty, empty.WhereAsArray(o => false));
var a = ImmutableArray.Create<int>(0, 1, 2, 3, 4, 5);
// All.
Assert.Equal(a, a.WhereAsArray(i => true));
// None.
Assert.True(a.WhereAsArray(i => false).SequenceEqual(ImmutableArray.Create<int>()));
// All but the first.
Assert.True(a.WhereAsArray(i => i > 0).SequenceEqual(ImmutableArray.Create<int>(1, 2, 3, 4, 5)));
// All but the last.
Assert.True(a.WhereAsArray(i => i < 5).SequenceEqual(ImmutableArray.Create<int>(0, 1, 2, 3, 4)));
// First only.
Assert.True(a.WhereAsArray(i => i == 0).SequenceEqual(ImmutableArray.Create<int>(0)));
// Last only.
Assert.True(a.WhereAsArray(i => i == 5).SequenceEqual(ImmutableArray.Create<int>(5)));
// First half.
Assert.True(a.WhereAsArray(i => i < 3).SequenceEqual(ImmutableArray.Create<int>(0, 1, 2)));
// Second half.
Assert.True(a.WhereAsArray(i => i > 2).SequenceEqual(ImmutableArray.Create<int>(3, 4, 5)));
// Even.
Assert.True(a.WhereAsArray(i => i % 2 == 0).SequenceEqual(ImmutableArray.Create<int>(0, 2, 4)));
// Odd.
Assert.True(a.WhereAsArray(i => i % 2 == 1).SequenceEqual(ImmutableArray.Create<int>(1, 3, 5)));
}
[Fact]
public void WhereAsArray_WithArg()
{
var x = new C();
Assert.Same(x, ImmutableArray.Create<object>(x).WhereAsArray((o, arg) => o == arg, x)[0]);
var a = ImmutableArray.Create(0, 1, 2, 3, 4, 5);
AssertEx.Equal(new[] { 3, 4, 5 }, a.WhereAsArray((i, j) => i > j, 2));
}
private class C
{
}
private class D : C
{
}
[Fact]
public void Casting()
{
var arrayOfD = new D[] { new D() }.AsImmutableOrNull();
var arrayOfC = arrayOfD.Cast<D, C>();
var arrayOfD2 = arrayOfC.As<D>();
// the underlying arrays are the same:
//Assert.True(arrayOfD.Equals(arrayOfC));
Assert.True(arrayOfD2.Equals(arrayOfD));
// Trying to cast from base to derived. "As" should return null (default)
Assert.True(new C[] { new C() }.AsImmutableOrNull().As<D>().IsDefault);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/VisualBasic/Portable/GenerateConstructorFromMembers/VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Composition
Imports System.Diagnostics.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.GenerateConstructorFromMembers
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.PickMembers
Namespace Microsoft.CodeAnalysis.VisualBasic.GenerateConstructorFromMembers
<ExportCodeRefactoringProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeRefactoringProviderNames.GenerateConstructorFromMembers), [Shared]>
<ExtensionOrder(Before:=PredefinedCodeRefactoringProviderNames.GenerateEqualsAndGetHashCodeFromMembers)>
Friend NotInheritable Class VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider
Inherits AbstractGenerateConstructorFromMembersCodeRefactoringProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
''' <summary>
''' For testing purposes only.
''' </summary>
<SuppressMessage("RoslynDiagnosticsReliability", "RS0034:Exported parts should have [ImportingConstructor]", Justification:="Used incorrectly by tests")>
Friend Sub New(pickMembersService_forTesting As IPickMembersService)
MyBase.New(pickMembersService_forTesting)
End Sub
Protected Overrides Function ContainingTypesOrSelfHasUnsafeKeyword(containingType As INamedTypeSymbol) As Boolean
Return False
End Function
Protected Overrides Function ToDisplayString(parameter As IParameterSymbol, format As SymbolDisplayFormat) As String
Return SymbolDisplay.ToDisplayString(parameter, format)
End Function
Protected Overrides Function PrefersThrowExpression(options As DocumentOptionSet) As Boolean
' No throw expression preference option is defined for VB because it doesn't support throw expressions.
Return False
End Function
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Composition
Imports System.Diagnostics.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.GenerateConstructorFromMembers
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.PickMembers
Namespace Microsoft.CodeAnalysis.VisualBasic.GenerateConstructorFromMembers
<ExportCodeRefactoringProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeRefactoringProviderNames.GenerateConstructorFromMembers), [Shared]>
<ExtensionOrder(Before:=PredefinedCodeRefactoringProviderNames.GenerateEqualsAndGetHashCodeFromMembers)>
Friend NotInheritable Class VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider
Inherits AbstractGenerateConstructorFromMembersCodeRefactoringProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
''' <summary>
''' For testing purposes only.
''' </summary>
<SuppressMessage("RoslynDiagnosticsReliability", "RS0034:Exported parts should have [ImportingConstructor]", Justification:="Used incorrectly by tests")>
Friend Sub New(pickMembersService_forTesting As IPickMembersService)
MyBase.New(pickMembersService_forTesting)
End Sub
Protected Overrides Function ContainingTypesOrSelfHasUnsafeKeyword(containingType As INamedTypeSymbol) As Boolean
Return False
End Function
Protected Overrides Function ToDisplayString(parameter As IParameterSymbol, format As SymbolDisplayFormat) As String
Return SymbolDisplay.ToDisplayString(parameter, format)
End Function
Protected Overrides Function PrefersThrowExpression(options As DocumentOptionSet) As Boolean
' No throw expression preference option is defined for VB because it doesn't support throw expressions.
Return False
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/CSharp/Portable/Symbols/Source/SourceEventAccessorSymbol.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Base class for event accessors - synthesized and user defined.
/// </summary>
internal abstract class SourceEventAccessorSymbol : SourceMemberMethodSymbol
{
private readonly SourceEventSymbol _event;
private readonly string _name;
private readonly ImmutableArray<MethodSymbol> _explicitInterfaceImplementations;
private ImmutableArray<ParameterSymbol> _lazyParameters;
private TypeWithAnnotations _lazyReturnType;
public SourceEventAccessorSymbol(
SourceEventSymbol @event,
SyntaxReference syntaxReference,
ImmutableArray<Location> locations,
EventSymbol explicitlyImplementedEventOpt,
string aliasQualifierOpt,
bool isAdder,
bool isIterator,
bool isNullableAnalysisEnabled)
: base(@event.containingType, syntaxReference, locations, isIterator)
{
_event = @event;
string name;
ImmutableArray<MethodSymbol> explicitInterfaceImplementations;
if ((object)explicitlyImplementedEventOpt == null)
{
name = SourceEventSymbol.GetAccessorName(@event.Name, isAdder);
explicitInterfaceImplementations = ImmutableArray<MethodSymbol>.Empty;
}
else
{
MethodSymbol implementedAccessor = isAdder ? explicitlyImplementedEventOpt.AddMethod : explicitlyImplementedEventOpt.RemoveMethod;
string accessorName = (object)implementedAccessor != null ? implementedAccessor.Name : SourceEventSymbol.GetAccessorName(explicitlyImplementedEventOpt.Name, isAdder);
name = ExplicitInterfaceHelpers.GetMemberName(accessorName, explicitlyImplementedEventOpt.ContainingType, aliasQualifierOpt);
explicitInterfaceImplementations = (object)implementedAccessor == null ? ImmutableArray<MethodSymbol>.Empty : ImmutableArray.Create<MethodSymbol>(implementedAccessor);
}
_explicitInterfaceImplementations = explicitInterfaceImplementations;
this.MakeFlags(
isAdder ? MethodKind.EventAdd : MethodKind.EventRemove,
@event.Modifiers,
returnsVoid: false, // until we learn otherwise (in LazyMethodChecks).
isExtensionMethod: false,
isNullableAnalysisEnabled: isNullableAnalysisEnabled,
isMetadataVirtualIgnoringModifiers: @event.IsExplicitInterfaceImplementation && (@event.Modifiers & DeclarationModifiers.Static) == 0);
_name = GetOverriddenAccessorName(@event, isAdder) ?? name;
}
public override string Name
{
get { return _name; }
}
internal override bool IsExplicitInterfaceImplementation
{
get { return _event.IsExplicitInterfaceImplementation; }
}
public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
{
get { return _explicitInterfaceImplementations; }
}
public sealed override bool AreLocalsZeroed
=> !_event.HasSkipLocalsInitAttribute && base.AreLocalsZeroed;
public SourceEventSymbol AssociatedEvent
{
get { return _event; }
}
public sealed override Symbol AssociatedSymbol
{
get { return _event; }
}
protected sealed override void MethodChecks(BindingDiagnosticBag diagnostics)
{
Debug.Assert(_lazyParameters.IsDefault != _lazyReturnType.HasType);
// CONSIDER: currently, we're copying the custom modifiers of the event overridden
// by this method's associated event (by using the associated event's type, which is
// copied from the overridden event). It would be more correct to copy them from
// the specific accessor that this method is overriding (as in SourceMemberMethodSymbol).
if (_lazyReturnType.IsDefault)
{
CSharpCompilation compilation = this.DeclaringCompilation;
Debug.Assert(compilation != null);
// NOTE: LazyMethodChecks calls us within a lock, so we use regular assignments,
// rather than Interlocked.CompareExchange.
if (_event.IsWindowsRuntimeEvent)
{
TypeSymbol eventTokenType = compilation.GetWellKnownType(WellKnownType.System_Runtime_InteropServices_WindowsRuntime_EventRegistrationToken);
Binder.ReportUseSite(eventTokenType, diagnostics, this.Location);
if (this.MethodKind == MethodKind.EventAdd)
{
// EventRegistrationToken add_E(EventDelegate d);
// Leave the returns void bit in this.flags false.
_lazyReturnType = TypeWithAnnotations.Create(eventTokenType);
var parameter = new SynthesizedAccessorValueParameterSymbol(this, _event.TypeWithAnnotations, 0);
_lazyParameters = ImmutableArray.Create<ParameterSymbol>(parameter);
}
else
{
Debug.Assert(this.MethodKind == MethodKind.EventRemove);
// void remove_E(EventRegistrationToken t);
TypeSymbol voidType = compilation.GetSpecialType(SpecialType.System_Void);
Binder.ReportUseSite(voidType, diagnostics, this.Location);
_lazyReturnType = TypeWithAnnotations.Create(voidType);
this.SetReturnsVoid(returnsVoid: true);
var parameter = new SynthesizedAccessorValueParameterSymbol(this, TypeWithAnnotations.Create(eventTokenType), 0);
_lazyParameters = ImmutableArray.Create<ParameterSymbol>(parameter);
}
}
else
{
// void add_E(EventDelegate d);
// void remove_E(EventDelegate d);
TypeSymbol voidType = compilation.GetSpecialType(SpecialType.System_Void);
Binder.ReportUseSite(voidType, diagnostics, this.Location);
_lazyReturnType = TypeWithAnnotations.Create(voidType);
this.SetReturnsVoid(returnsVoid: true);
var parameter = new SynthesizedAccessorValueParameterSymbol(this, _event.TypeWithAnnotations, 0);
_lazyParameters = ImmutableArray.Create<ParameterSymbol>(parameter);
}
}
}
public sealed override bool ReturnsVoid
{
get
{
LazyMethodChecks();
Debug.Assert(!_lazyReturnType.IsDefault);
return base.ReturnsVoid;
}
}
public override RefKind RefKind
{
get { return RefKind.None; }
}
public sealed override TypeWithAnnotations ReturnTypeWithAnnotations
{
get
{
LazyMethodChecks();
Debug.Assert(!_lazyReturnType.IsDefault);
return _lazyReturnType;
}
}
public sealed override ImmutableArray<CustomModifier> RefCustomModifiers
{
get
{
return ImmutableArray<CustomModifier>.Empty; // Same as base, but this is clear and explicit.
}
}
public sealed override ImmutableArray<ParameterSymbol> Parameters
{
get
{
LazyMethodChecks();
Debug.Assert(!_lazyParameters.IsDefault);
return _lazyParameters;
}
}
public sealed override bool IsVararg
{
get { return false; }
}
public sealed override ImmutableArray<TypeParameterSymbol> TypeParameters
{
get { return ImmutableArray<TypeParameterSymbol>.Empty; }
}
public sealed override ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes()
=> ImmutableArray<ImmutableArray<TypeWithAnnotations>>.Empty;
public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
=> ImmutableArray<TypeParameterConstraintKind>.Empty;
internal Location Location
{
get
{
Debug.Assert(this.Locations.Length == 1);
return this.Locations[0];
}
}
protected string GetOverriddenAccessorName(SourceEventSymbol @event, bool isAdder)
{
if (this.IsOverride)
{
// NOTE: What we'd really like to do is ask for the OverriddenMethod of this symbol.
// Unfortunately, we can't do that, because it would inspect the signature of this
// method, which depends on whether @event is a WinRT event, which depends on
// interface implementation, which we can't check during construction of the
// member list of the type containing this accessor (infinite recursion). Instead,
// we inline part of the implementation of OverriddenMethod - we look for the
// overridden event (which does not depend on WinRT-ness) and then grab the corresponding
// accessor.
EventSymbol overriddenEvent = @event.OverriddenEvent;
if ((object)overriddenEvent != null)
{
// If this accessor is overriding an accessor from metadata, it is possible that
// the name of the overridden accessor doesn't follow the C# add_X/remove_X pattern.
// We should copy the name so that the runtime will recognize this as an override.
MethodSymbol overriddenAccessor = overriddenEvent.GetOwnOrInheritedAccessor(isAdder);
return (object)overriddenAccessor == null ? null : overriddenAccessor.Name;
}
}
return null;
}
internal override bool IsExpressionBodied
{
// Events cannot be expression-bodied
get { return false; }
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Base class for event accessors - synthesized and user defined.
/// </summary>
internal abstract class SourceEventAccessorSymbol : SourceMemberMethodSymbol
{
private readonly SourceEventSymbol _event;
private readonly string _name;
private readonly ImmutableArray<MethodSymbol> _explicitInterfaceImplementations;
private ImmutableArray<ParameterSymbol> _lazyParameters;
private TypeWithAnnotations _lazyReturnType;
public SourceEventAccessorSymbol(
SourceEventSymbol @event,
SyntaxReference syntaxReference,
ImmutableArray<Location> locations,
EventSymbol explicitlyImplementedEventOpt,
string aliasQualifierOpt,
bool isAdder,
bool isIterator,
bool isNullableAnalysisEnabled)
: base(@event.containingType, syntaxReference, locations, isIterator)
{
_event = @event;
string name;
ImmutableArray<MethodSymbol> explicitInterfaceImplementations;
if ((object)explicitlyImplementedEventOpt == null)
{
name = SourceEventSymbol.GetAccessorName(@event.Name, isAdder);
explicitInterfaceImplementations = ImmutableArray<MethodSymbol>.Empty;
}
else
{
MethodSymbol implementedAccessor = isAdder ? explicitlyImplementedEventOpt.AddMethod : explicitlyImplementedEventOpt.RemoveMethod;
string accessorName = (object)implementedAccessor != null ? implementedAccessor.Name : SourceEventSymbol.GetAccessorName(explicitlyImplementedEventOpt.Name, isAdder);
name = ExplicitInterfaceHelpers.GetMemberName(accessorName, explicitlyImplementedEventOpt.ContainingType, aliasQualifierOpt);
explicitInterfaceImplementations = (object)implementedAccessor == null ? ImmutableArray<MethodSymbol>.Empty : ImmutableArray.Create<MethodSymbol>(implementedAccessor);
}
_explicitInterfaceImplementations = explicitInterfaceImplementations;
this.MakeFlags(
isAdder ? MethodKind.EventAdd : MethodKind.EventRemove,
@event.Modifiers,
returnsVoid: false, // until we learn otherwise (in LazyMethodChecks).
isExtensionMethod: false,
isNullableAnalysisEnabled: isNullableAnalysisEnabled,
isMetadataVirtualIgnoringModifiers: @event.IsExplicitInterfaceImplementation && (@event.Modifiers & DeclarationModifiers.Static) == 0);
_name = GetOverriddenAccessorName(@event, isAdder) ?? name;
}
public override string Name
{
get { return _name; }
}
internal override bool IsExplicitInterfaceImplementation
{
get { return _event.IsExplicitInterfaceImplementation; }
}
public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
{
get { return _explicitInterfaceImplementations; }
}
public sealed override bool AreLocalsZeroed
=> !_event.HasSkipLocalsInitAttribute && base.AreLocalsZeroed;
public SourceEventSymbol AssociatedEvent
{
get { return _event; }
}
public sealed override Symbol AssociatedSymbol
{
get { return _event; }
}
protected sealed override void MethodChecks(BindingDiagnosticBag diagnostics)
{
Debug.Assert(_lazyParameters.IsDefault != _lazyReturnType.HasType);
// CONSIDER: currently, we're copying the custom modifiers of the event overridden
// by this method's associated event (by using the associated event's type, which is
// copied from the overridden event). It would be more correct to copy them from
// the specific accessor that this method is overriding (as in SourceMemberMethodSymbol).
if (_lazyReturnType.IsDefault)
{
CSharpCompilation compilation = this.DeclaringCompilation;
Debug.Assert(compilation != null);
// NOTE: LazyMethodChecks calls us within a lock, so we use regular assignments,
// rather than Interlocked.CompareExchange.
if (_event.IsWindowsRuntimeEvent)
{
TypeSymbol eventTokenType = compilation.GetWellKnownType(WellKnownType.System_Runtime_InteropServices_WindowsRuntime_EventRegistrationToken);
Binder.ReportUseSite(eventTokenType, diagnostics, this.Location);
if (this.MethodKind == MethodKind.EventAdd)
{
// EventRegistrationToken add_E(EventDelegate d);
// Leave the returns void bit in this.flags false.
_lazyReturnType = TypeWithAnnotations.Create(eventTokenType);
var parameter = new SynthesizedAccessorValueParameterSymbol(this, _event.TypeWithAnnotations, 0);
_lazyParameters = ImmutableArray.Create<ParameterSymbol>(parameter);
}
else
{
Debug.Assert(this.MethodKind == MethodKind.EventRemove);
// void remove_E(EventRegistrationToken t);
TypeSymbol voidType = compilation.GetSpecialType(SpecialType.System_Void);
Binder.ReportUseSite(voidType, diagnostics, this.Location);
_lazyReturnType = TypeWithAnnotations.Create(voidType);
this.SetReturnsVoid(returnsVoid: true);
var parameter = new SynthesizedAccessorValueParameterSymbol(this, TypeWithAnnotations.Create(eventTokenType), 0);
_lazyParameters = ImmutableArray.Create<ParameterSymbol>(parameter);
}
}
else
{
// void add_E(EventDelegate d);
// void remove_E(EventDelegate d);
TypeSymbol voidType = compilation.GetSpecialType(SpecialType.System_Void);
Binder.ReportUseSite(voidType, diagnostics, this.Location);
_lazyReturnType = TypeWithAnnotations.Create(voidType);
this.SetReturnsVoid(returnsVoid: true);
var parameter = new SynthesizedAccessorValueParameterSymbol(this, _event.TypeWithAnnotations, 0);
_lazyParameters = ImmutableArray.Create<ParameterSymbol>(parameter);
}
}
}
public sealed override bool ReturnsVoid
{
get
{
LazyMethodChecks();
Debug.Assert(!_lazyReturnType.IsDefault);
return base.ReturnsVoid;
}
}
public override RefKind RefKind
{
get { return RefKind.None; }
}
public sealed override TypeWithAnnotations ReturnTypeWithAnnotations
{
get
{
LazyMethodChecks();
Debug.Assert(!_lazyReturnType.IsDefault);
return _lazyReturnType;
}
}
public sealed override ImmutableArray<CustomModifier> RefCustomModifiers
{
get
{
return ImmutableArray<CustomModifier>.Empty; // Same as base, but this is clear and explicit.
}
}
public sealed override ImmutableArray<ParameterSymbol> Parameters
{
get
{
LazyMethodChecks();
Debug.Assert(!_lazyParameters.IsDefault);
return _lazyParameters;
}
}
public sealed override bool IsVararg
{
get { return false; }
}
public sealed override ImmutableArray<TypeParameterSymbol> TypeParameters
{
get { return ImmutableArray<TypeParameterSymbol>.Empty; }
}
public sealed override ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes()
=> ImmutableArray<ImmutableArray<TypeWithAnnotations>>.Empty;
public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
=> ImmutableArray<TypeParameterConstraintKind>.Empty;
internal Location Location
{
get
{
Debug.Assert(this.Locations.Length == 1);
return this.Locations[0];
}
}
protected string GetOverriddenAccessorName(SourceEventSymbol @event, bool isAdder)
{
if (this.IsOverride)
{
// NOTE: What we'd really like to do is ask for the OverriddenMethod of this symbol.
// Unfortunately, we can't do that, because it would inspect the signature of this
// method, which depends on whether @event is a WinRT event, which depends on
// interface implementation, which we can't check during construction of the
// member list of the type containing this accessor (infinite recursion). Instead,
// we inline part of the implementation of OverriddenMethod - we look for the
// overridden event (which does not depend on WinRT-ness) and then grab the corresponding
// accessor.
EventSymbol overriddenEvent = @event.OverriddenEvent;
if ((object)overriddenEvent != null)
{
// If this accessor is overriding an accessor from metadata, it is possible that
// the name of the overridden accessor doesn't follow the C# add_X/remove_X pattern.
// We should copy the name so that the runtime will recognize this as an override.
MethodSymbol overriddenAccessor = overriddenEvent.GetOwnOrInheritedAccessor(isAdder);
return (object)overriddenAccessor == null ? null : overriddenAccessor.Name;
}
}
return null;
}
internal override bool IsExpressionBodied
{
// Events cannot be expression-bodied
get { return false; }
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs | // <auto-generated />
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.Syntax.InternalSyntax;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
{
/// <summary>Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class NameSyntax : TypeSyntax
{
internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal NameSyntax(SyntaxKind kind)
: base(kind)
{
}
protected NameSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class SimpleNameSyntax : NameSyntax
{
internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal SimpleNameSyntax(SyntaxKind kind)
: base(kind)
{
}
protected SimpleNameSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>SyntaxToken representing the identifier of the simple name.</summary>
public abstract SyntaxToken Identifier { get; }
}
/// <summary>Class which represents the syntax node for identifier name.</summary>
internal sealed partial class IdentifierNameSyntax : SimpleNameSyntax
{
internal readonly SyntaxToken identifier;
internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
/// <summary>SyntaxToken representing the keyword for the kind of the identifier name.</summary>
public override SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.identifier : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IdentifierNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIdentifierName(this);
public IdentifierNameSyntax Update(SyntaxToken identifier)
{
if (identifier != this.Identifier)
{
var newNode = SyntaxFactory.IdentifierName(identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IdentifierNameSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IdentifierNameSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations);
internal IdentifierNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
}
static IdentifierNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IdentifierNameSyntax), r => new IdentifierNameSyntax(r));
}
}
/// <summary>Class which represents the syntax node for qualified name.</summary>
internal sealed partial class QualifiedNameSyntax : NameSyntax
{
internal readonly NameSyntax left;
internal readonly SyntaxToken dotToken;
internal readonly SimpleNameSyntax right;
internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
/// <summary>NameSyntax node representing the name on the left side of the dot token of the qualified name.</summary>
public NameSyntax Left => this.left;
/// <summary>SyntaxToken representing the dot.</summary>
public SyntaxToken DotToken => this.dotToken;
/// <summary>SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name.</summary>
public SimpleNameSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.dotToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQualifiedName(this);
public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
{
if (left != this.Left || dotToken != this.DotToken || right != this.Right)
{
var newNode = SyntaxFactory.QualifiedName(left, dotToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, GetDiagnostics(), annotations);
internal QualifiedNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var dotToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
var right = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.dotToken);
writer.WriteValue(this.right);
}
static QualifiedNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QualifiedNameSyntax), r => new QualifiedNameSyntax(r));
}
}
/// <summary>Class which represents the syntax node for generic name.</summary>
internal sealed partial class GenericNameSyntax : SimpleNameSyntax
{
internal readonly SyntaxToken identifier;
internal readonly TypeArgumentListSyntax typeArgumentList;
internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
/// <summary>SyntaxToken representing the name of the identifier of the generic name.</summary>
public override SyntaxToken Identifier => this.identifier;
/// <summary>TypeArgumentListSyntax node representing the list of type arguments of the generic name.</summary>
public TypeArgumentListSyntax TypeArgumentList => this.typeArgumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.identifier,
1 => this.typeArgumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GenericNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGenericName(this);
public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
{
if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList)
{
var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, GetDiagnostics(), annotations);
internal GenericNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeArgumentList = (TypeArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeArgumentList);
}
static GenericNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GenericNameSyntax), r => new GenericNameSyntax(r));
}
}
/// <summary>Class which represents the syntax node for type argument list.</summary>
internal sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken greaterThanToken;
internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
/// <summary>SyntaxToken representing less than.</summary>
public SyntaxToken LessThanToken => this.lessThanToken;
/// <summary>SeparatedSyntaxList of TypeSyntax node representing the type arguments.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing greater than.</summary>
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.arguments,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeArgumentList(this);
public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, GetDiagnostics(), annotations);
internal TypeArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.greaterThanToken);
}
static TypeArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeArgumentListSyntax), r => new TypeArgumentListSyntax(r));
}
}
/// <summary>Class which represents the syntax node for alias qualified name.</summary>
internal sealed partial class AliasQualifiedNameSyntax : NameSyntax
{
internal readonly IdentifierNameSyntax alias;
internal readonly SyntaxToken colonColonToken;
internal readonly SimpleNameSyntax name;
internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
this.AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
this.AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
this.AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>IdentifierNameSyntax node representing the name of the alias</summary>
public IdentifierNameSyntax Alias => this.alias;
/// <summary>SyntaxToken representing colon colon.</summary>
public SyntaxToken ColonColonToken => this.colonColonToken;
/// <summary>SimpleNameSyntax node representing the name that is being alias qualified.</summary>
public SimpleNameSyntax Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.alias,
1 => this.colonColonToken,
2 => this.name,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AliasQualifiedNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAliasQualifiedName(this);
public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
{
if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name)
{
var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, GetDiagnostics(), annotations);
internal AliasQualifiedNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var alias = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(alias);
this.alias = alias;
var colonColonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
var name = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.alias);
writer.WriteValue(this.colonColonToken);
writer.WriteValue(this.name);
}
static AliasQualifiedNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AliasQualifiedNameSyntax), r => new AliasQualifiedNameSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class TypeSyntax : ExpressionSyntax
{
internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal TypeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected TypeSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Class which represents the syntax node for predefined types.</summary>
internal sealed partial class PredefinedTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken keyword;
internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
/// <summary>SyntaxToken which represents the keyword corresponding to the predefined type.</summary>
public SyntaxToken Keyword => this.keyword;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.keyword : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PredefinedTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPredefinedType(this);
public PredefinedTypeSyntax Update(SyntaxToken keyword)
{
if (keyword != this.Keyword)
{
var newNode = SyntaxFactory.PredefinedType(keyword);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PredefinedTypeSyntax(this.Kind, this.keyword, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PredefinedTypeSyntax(this.Kind, this.keyword, GetDiagnostics(), annotations);
internal PredefinedTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
}
static PredefinedTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PredefinedTypeSyntax), r => new PredefinedTypeSyntax(r));
}
}
/// <summary>Class which represents the syntax node for the array type.</summary>
internal sealed partial class ArrayTypeSyntax : TypeSyntax
{
internal readonly TypeSyntax elementType;
internal readonly GreenNode? rankSpecifiers;
internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
if (rankSpecifiers != null)
{
this.AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
if (rankSpecifiers != null)
{
this.AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
if (rankSpecifiers != null)
{
this.AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
/// <summary>TypeSyntax node representing the type of the element of the array.</summary>
public TypeSyntax ElementType => this.elementType;
/// <summary>SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> RankSpecifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax>(this.rankSpecifiers);
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elementType,
1 => this.rankSpecifiers,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrayType(this);
public ArrayTypeSyntax Update(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers)
{
if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers)
{
var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, GetDiagnostics(), annotations);
internal ArrayTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elementType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
var rankSpecifiers = (GreenNode?)reader.ReadValue();
if (rankSpecifiers != null)
{
AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elementType);
writer.WriteValue(this.rankSpecifiers);
}
static ArrayTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrayTypeSyntax), r => new ArrayTypeSyntax(r));
}
}
internal sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? sizes;
internal readonly SyntaxToken closeBracketToken;
internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (sizes != null)
{
this.AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (sizes != null)
{
this.AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (sizes != null)
{
this.AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
public SyntaxToken OpenBracketToken => this.openBracketToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Sizes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.sizes));
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.sizes,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayRankSpecifierSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrayRankSpecifier(this);
public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> sizes, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, GetDiagnostics(), annotations);
internal ArrayRankSpecifierSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var sizes = (GreenNode?)reader.ReadValue();
if (sizes != null)
{
AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.sizes);
writer.WriteValue(this.closeBracketToken);
}
static ArrayRankSpecifierSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrayRankSpecifierSyntax), r => new ArrayRankSpecifierSyntax(r));
}
}
/// <summary>Class which represents the syntax node for pointer type.</summary>
internal sealed partial class PointerTypeSyntax : TypeSyntax
{
internal readonly TypeSyntax elementType;
internal readonly SyntaxToken asteriskToken;
internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
/// <summary>TypeSyntax node that represents the element type of the pointer.</summary>
public TypeSyntax ElementType => this.elementType;
/// <summary>SyntaxToken representing the asterisk.</summary>
public SyntaxToken AsteriskToken => this.asteriskToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elementType,
1 => this.asteriskToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PointerTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPointerType(this);
public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken)
{
if (elementType != this.ElementType || asteriskToken != this.AsteriskToken)
{
var newNode = SyntaxFactory.PointerType(elementType, asteriskToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, GetDiagnostics(), annotations);
internal PointerTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elementType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
var asteriskToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elementType);
writer.WriteValue(this.asteriskToken);
}
static PointerTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PointerTypeSyntax), r => new PointerTypeSyntax(r));
}
}
internal sealed partial class FunctionPointerTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken delegateKeyword;
internal readonly SyntaxToken asteriskToken;
internal readonly FunctionPointerCallingConventionSyntax? callingConvention;
internal readonly FunctionPointerParameterListSyntax parameterList;
internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
if (callingConvention != null)
{
this.AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
if (callingConvention != null)
{
this.AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
if (callingConvention != null)
{
this.AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
/// <summary>SyntaxToken representing the delegate keyword.</summary>
public SyntaxToken DelegateKeyword => this.delegateKeyword;
/// <summary>SyntaxToken representing the asterisk.</summary>
public SyntaxToken AsteriskToken => this.asteriskToken;
/// <summary>Node representing the optional calling convention.</summary>
public FunctionPointerCallingConventionSyntax? CallingConvention => this.callingConvention;
/// <summary>List of the parameter types and return type of the function pointer.</summary>
public FunctionPointerParameterListSyntax ParameterList => this.parameterList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.delegateKeyword,
1 => this.asteriskToken,
2 => this.callingConvention,
3 => this.parameterList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerType(this);
public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax callingConvention, FunctionPointerParameterListSyntax parameterList)
{
if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList)
{
var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, GetDiagnostics(), annotations);
internal FunctionPointerTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var delegateKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
var asteriskToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
var callingConvention = (FunctionPointerCallingConventionSyntax?)reader.ReadValue();
if (callingConvention != null)
{
AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
var parameterList = (FunctionPointerParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.delegateKeyword);
writer.WriteValue(this.asteriskToken);
writer.WriteValue(this.callingConvention);
writer.WriteValue(this.parameterList);
}
static FunctionPointerTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerTypeSyntax), r => new FunctionPointerTypeSyntax(r));
}
}
/// <summary>Function pointer parameter list syntax.</summary>
internal sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken greaterThanToken;
internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
/// <summary>SyntaxToken representing the less than token.</summary>
public SyntaxToken LessThanToken => this.lessThanToken;
/// <summary>SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>SyntaxToken representing the greater than token.</summary>
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.parameters,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerParameterList(this);
public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations);
internal FunctionPointerParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.greaterThanToken);
}
static FunctionPointerParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterListSyntax), r => new FunctionPointerParameterListSyntax(r));
}
}
/// <summary>Function pointer calling convention syntax.</summary>
internal sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken managedOrUnmanagedKeyword;
internal readonly FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList;
internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
if (unmanagedCallingConventionList != null)
{
this.AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
if (unmanagedCallingConventionList != null)
{
this.AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
if (unmanagedCallingConventionList != null)
{
this.AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
/// <summary>SyntaxToken representing whether the calling convention is managed or unmanaged.</summary>
public SyntaxToken ManagedOrUnmanagedKeyword => this.managedOrUnmanagedKeyword;
/// <summary>Optional list of identifiers that will contribute to an unmanaged calling convention.</summary>
public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => this.unmanagedCallingConventionList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.managedOrUnmanagedKeyword,
1 => this.unmanagedCallingConventionList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerCallingConventionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerCallingConvention(this);
public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax unmanagedCallingConventionList)
{
if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList)
{
var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, GetDiagnostics(), annotations);
internal FunctionPointerCallingConventionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var managedOrUnmanagedKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
var unmanagedCallingConventionList = (FunctionPointerUnmanagedCallingConventionListSyntax?)reader.ReadValue();
if (unmanagedCallingConventionList != null)
{
AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.managedOrUnmanagedKeyword);
writer.WriteValue(this.unmanagedCallingConventionList);
}
static FunctionPointerCallingConventionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerCallingConventionSyntax), r => new FunctionPointerCallingConventionSyntax(r));
}
}
/// <summary>Function pointer calling convention syntax.</summary>
internal sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? callingConventions;
internal readonly SyntaxToken closeBracketToken;
internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (callingConventions != null)
{
this.AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (callingConventions != null)
{
this.AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (callingConventions != null)
{
this.AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>SyntaxToken representing open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SeparatedSyntaxList of calling convention identifiers.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> CallingConventions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.callingConventions));
/// <summary>SyntaxToken representing close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.callingConventions,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this);
public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> callingConventions, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, GetDiagnostics(), annotations);
internal FunctionPointerUnmanagedCallingConventionListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var callingConventions = (GreenNode?)reader.ReadValue();
if (callingConventions != null)
{
AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.callingConventions);
writer.WriteValue(this.closeBracketToken);
}
static FunctionPointerUnmanagedCallingConventionListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionListSyntax), r => new FunctionPointerUnmanagedCallingConventionListSyntax(r));
}
}
/// <summary>Individual function pointer unmanaged calling convention.</summary>
internal sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken name;
internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>SyntaxToken representing the calling convention identifier.</summary>
public SyntaxToken Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.name : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this);
public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name)
{
if (name != this.Name)
{
var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, GetDiagnostics(), annotations);
internal FunctionPointerUnmanagedCallingConventionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var name = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
}
static FunctionPointerUnmanagedCallingConventionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionSyntax), r => new FunctionPointerUnmanagedCallingConventionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a nullable type.</summary>
internal sealed partial class NullableTypeSyntax : TypeSyntax
{
internal readonly TypeSyntax elementType;
internal readonly SyntaxToken questionToken;
internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
/// <summary>TypeSyntax node representing the type of the element.</summary>
public TypeSyntax ElementType => this.elementType;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken QuestionToken => this.questionToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elementType,
1 => this.questionToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNullableType(this);
public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken)
{
if (elementType != this.ElementType || questionToken != this.QuestionToken)
{
var newNode = SyntaxFactory.NullableType(elementType, questionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, GetDiagnostics(), annotations);
internal NullableTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elementType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
var questionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elementType);
writer.WriteValue(this.questionToken);
}
static NullableTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NullableTypeSyntax), r => new NullableTypeSyntax(r));
}
}
/// <summary>Class which represents the syntax node for tuple type.</summary>
internal sealed partial class TupleTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? elements;
internal readonly SyntaxToken closeParenToken;
internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (elements != null)
{
this.AdjustFlagsAndWidth(elements);
this.elements = elements;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (elements != null)
{
this.AdjustFlagsAndWidth(elements);
this.elements = elements;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (elements != null)
{
this.AdjustFlagsAndWidth(elements);
this.elements = elements;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> Elements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.elements));
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.elements,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTupleType(this);
public TupleTypeSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> elements, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, GetDiagnostics(), annotations);
internal TupleTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var elements = (GreenNode?)reader.ReadValue();
if (elements != null)
{
AdjustFlagsAndWidth(elements);
this.elements = elements;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.elements);
writer.WriteValue(this.closeParenToken);
}
static TupleTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TupleTypeSyntax), r => new TupleTypeSyntax(r));
}
}
/// <summary>Tuple type element.</summary>
internal sealed partial class TupleElementSyntax : CSharpSyntaxNode
{
internal readonly TypeSyntax type;
internal readonly SyntaxToken? identifier;
internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
/// <summary>Gets the type of the tuple element.</summary>
public TypeSyntax Type => this.type;
/// <summary>Gets the name of the tuple element.</summary>
public SyntaxToken? Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.identifier,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleElementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTupleElement(this);
public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier)
{
if (type != this.Type || identifier != this.Identifier)
{
var newNode = SyntaxFactory.TupleElement(type, identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TupleElementSyntax(this.Kind, this.type, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TupleElementSyntax(this.Kind, this.type, this.identifier, GetDiagnostics(), annotations);
internal TupleElementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var identifier = (SyntaxToken?)reader.ReadValue();
if (identifier != null)
{
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
}
static TupleElementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TupleElementSyntax), r => new TupleElementSyntax(r));
}
}
/// <summary>Class which represents a placeholder in the type argument list of an unbound generic type.</summary>
internal sealed partial class OmittedTypeArgumentSyntax : TypeSyntax
{
internal readonly SyntaxToken omittedTypeArgumentToken;
internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
/// <summary>SyntaxToken representing the omitted type argument.</summary>
public SyntaxToken OmittedTypeArgumentToken => this.omittedTypeArgumentToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.omittedTypeArgumentToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedTypeArgumentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOmittedTypeArgument(this);
public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken)
{
if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken)
{
var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, GetDiagnostics(), annotations);
internal OmittedTypeArgumentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var omittedTypeArgumentToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.omittedTypeArgumentToken);
}
static OmittedTypeArgumentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OmittedTypeArgumentSyntax), r => new OmittedTypeArgumentSyntax(r));
}
}
/// <summary>The ref modifier of a method's return value or a local.</summary>
internal sealed partial class RefTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken refKeyword;
internal readonly SyntaxToken? readOnlyKeyword;
internal readonly TypeSyntax type;
internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
if (readOnlyKeyword != null)
{
this.AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
if (readOnlyKeyword != null)
{
this.AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
if (readOnlyKeyword != null)
{
this.AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public SyntaxToken RefKeyword => this.refKeyword;
/// <summary>Gets the optional "readonly" keyword.</summary>
public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword;
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.refKeyword,
1 => this.readOnlyKeyword,
2 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefType(this);
public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type)
{
if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type)
{
var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations);
internal RefTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var refKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
var readOnlyKeyword = (SyntaxToken?)reader.ReadValue();
if (readOnlyKeyword != null)
{
AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.refKeyword);
writer.WriteValue(this.readOnlyKeyword);
writer.WriteValue(this.type);
}
static RefTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefTypeSyntax), r => new RefTypeSyntax(r));
}
}
internal abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode
{
internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal ExpressionOrPatternSyntax(SyntaxKind kind)
: base(kind)
{
}
protected ExpressionOrPatternSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax
{
internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal ExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected ExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Class which represents the syntax node for parenthesized expression.</summary>
internal sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>ExpressionSyntax node representing the expression enclosed within the parenthesis.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.expression,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedExpression(this);
public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal ParenthesizedExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static ParenthesizedExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedExpressionSyntax), r => new ParenthesizedExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for tuple expression.</summary>
internal sealed partial class TupleExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeParenToken;
internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>SeparatedSyntaxList of ArgumentSyntax representing the list of arguments.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.arguments,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTupleExpression(this);
public TupleExpressionSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations);
internal TupleExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeParenToken);
}
static TupleExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TupleExpressionSyntax), r => new TupleExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for prefix unary expression.</summary>
internal sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax operand;
internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
}
internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
}
internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
}
/// <summary>SyntaxToken representing the kind of the operator of the prefix unary expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax representing the operand of the prefix unary expression.</summary>
public ExpressionSyntax Operand => this.operand;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.operand,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrefixUnaryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPrefixUnaryExpression(this);
public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand)
{
if (operatorToken != this.OperatorToken || operand != this.Operand)
{
var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind, operatorToken, operand);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, GetDiagnostics(), annotations);
internal PrefixUnaryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var operand = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(operand);
this.operand = operand;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.operand);
}
static PrefixUnaryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PrefixUnaryExpressionSyntax), r => new PrefixUnaryExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for an "await" expression.</summary>
internal sealed partial class AwaitExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken awaitKeyword;
internal readonly ExpressionSyntax expression;
internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>SyntaxToken representing the kind "await" keyword.</summary>
public SyntaxToken AwaitKeyword => this.awaitKeyword;
/// <summary>ExpressionSyntax representing the operand of the "await" operator.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.awaitKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AwaitExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAwaitExpression(this);
public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression)
{
if (awaitKeyword != this.AwaitKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, GetDiagnostics(), annotations);
internal AwaitExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var awaitKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.expression);
}
static AwaitExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AwaitExpressionSyntax), r => new AwaitExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for postfix unary expression.</summary>
internal sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax operand;
internal readonly SyntaxToken operatorToken;
internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
/// <summary>ExpressionSyntax representing the operand of the postfix unary expression.</summary>
public ExpressionSyntax Operand => this.operand;
/// <summary>SyntaxToken representing the kind of the operator of the postfix unary expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operand,
1 => this.operatorToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PostfixUnaryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPostfixUnaryExpression(this);
public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken)
{
if (operand != this.Operand || operatorToken != this.OperatorToken)
{
var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind, operand, operatorToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, GetDiagnostics(), annotations);
internal PostfixUnaryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operand = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(operand);
this.operand = operand;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operand);
writer.WriteValue(this.operatorToken);
}
static PostfixUnaryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PostfixUnaryExpressionSyntax), r => new PostfixUnaryExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for member access expression.</summary>
internal sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken operatorToken;
internal readonly SimpleNameSyntax name;
internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>ExpressionSyntax node representing the object that the member belongs to.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing the kind of the operator in the member access expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>SimpleNameSyntax node representing the member being accessed.</summary>
public SimpleNameSyntax Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.operatorToken,
2 => this.name,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberAccessExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMemberAccessExpression(this);
public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
{
if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name)
{
var newNode = SyntaxFactory.MemberAccessExpression(this.Kind, expression, operatorToken, name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, GetDiagnostics(), annotations);
internal MemberAccessExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var name = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.name);
}
static MemberAccessExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MemberAccessExpressionSyntax), r => new MemberAccessExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for conditional access expression.</summary>
internal sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax whenNotNull;
internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
/// <summary>ExpressionSyntax node representing the object conditionally accessed.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the access expression to be executed when the object is not null.</summary>
public ExpressionSyntax WhenNotNull => this.whenNotNull;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.operatorToken,
2 => this.whenNotNull,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalAccessExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConditionalAccessExpression(this);
public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
{
if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull)
{
var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, GetDiagnostics(), annotations);
internal ConditionalAccessExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var whenNotNull = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.whenNotNull);
}
static ConditionalAccessExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConditionalAccessExpressionSyntax), r => new ConditionalAccessExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for member binding expression.</summary>
internal sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly SimpleNameSyntax name;
internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>SyntaxToken representing dot.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>SimpleNameSyntax node representing the member being bound to.</summary>
public SimpleNameSyntax Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.name,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberBindingExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMemberBindingExpression(this);
public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name)
{
if (operatorToken != this.OperatorToken || name != this.Name)
{
var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, GetDiagnostics(), annotations);
internal MemberBindingExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var name = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.name);
}
static MemberBindingExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MemberBindingExpressionSyntax), r => new MemberBindingExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for element binding expression.</summary>
internal sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax
{
internal readonly BracketedArgumentListSyntax argumentList;
internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>BracketedArgumentListSyntax node representing the list of arguments of the element binding expression.</summary>
public BracketedArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.argumentList : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementBindingExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElementBindingExpression(this);
public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList)
{
if (argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ElementBindingExpression(argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElementBindingExpressionSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElementBindingExpressionSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations);
internal ElementBindingExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var argumentList = (BracketedArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.argumentList);
}
static ElementBindingExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElementBindingExpressionSyntax), r => new ElementBindingExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a range expression.</summary>
internal sealed partial class RangeExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax? leftOperand;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax? rightOperand;
internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (leftOperand != null)
{
this.AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (rightOperand != null)
{
this.AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (leftOperand != null)
{
this.AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (rightOperand != null)
{
this.AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand)
: base(kind)
{
this.SlotCount = 3;
if (leftOperand != null)
{
this.AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (rightOperand != null)
{
this.AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
/// <summary>ExpressionSyntax node representing the expression on the left of the range operator.</summary>
public ExpressionSyntax? LeftOperand => this.leftOperand;
/// <summary>SyntaxToken representing the operator of the range expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the expression on the right of the range operator.</summary>
public ExpressionSyntax? RightOperand => this.rightOperand;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.leftOperand,
1 => this.operatorToken,
2 => this.rightOperand,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RangeExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRangeExpression(this);
public RangeExpressionSyntax Update(ExpressionSyntax leftOperand, SyntaxToken operatorToken, ExpressionSyntax rightOperand)
{
if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand)
{
var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, GetDiagnostics(), annotations);
internal RangeExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var leftOperand = (ExpressionSyntax?)reader.ReadValue();
if (leftOperand != null)
{
AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var rightOperand = (ExpressionSyntax?)reader.ReadValue();
if (rightOperand != null)
{
AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.leftOperand);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.rightOperand);
}
static RangeExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RangeExpressionSyntax), r => new RangeExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for implicit element access expression.</summary>
internal sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax
{
internal readonly BracketedArgumentListSyntax argumentList;
internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression.</summary>
public BracketedArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.argumentList : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitElementAccessSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitElementAccess(this);
public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList)
{
if (argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ImplicitElementAccess(argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitElementAccessSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitElementAccessSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations);
internal ImplicitElementAccessSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var argumentList = (BracketedArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.argumentList);
}
static ImplicitElementAccessSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitElementAccessSyntax), r => new ImplicitElementAccessSyntax(r));
}
}
/// <summary>Class which represents an expression that has a binary operator.</summary>
internal sealed partial class BinaryExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax left;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax right;
internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
/// <summary>ExpressionSyntax node representing the expression on the left of the binary operator.</summary>
public ExpressionSyntax Left => this.left;
/// <summary>SyntaxToken representing the operator of the binary expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the expression on the right of the binary operator.</summary>
public ExpressionSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.operatorToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBinaryExpression(this);
public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right)
{
var newNode = SyntaxFactory.BinaryExpression(this.Kind, left, operatorToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations);
internal BinaryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var right = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.right);
}
static BinaryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BinaryExpressionSyntax), r => new BinaryExpressionSyntax(r));
}
}
/// <summary>Class which represents an expression that has an assignment operator.</summary>
internal sealed partial class AssignmentExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax left;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax right;
internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
/// <summary>ExpressionSyntax node representing the expression on the left of the assignment operator.</summary>
public ExpressionSyntax Left => this.left;
/// <summary>SyntaxToken representing the operator of the assignment expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the expression on the right of the assignment operator.</summary>
public ExpressionSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.operatorToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AssignmentExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAssignmentExpression(this);
public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right)
{
var newNode = SyntaxFactory.AssignmentExpression(this.Kind, left, operatorToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations);
internal AssignmentExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var right = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.right);
}
static AssignmentExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AssignmentExpressionSyntax), r => new AssignmentExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for conditional expression.</summary>
internal sealed partial class ConditionalExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken questionToken;
internal readonly ExpressionSyntax whenTrue;
internal readonly SyntaxToken colonToken;
internal readonly ExpressionSyntax whenFalse;
internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
this.AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
this.AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
this.AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
/// <summary>ExpressionSyntax node representing the condition of the conditional expression.</summary>
public ExpressionSyntax Condition => this.condition;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken QuestionToken => this.questionToken;
/// <summary>ExpressionSyntax node representing the expression to be executed when the condition is true.</summary>
public ExpressionSyntax WhenTrue => this.whenTrue;
/// <summary>SyntaxToken representing the colon.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>ExpressionSyntax node representing the expression to be executed when the condition is false.</summary>
public ExpressionSyntax WhenFalse => this.whenFalse;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.condition,
1 => this.questionToken,
2 => this.whenTrue,
3 => this.colonToken,
4 => this.whenFalse,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConditionalExpression(this);
public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
{
if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse)
{
var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, GetDiagnostics(), annotations);
internal ConditionalExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var questionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
var whenTrue = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var whenFalse = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.condition);
writer.WriteValue(this.questionToken);
writer.WriteValue(this.whenTrue);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.whenFalse);
}
static ConditionalExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConditionalExpressionSyntax), r => new ConditionalExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class InstanceExpressionSyntax : ExpressionSyntax
{
internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal InstanceExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected InstanceExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Class which represents the syntax node for a this expression.</summary>
internal sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax
{
internal readonly SyntaxToken token;
internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
/// <summary>SyntaxToken representing the this keyword.</summary>
public SyntaxToken Token => this.token;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.token : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThisExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitThisExpression(this);
public ThisExpressionSyntax Update(SyntaxToken token)
{
if (token != this.Token)
{
var newNode = SyntaxFactory.ThisExpression(token);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ThisExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ThisExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations);
internal ThisExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var token = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(token);
this.token = token;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.token);
}
static ThisExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ThisExpressionSyntax), r => new ThisExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a base expression.</summary>
internal sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax
{
internal readonly SyntaxToken token;
internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
/// <summary>SyntaxToken representing the base keyword.</summary>
public SyntaxToken Token => this.token;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.token : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBaseExpression(this);
public BaseExpressionSyntax Update(SyntaxToken token)
{
if (token != this.Token)
{
var newNode = SyntaxFactory.BaseExpression(token);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BaseExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BaseExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations);
internal BaseExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var token = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(token);
this.token = token;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.token);
}
static BaseExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BaseExpressionSyntax), r => new BaseExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a literal expression.</summary>
internal sealed partial class LiteralExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken token;
internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
/// <summary>SyntaxToken representing the keyword corresponding to the kind of the literal expression.</summary>
public SyntaxToken Token => this.token;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.token : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LiteralExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLiteralExpression(this);
public LiteralExpressionSyntax Update(SyntaxToken token)
{
if (token != this.Token)
{
var newNode = SyntaxFactory.LiteralExpression(this.Kind, token);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LiteralExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LiteralExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations);
internal LiteralExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var token = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(token);
this.token = token;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.token);
}
static LiteralExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LiteralExpressionSyntax), r => new LiteralExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for MakeRef expression.</summary>
internal sealed partial class MakeRefExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the MakeRefKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MakeRefExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMakeRefExpression(this);
public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal MakeRefExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static MakeRefExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MakeRefExpressionSyntax), r => new MakeRefExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for RefType expression.</summary>
internal sealed partial class RefTypeExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the RefTypeKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefTypeExpression(this);
public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal RefTypeExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static RefTypeExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefTypeExpressionSyntax), r => new RefTypeExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for RefValue expression.</summary>
internal sealed partial class RefValueExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken comma;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(comma);
this.comma = comma;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(comma);
this.comma = comma;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(comma);
this.comma = comma;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the RefValueKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Typed reference expression.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>Comma separating the arguments.</summary>
public SyntaxToken Comma => this.comma;
/// <summary>The type of the value.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.comma,
4 => this.type,
5 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefValueExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefValueExpression(this);
public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal RefValueExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var comma = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(comma);
this.comma = comma;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.comma);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static RefValueExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefValueExpressionSyntax), r => new RefValueExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for Checked or Unchecked expression.</summary>
internal sealed partial class CheckedExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the checked or unchecked keyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCheckedExpression(this);
public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CheckedExpression(this.Kind, keyword, openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal CheckedExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static CheckedExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CheckedExpressionSyntax), r => new CheckedExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for Default expression.</summary>
internal sealed partial class DefaultExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the DefaultKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.type,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefaultExpression(this);
public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal DefaultExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static DefaultExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefaultExpressionSyntax), r => new DefaultExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for TypeOf expression.</summary>
internal sealed partial class TypeOfExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the TypeOfKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>The expression to return type of.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.type,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeOfExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeOfExpression(this);
public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal TypeOfExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static TypeOfExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeOfExpressionSyntax), r => new TypeOfExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for SizeOf expression.</summary>
internal sealed partial class SizeOfExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the SizeOfKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.type,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SizeOfExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSizeOfExpression(this);
public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal SizeOfExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static SizeOfExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SizeOfExpressionSyntax), r => new SizeOfExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for invocation expression.</summary>
internal sealed partial class InvocationExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly ArgumentListSyntax argumentList;
internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>ExpressionSyntax node representing the expression part of the invocation.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>ArgumentListSyntax node representing the list of arguments of the invocation expression.</summary>
public ArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InvocationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInvocationExpression(this);
public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList)
{
if (expression != this.Expression || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.InvocationExpression(expression, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations);
internal InvocationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.argumentList);
}
static InvocationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InvocationExpressionSyntax), r => new InvocationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for element access expression.</summary>
internal sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly BracketedArgumentListSyntax argumentList;
internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>ExpressionSyntax node representing the expression which is accessing the element.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>BracketedArgumentListSyntax node representing the list of arguments of the element access expression.</summary>
public BracketedArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementAccessExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElementAccessExpression(this);
public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
{
if (expression != this.Expression || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations);
internal ElementAccessExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var argumentList = (BracketedArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.argumentList);
}
static ElementAccessExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElementAccessExpressionSyntax), r => new ElementAccessExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode
{
internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseArgumentListSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseArgumentListSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments { get; }
}
/// <summary>Class which represents the syntax node for the list of arguments.</summary>
internal sealed partial class ArgumentListSyntax : BaseArgumentListSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeParenToken;
internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>SeparatedSyntaxList of ArgumentSyntax representing the list of arguments.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.arguments,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArgumentList(this);
public ArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations);
internal ArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeParenToken);
}
static ArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArgumentListSyntax), r => new ArgumentListSyntax(r));
}
}
/// <summary>Class which represents the syntax node for bracketed argument list.</summary>
internal sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeBracketToken;
internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>SyntaxToken representing open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SeparatedSyntaxList of ArgumentSyntax representing the list of arguments.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.arguments,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBracketedArgumentList(this);
public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, GetDiagnostics(), annotations);
internal BracketedArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeBracketToken);
}
static BracketedArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BracketedArgumentListSyntax), r => new BracketedArgumentListSyntax(r));
}
}
/// <summary>Class which represents the syntax node for argument.</summary>
internal sealed partial class ArgumentSyntax : CSharpSyntaxNode
{
internal readonly NameColonSyntax? nameColon;
internal readonly SyntaxToken? refKindKeyword;
internal readonly ExpressionSyntax expression;
internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 3;
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>NameColonSyntax node representing the optional name arguments.</summary>
public NameColonSyntax? NameColon => this.nameColon;
/// <summary>SyntaxToken representing the optional ref or out keyword.</summary>
public SyntaxToken? RefKindKeyword => this.refKindKeyword;
/// <summary>ExpressionSyntax node representing the argument.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.nameColon,
1 => this.refKindKeyword,
2 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArgument(this);
public ArgumentSyntax Update(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression)
{
if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, GetDiagnostics(), annotations);
internal ArgumentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var nameColon = (NameColonSyntax?)reader.ReadValue();
if (nameColon != null)
{
AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
var refKindKeyword = (SyntaxToken?)reader.ReadValue();
if (refKindKeyword != null)
{
AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.nameColon);
writer.WriteValue(this.refKindKeyword);
writer.WriteValue(this.expression);
}
static ArgumentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArgumentSyntax), r => new ArgumentSyntax(r));
}
}
internal abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode
{
internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseExpressionColonSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseExpressionColonSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract ExpressionSyntax Expression { get; }
public abstract SyntaxToken ColonToken { get; }
}
internal sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken colonToken;
internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
public override ExpressionSyntax Expression => this.expression;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionColonSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExpressionColon(this);
public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken)
{
if (expression != this.Expression || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.ExpressionColon(expression, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, GetDiagnostics(), annotations);
internal ExpressionColonSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.colonToken);
}
static ExpressionColonSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExpressionColonSyntax), r => new ExpressionColonSyntax(r));
}
}
/// <summary>Class which represents the syntax node for name colon syntax.</summary>
internal sealed partial class NameColonSyntax : BaseExpressionColonSyntax
{
internal readonly IdentifierNameSyntax name;
internal readonly SyntaxToken colonToken;
internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>IdentifierNameSyntax representing the identifier name.</summary>
public IdentifierNameSyntax Name => this.name;
/// <summary>SyntaxToken representing colon.</summary>
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameColonSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNameColon(this);
public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken)
{
if (name != this.Name || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.NameColon(name, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NameColonSyntax(this.Kind, this.name, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NameColonSyntax(this.Kind, this.name, this.colonToken, GetDiagnostics(), annotations);
internal NameColonSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.colonToken);
}
static NameColonSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NameColonSyntax), r => new NameColonSyntax(r));
}
}
/// <summary>Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration.</summary>
internal sealed partial class DeclarationExpressionSyntax : ExpressionSyntax
{
internal readonly TypeSyntax type;
internal readonly VariableDesignationSyntax designation;
internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
public TypeSyntax Type => this.type;
/// <summary>Declaration representing the variable declared in an out parameter or deconstruction.</summary>
public VariableDesignationSyntax Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDeclarationExpression(this);
public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation)
{
if (type != this.Type || designation != this.Designation)
{
var newNode = SyntaxFactory.DeclarationExpression(type, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations);
internal DeclarationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var designation = (VariableDesignationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.designation);
}
static DeclarationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DeclarationExpressionSyntax), r => new DeclarationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for cast expression.</summary>
internal sealed partial class CastExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal readonly ExpressionSyntax expression;
internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>TypeSyntax node representing the type to which the expression is being cast.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
/// <summary>ExpressionSyntax node representing the expression that is being casted.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.type,
2 => this.closeParenToken,
3 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CastExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCastExpression(this);
public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
{
if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression)
{
var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, GetDiagnostics(), annotations);
internal CastExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.expression);
}
static CastExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CastExpressionSyntax), r => new CastExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent anonymous function expressions are derived.</summary>
internal abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax
{
internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal AnonymousFunctionExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected AnonymousFunctionExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers { get; }
/// <summary>
/// BlockSyntax node representing the body of the anonymous function.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public abstract BlockSyntax? Block { get; }
/// <summary>
/// ExpressionSyntax node representing the body of the anonymous function.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public abstract ExpressionSyntax? ExpressionBody { get; }
}
/// <summary>Class which represents the syntax node for anonymous method expression.</summary>
internal sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax
{
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken delegateKeyword;
internal readonly ParameterListSyntax? parameterList;
internal readonly BlockSyntax block;
internal readonly ExpressionSyntax? expressionBody;
internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody)
: base(kind)
{
this.SlotCount = 5;
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>SyntaxToken representing the delegate keyword.</summary>
public SyntaxToken DelegateKeyword => this.delegateKeyword;
/// <summary>List of parameters of the anonymous method expression, or null if there no parameters are specified.</summary>
public ParameterListSyntax? ParameterList => this.parameterList;
/// <summary>
/// BlockSyntax node representing the body of the anonymous function.
/// This will never be null.
/// </summary>
public override BlockSyntax Block => this.block;
/// <summary>
/// Inherited from AnonymousFunctionExpressionSyntax, but not used for
/// AnonymousMethodExpressionSyntax. This will always be null.
/// </summary>
public override ExpressionSyntax? ExpressionBody => this.expressionBody;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.modifiers,
1 => this.delegateKeyword,
2 => this.parameterList,
3 => this.block,
4 => this.expressionBody,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousMethodExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAnonymousMethodExpression(this);
public AnonymousMethodExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody)
{
if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody)
{
var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, GetDiagnostics(), annotations);
internal AnonymousMethodExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var delegateKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
var parameterList = (ParameterListSyntax?)reader.ReadValue();
if (parameterList != null)
{
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
var expressionBody = (ExpressionSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.delegateKeyword);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.block);
writer.WriteValue(this.expressionBody);
}
static AnonymousMethodExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AnonymousMethodExpressionSyntax), r => new AnonymousMethodExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent lambda expressions are derived.</summary>
internal abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax
{
internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal LambdaExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected LambdaExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
/// <summary>SyntaxToken representing equals greater than.</summary>
public abstract SyntaxToken ArrowToken { get; }
}
/// <summary>Class which represents the syntax node for a simple lambda expression.</summary>
internal sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly ParameterSyntax parameter;
internal readonly SyntaxToken arrowToken;
internal readonly BlockSyntax? block;
internal readonly ExpressionSyntax? expressionBody;
internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>ParameterSyntax node representing the parameter of the lambda expression.</summary>
public ParameterSyntax Parameter => this.parameter;
/// <summary>SyntaxToken representing equals greater than.</summary>
public override SyntaxToken ArrowToken => this.arrowToken;
/// <summary>
/// BlockSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override BlockSyntax? Block => this.block;
/// <summary>
/// ExpressionSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override ExpressionSyntax? ExpressionBody => this.expressionBody;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.parameter,
3 => this.arrowToken,
4 => this.block,
5 => this.expressionBody,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleLambdaExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSimpleLambdaExpression(this);
public SimpleLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody)
{
var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations);
internal SimpleLambdaExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var parameter = (ParameterSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
var arrowToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
var block = (BlockSyntax?)reader.ReadValue();
if (block != null)
{
AdjustFlagsAndWidth(block);
this.block = block;
}
var expressionBody = (ExpressionSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.parameter);
writer.WriteValue(this.arrowToken);
writer.WriteValue(this.block);
writer.WriteValue(this.expressionBody);
}
static SimpleLambdaExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SimpleLambdaExpressionSyntax), r => new SimpleLambdaExpressionSyntax(r));
}
}
internal sealed partial class RefExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken refKeyword;
internal readonly ExpressionSyntax expression;
internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken RefKeyword => this.refKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.refKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefExpression(this);
public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression)
{
if (refKeyword != this.RefKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.RefExpression(refKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, GetDiagnostics(), annotations);
internal RefExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var refKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.refKeyword);
writer.WriteValue(this.expression);
}
static RefExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefExpressionSyntax), r => new RefExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for parenthesized lambda expression.</summary>
internal sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax? returnType;
internal readonly ParameterListSyntax parameterList;
internal readonly SyntaxToken arrowToken;
internal readonly BlockSyntax? block;
internal readonly ExpressionSyntax? expressionBody;
internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (returnType != null)
{
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (returnType != null)
{
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
: base(kind)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (returnType != null)
{
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public TypeSyntax? ReturnType => this.returnType;
/// <summary>ParameterListSyntax node representing the list of parameters for the lambda expression.</summary>
public ParameterListSyntax ParameterList => this.parameterList;
/// <summary>SyntaxToken representing equals greater than.</summary>
public override SyntaxToken ArrowToken => this.arrowToken;
/// <summary>
/// BlockSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override BlockSyntax? Block => this.block;
/// <summary>
/// ExpressionSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override ExpressionSyntax? ExpressionBody => this.expressionBody;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.parameterList,
4 => this.arrowToken,
5 => this.block,
6 => this.expressionBody,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedLambdaExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedLambdaExpression(this);
public ParenthesizedLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody)
{
var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations);
internal ParenthesizedLambdaExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 7;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax?)reader.ReadValue();
if (returnType != null)
{
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var arrowToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
var block = (BlockSyntax?)reader.ReadValue();
if (block != null)
{
AdjustFlagsAndWidth(block);
this.block = block;
}
var expressionBody = (ExpressionSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.arrowToken);
writer.WriteValue(this.block);
writer.WriteValue(this.expressionBody);
}
static ParenthesizedLambdaExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedLambdaExpressionSyntax), r => new ParenthesizedLambdaExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for initializer expression.</summary>
internal sealed partial class InitializerExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? expressions;
internal readonly SyntaxToken closeBraceToken;
internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (expressions != null)
{
this.AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (expressions != null)
{
this.AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (expressions != null)
{
this.AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
/// <summary>SyntaxToken representing the open brace.</summary>
public SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Expressions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.expressions));
/// <summary>SyntaxToken representing the close brace.</summary>
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.expressions,
2 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InitializerExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInitializerExpression(this);
public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.InitializerExpression(this.Kind, openBraceToken, expressions, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, GetDiagnostics(), annotations);
internal InitializerExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var expressions = (GreenNode?)reader.ReadValue();
if (expressions != null)
{
AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.expressions);
writer.WriteValue(this.closeBraceToken);
}
static InitializerExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InitializerExpressionSyntax), r => new InitializerExpressionSyntax(r));
}
}
internal abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax
{
internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseObjectCreationExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public abstract SyntaxToken NewKeyword { get; }
/// <summary>ArgumentListSyntax representing the list of arguments passed as part of the object creation expression.</summary>
public abstract ArgumentListSyntax? ArgumentList { get; }
/// <summary>InitializerExpressionSyntax representing the initializer expression for the object being created.</summary>
public abstract InitializerExpressionSyntax? Initializer { get; }
}
/// <summary>Class which represents the syntax node for implicit object creation expression.</summary>
internal sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly ArgumentListSyntax argumentList;
internal readonly InitializerExpressionSyntax? initializer;
internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public override SyntaxToken NewKeyword => this.newKeyword;
/// <summary>ArgumentListSyntax representing the list of arguments passed as part of the object creation expression.</summary>
public override ArgumentListSyntax ArgumentList => this.argumentList;
/// <summary>InitializerExpressionSyntax representing the initializer expression for the object being created.</summary>
public override InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.argumentList,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitObjectCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitObjectCreationExpression(this);
public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, GetDiagnostics(), annotations);
internal ImplicitObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.argumentList);
writer.WriteValue(this.initializer);
}
static ImplicitObjectCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitObjectCreationExpressionSyntax), r => new ImplicitObjectCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for object creation expression.</summary>
internal sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly TypeSyntax type;
internal readonly ArgumentListSyntax? argumentList;
internal readonly InitializerExpressionSyntax? initializer;
internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public override SyntaxToken NewKeyword => this.newKeyword;
/// <summary>TypeSyntax representing the type of the object being created.</summary>
public TypeSyntax Type => this.type;
/// <summary>ArgumentListSyntax representing the list of arguments passed as part of the object creation expression.</summary>
public override ArgumentListSyntax? ArgumentList => this.argumentList;
/// <summary>InitializerExpressionSyntax representing the initializer expression for the object being created.</summary>
public override InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.type,
2 => this.argumentList,
3 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ObjectCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitObjectCreationExpression(this);
public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, GetDiagnostics(), annotations);
internal ObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var argumentList = (ArgumentListSyntax?)reader.ReadValue();
if (argumentList != null)
{
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.argumentList);
writer.WriteValue(this.initializer);
}
static ObjectCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ObjectCreationExpressionSyntax), r => new ObjectCreationExpressionSyntax(r));
}
}
internal sealed partial class WithExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken withKeyword;
internal readonly InitializerExpressionSyntax initializer;
internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
public ExpressionSyntax Expression => this.expression;
public SyntaxToken WithKeyword => this.withKeyword;
/// <summary>InitializerExpressionSyntax representing the initializer expression for the with expression.</summary>
public InitializerExpressionSyntax Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.withKeyword,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WithExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWithExpression(this);
public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
{
if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer)
{
var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, GetDiagnostics(), annotations);
internal WithExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var withKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
var initializer = (InitializerExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.withKeyword);
writer.WriteValue(this.initializer);
}
static WithExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WithExpressionSyntax), r => new WithExpressionSyntax(r));
}
}
internal sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode
{
internal readonly NameEqualsSyntax? nameEquals;
internal readonly ExpressionSyntax expression;
internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>NameEqualsSyntax representing the optional name of the member being initialized.</summary>
public NameEqualsSyntax? NameEquals => this.nameEquals;
/// <summary>ExpressionSyntax representing the value the member is initialized with.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.nameEquals,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this);
public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax nameEquals, ExpressionSyntax expression)
{
if (nameEquals != this.NameEquals || expression != this.Expression)
{
var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, GetDiagnostics(), annotations);
internal AnonymousObjectMemberDeclaratorSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var nameEquals = (NameEqualsSyntax?)reader.ReadValue();
if (nameEquals != null)
{
AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.nameEquals);
writer.WriteValue(this.expression);
}
static AnonymousObjectMemberDeclaratorSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectMemberDeclaratorSyntax), r => new AnonymousObjectMemberDeclaratorSyntax(r));
}
}
/// <summary>Class which represents the syntax node for anonymous object creation expression.</summary>
internal sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? initializers;
internal readonly SyntaxToken closeBraceToken;
internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>SyntaxToken representing the open brace.</summary>
public SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.initializers));
/// <summary>SyntaxToken representing the close brace.</summary>
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.openBraceToken,
2 => this.initializers,
3 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAnonymousObjectCreationExpression(this);
public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers, SyntaxToken closeBraceToken)
{
if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, GetDiagnostics(), annotations);
internal AnonymousObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var initializers = (GreenNode?)reader.ReadValue();
if (initializers != null)
{
AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.initializers);
writer.WriteValue(this.closeBraceToken);
}
static AnonymousObjectCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectCreationExpressionSyntax), r => new AnonymousObjectCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for array creation expression.</summary>
internal sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly ArrayTypeSyntax type;
internal readonly InitializerExpressionSyntax? initializer;
internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>ArrayTypeSyntax node representing the type of the array.</summary>
public ArrayTypeSyntax Type => this.type;
/// <summary>InitializerExpressionSyntax node representing the initializer of the array creation expression.</summary>
public InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.type,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrayCreationExpression(this);
public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, GetDiagnostics(), annotations);
internal ArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var type = (ArrayTypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.initializer);
}
static ArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrayCreationExpressionSyntax), r => new ArrayCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for implicit array creation expression.</summary>
internal sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? commas;
internal readonly SyntaxToken closeBracketToken;
internal readonly InitializerExpressionSyntax initializer;
internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (commas != null)
{
this.AdjustFlagsAndWidth(commas);
this.commas = commas;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (commas != null)
{
this.AdjustFlagsAndWidth(commas);
this.commas = commas;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (commas != null)
{
this.AdjustFlagsAndWidth(commas);
this.commas = commas;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>SyntaxToken representing the open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SyntaxList of SyntaxToken representing the commas in the implicit array creation expression.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Commas => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.commas);
/// <summary>SyntaxToken representing the close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
/// <summary>InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression.</summary>
public InitializerExpressionSyntax Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.openBracketToken,
2 => this.commas,
3 => this.closeBracketToken,
4 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitArrayCreationExpression(this);
public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations);
internal ImplicitArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var commas = (GreenNode?)reader.ReadValue();
if (commas != null)
{
AdjustFlagsAndWidth(commas);
this.commas = commas;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
var initializer = (InitializerExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.commas);
writer.WriteValue(this.closeBracketToken);
writer.WriteValue(this.initializer);
}
static ImplicitArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitArrayCreationExpressionSyntax), r => new ImplicitArrayCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for stackalloc array creation expression.</summary>
internal sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken stackAllocKeyword;
internal readonly TypeSyntax type;
internal readonly InitializerExpressionSyntax? initializer;
internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the stackalloc keyword.</summary>
public SyntaxToken StackAllocKeyword => this.stackAllocKeyword;
/// <summary>TypeSyntax node representing the type of the stackalloc array.</summary>
public TypeSyntax Type => this.type;
/// <summary>InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression.</summary>
public InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.stackAllocKeyword,
1 => this.type,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StackAllocArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitStackAllocArrayCreationExpression(this);
public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax initializer)
{
if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer)
{
var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, GetDiagnostics(), annotations);
internal StackAllocArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var stackAllocKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.stackAllocKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.initializer);
}
static StackAllocArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(StackAllocArrayCreationExpressionSyntax), r => new StackAllocArrayCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for implicit stackalloc array creation expression.</summary>
internal sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken stackAllocKeyword;
internal readonly SyntaxToken openBracketToken;
internal readonly SyntaxToken closeBracketToken;
internal readonly InitializerExpressionSyntax initializer;
internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
/// <summary>SyntaxToken representing the stackalloc keyword.</summary>
public SyntaxToken StackAllocKeyword => this.stackAllocKeyword;
/// <summary>SyntaxToken representing the open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SyntaxToken representing the close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
/// <summary>InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression.</summary>
public InitializerExpressionSyntax Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.stackAllocKeyword,
1 => this.openBracketToken,
2 => this.closeBracketToken,
3 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this);
public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations);
internal ImplicitStackAllocArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var stackAllocKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
var initializer = (InitializerExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.stackAllocKeyword);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.closeBracketToken);
writer.WriteValue(this.initializer);
}
static ImplicitStackAllocArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitStackAllocArrayCreationExpressionSyntax), r => new ImplicitStackAllocArrayCreationExpressionSyntax(r));
}
}
internal abstract partial class QueryClauseSyntax : CSharpSyntaxNode
{
internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal QueryClauseSyntax(SyntaxKind kind)
: base(kind)
{
}
protected QueryClauseSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode
{
internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal SelectOrGroupClauseSyntax(SyntaxKind kind)
: base(kind)
{
}
protected SelectOrGroupClauseSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class QueryExpressionSyntax : ExpressionSyntax
{
internal readonly FromClauseSyntax fromClause;
internal readonly QueryBodySyntax body;
internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
public FromClauseSyntax FromClause => this.fromClause;
public QueryBodySyntax Body => this.body;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.fromClause,
1 => this.body,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQueryExpression(this);
public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body)
{
if (fromClause != this.FromClause || body != this.Body)
{
var newNode = SyntaxFactory.QueryExpression(fromClause, body);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, GetDiagnostics(), annotations);
internal QueryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var fromClause = (FromClauseSyntax)reader.ReadValue();
AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
var body = (QueryBodySyntax)reader.ReadValue();
AdjustFlagsAndWidth(body);
this.body = body;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.fromClause);
writer.WriteValue(this.body);
}
static QueryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QueryExpressionSyntax), r => new QueryExpressionSyntax(r));
}
}
internal sealed partial class QueryBodySyntax : CSharpSyntaxNode
{
internal readonly GreenNode? clauses;
internal readonly SelectOrGroupClauseSyntax selectOrGroup;
internal readonly QueryContinuationSyntax? continuation;
internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (clauses != null)
{
this.AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
this.AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
if (continuation != null)
{
this.AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (clauses != null)
{
this.AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
this.AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
if (continuation != null)
{
this.AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
: base(kind)
{
this.SlotCount = 3;
if (clauses != null)
{
this.AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
this.AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
if (continuation != null)
{
this.AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> Clauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax>(this.clauses);
public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup;
public QueryContinuationSyntax? Continuation => this.continuation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.clauses,
1 => this.selectOrGroup,
2 => this.continuation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryBodySyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQueryBody(this);
public QueryBodySyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation)
{
if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation)
{
var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, GetDiagnostics(), annotations);
internal QueryBodySyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var clauses = (GreenNode?)reader.ReadValue();
if (clauses != null)
{
AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
var selectOrGroup = (SelectOrGroupClauseSyntax)reader.ReadValue();
AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
var continuation = (QueryContinuationSyntax?)reader.ReadValue();
if (continuation != null)
{
AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.clauses);
writer.WriteValue(this.selectOrGroup);
writer.WriteValue(this.continuation);
}
static QueryBodySyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QueryBodySyntax), r => new QueryBodySyntax(r));
}
}
internal sealed partial class FromClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken fromKeyword;
internal readonly TypeSyntax? type;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax expression;
internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken FromKeyword => this.fromKeyword;
public TypeSyntax? Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public SyntaxToken InKeyword => this.inKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.fromKeyword,
1 => this.type,
2 => this.identifier,
3 => this.inKeyword,
4 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FromClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFromClause(this);
public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
{
if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, GetDiagnostics(), annotations);
internal FromClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var fromKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.fromKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.expression);
}
static FromClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FromClauseSyntax), r => new FromClauseSyntax(r));
}
}
internal sealed partial class LetClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken letKeyword;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken equalsToken;
internal readonly ExpressionSyntax expression;
internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken LetKeyword => this.letKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public SyntaxToken EqualsToken => this.equalsToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.letKeyword,
1 => this.identifier,
2 => this.equalsToken,
3 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LetClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLetClause(this);
public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
{
if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression)
{
var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, GetDiagnostics(), annotations);
internal LetClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var letKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.letKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.expression);
}
static LetClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LetClauseSyntax), r => new LetClauseSyntax(r));
}
}
internal sealed partial class JoinClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken joinKeyword;
internal readonly TypeSyntax? type;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax inExpression;
internal readonly SyntaxToken onKeyword;
internal readonly ExpressionSyntax leftExpression;
internal readonly SyntaxToken equalsKeyword;
internal readonly ExpressionSyntax rightExpression;
internal readonly JoinIntoClauseSyntax? into;
internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
this.AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
this.AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
this.AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
this.AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
this.AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
if (into != null)
{
this.AdjustFlagsAndWidth(into);
this.into = into;
}
}
internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
this.AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
this.AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
this.AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
this.AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
this.AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
if (into != null)
{
this.AdjustFlagsAndWidth(into);
this.into = into;
}
}
internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into)
: base(kind)
{
this.SlotCount = 10;
this.AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
this.AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
this.AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
this.AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
this.AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
if (into != null)
{
this.AdjustFlagsAndWidth(into);
this.into = into;
}
}
public SyntaxToken JoinKeyword => this.joinKeyword;
public TypeSyntax? Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public SyntaxToken InKeyword => this.inKeyword;
public ExpressionSyntax InExpression => this.inExpression;
public SyntaxToken OnKeyword => this.onKeyword;
public ExpressionSyntax LeftExpression => this.leftExpression;
public SyntaxToken EqualsKeyword => this.equalsKeyword;
public ExpressionSyntax RightExpression => this.rightExpression;
public JoinIntoClauseSyntax? Into => this.into;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.joinKeyword,
1 => this.type,
2 => this.identifier,
3 => this.inKeyword,
4 => this.inExpression,
5 => this.onKeyword,
6 => this.leftExpression,
7 => this.equalsKeyword,
8 => this.rightExpression,
9 => this.into,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitJoinClause(this);
public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax into)
{
if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into)
{
var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, GetDiagnostics(), annotations);
internal JoinClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var joinKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var inExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
var onKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
var leftExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
var equalsKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
var rightExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
var into = (JoinIntoClauseSyntax?)reader.ReadValue();
if (into != null)
{
AdjustFlagsAndWidth(into);
this.into = into;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.joinKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.inExpression);
writer.WriteValue(this.onKeyword);
writer.WriteValue(this.leftExpression);
writer.WriteValue(this.equalsKeyword);
writer.WriteValue(this.rightExpression);
writer.WriteValue(this.into);
}
static JoinClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(JoinClauseSyntax), r => new JoinClauseSyntax(r));
}
}
internal sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken intoKeyword;
internal readonly SyntaxToken identifier;
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
public SyntaxToken IntoKeyword => this.intoKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.intoKeyword,
1 => this.identifier,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitJoinIntoClause(this);
public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier)
{
if (intoKeyword != this.IntoKeyword || identifier != this.Identifier)
{
var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, GetDiagnostics(), annotations);
internal JoinIntoClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var intoKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.intoKeyword);
writer.WriteValue(this.identifier);
}
static JoinIntoClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(JoinIntoClauseSyntax), r => new JoinIntoClauseSyntax(r));
}
}
internal sealed partial class WhereClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken whereKeyword;
internal readonly ExpressionSyntax condition;
internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
public SyntaxToken WhereKeyword => this.whereKeyword;
public ExpressionSyntax Condition => this.condition;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whereKeyword,
1 => this.condition,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhereClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWhereClause(this);
public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition)
{
if (whereKeyword != this.WhereKeyword || condition != this.Condition)
{
var newNode = SyntaxFactory.WhereClause(whereKeyword, condition);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, GetDiagnostics(), annotations);
internal WhereClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var whereKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whereKeyword);
writer.WriteValue(this.condition);
}
static WhereClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WhereClauseSyntax), r => new WhereClauseSyntax(r));
}
}
internal sealed partial class OrderByClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken orderByKeyword;
internal readonly GreenNode? orderings;
internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
if (orderings != null)
{
this.AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
if (orderings != null)
{
this.AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
if (orderings != null)
{
this.AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
public SyntaxToken OrderByKeyword => this.orderByKeyword;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> Orderings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.orderings));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.orderByKeyword,
1 => this.orderings,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderByClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOrderByClause(this);
public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> orderings)
{
if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings)
{
var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, GetDiagnostics(), annotations);
internal OrderByClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var orderByKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
var orderings = (GreenNode?)reader.ReadValue();
if (orderings != null)
{
AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.orderByKeyword);
writer.WriteValue(this.orderings);
}
static OrderByClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OrderByClauseSyntax), r => new OrderByClauseSyntax(r));
}
}
internal sealed partial class OrderingSyntax : CSharpSyntaxNode
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken? ascendingOrDescendingKeyword;
internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (ascendingOrDescendingKeyword != null)
{
this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (ascendingOrDescendingKeyword != null)
{
this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (ascendingOrDescendingKeyword != null)
{
this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
public ExpressionSyntax Expression => this.expression;
public SyntaxToken? AscendingOrDescendingKeyword => this.ascendingOrDescendingKeyword;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.ascendingOrDescendingKeyword,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderingSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOrdering(this);
public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword)
{
if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword)
{
var newNode = SyntaxFactory.Ordering(this.Kind, expression, ascendingOrDescendingKeyword);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, GetDiagnostics(), annotations);
internal OrderingSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var ascendingOrDescendingKeyword = (SyntaxToken?)reader.ReadValue();
if (ascendingOrDescendingKeyword != null)
{
AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.ascendingOrDescendingKeyword);
}
static OrderingSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OrderingSyntax), r => new OrderingSyntax(r));
}
}
internal sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax
{
internal readonly SyntaxToken selectKeyword;
internal readonly ExpressionSyntax expression;
internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken SelectKeyword => this.selectKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.selectKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SelectClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSelectClause(this);
public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression)
{
if (selectKeyword != this.SelectKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.SelectClause(selectKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, GetDiagnostics(), annotations);
internal SelectClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var selectKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.selectKeyword);
writer.WriteValue(this.expression);
}
static SelectClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SelectClauseSyntax), r => new SelectClauseSyntax(r));
}
}
internal sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax
{
internal readonly SyntaxToken groupKeyword;
internal readonly ExpressionSyntax groupExpression;
internal readonly SyntaxToken byKeyword;
internal readonly ExpressionSyntax byExpression;
internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
this.AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
this.AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
this.AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
this.AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
this.AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
this.AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
this.AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
this.AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
this.AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
public SyntaxToken GroupKeyword => this.groupKeyword;
public ExpressionSyntax GroupExpression => this.groupExpression;
public SyntaxToken ByKeyword => this.byKeyword;
public ExpressionSyntax ByExpression => this.byExpression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.groupKeyword,
1 => this.groupExpression,
2 => this.byKeyword,
3 => this.byExpression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GroupClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGroupClause(this);
public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
{
if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression)
{
var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, GetDiagnostics(), annotations);
internal GroupClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var groupKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
var groupExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
var byKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
var byExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.groupKeyword);
writer.WriteValue(this.groupExpression);
writer.WriteValue(this.byKeyword);
writer.WriteValue(this.byExpression);
}
static GroupClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GroupClauseSyntax), r => new GroupClauseSyntax(r));
}
}
internal sealed partial class QueryContinuationSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken intoKeyword;
internal readonly SyntaxToken identifier;
internal readonly QueryBodySyntax body;
internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
public SyntaxToken IntoKeyword => this.intoKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public QueryBodySyntax Body => this.body;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.intoKeyword,
1 => this.identifier,
2 => this.body,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryContinuationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQueryContinuation(this);
public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
{
if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body)
{
var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, GetDiagnostics(), annotations);
internal QueryContinuationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var intoKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var body = (QueryBodySyntax)reader.ReadValue();
AdjustFlagsAndWidth(body);
this.body = body;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.intoKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.body);
}
static QueryContinuationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QueryContinuationSyntax), r => new QueryContinuationSyntax(r));
}
}
/// <summary>Class which represents a placeholder in an array size list.</summary>
internal sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken omittedArraySizeExpressionToken;
internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
/// <summary>SyntaxToken representing the omitted array size expression.</summary>
public SyntaxToken OmittedArraySizeExpressionToken => this.omittedArraySizeExpressionToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.omittedArraySizeExpressionToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedArraySizeExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOmittedArraySizeExpression(this);
public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken)
{
if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken)
{
var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, GetDiagnostics(), annotations);
internal OmittedArraySizeExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var omittedArraySizeExpressionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.omittedArraySizeExpressionToken);
}
static OmittedArraySizeExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OmittedArraySizeExpressionSyntax), r => new OmittedArraySizeExpressionSyntax(r));
}
}
internal sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken stringStartToken;
internal readonly GreenNode? contents;
internal readonly SyntaxToken stringEndToken;
internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
if (contents != null)
{
this.AdjustFlagsAndWidth(contents);
this.contents = contents;
}
this.AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
if (contents != null)
{
this.AdjustFlagsAndWidth(contents);
this.contents = contents;
}
this.AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
if (contents != null)
{
this.AdjustFlagsAndWidth(contents);
this.contents = contents;
}
this.AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
/// <summary>The first part of an interpolated string, $" or $@"</summary>
public SyntaxToken StringStartToken => this.stringStartToken;
/// <summary>List of parts of the interpolated string, each one is either a literal part or an interpolation.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> Contents => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax>(this.contents);
/// <summary>The closing quote of the interpolated string.</summary>
public SyntaxToken StringEndToken => this.stringEndToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.stringStartToken,
1 => this.contents,
2 => this.stringEndToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolatedStringExpression(this);
public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken)
{
if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken)
{
var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, GetDiagnostics(), annotations);
internal InterpolatedStringExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var stringStartToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
var contents = (GreenNode?)reader.ReadValue();
if (contents != null)
{
AdjustFlagsAndWidth(contents);
this.contents = contents;
}
var stringEndToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.stringStartToken);
writer.WriteValue(this.contents);
writer.WriteValue(this.stringEndToken);
}
static InterpolatedStringExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringExpressionSyntax), r => new InterpolatedStringExpressionSyntax(r));
}
}
/// <summary>Class which represents a simple pattern-matching expression using the "is" keyword.</summary>
internal sealed partial class IsPatternExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken isKeyword;
internal readonly PatternSyntax pattern;
internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
/// <summary>ExpressionSyntax node representing the expression on the left of the "is" operator.</summary>
public ExpressionSyntax Expression => this.expression;
public SyntaxToken IsKeyword => this.isKeyword;
/// <summary>PatternSyntax node representing the pattern on the right of the "is" operator.</summary>
public PatternSyntax Pattern => this.pattern;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.isKeyword,
2 => this.pattern,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IsPatternExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIsPatternExpression(this);
public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
{
if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern)
{
var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, GetDiagnostics(), annotations);
internal IsPatternExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var isKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.isKeyword);
writer.WriteValue(this.pattern);
}
static IsPatternExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IsPatternExpressionSyntax), r => new IsPatternExpressionSyntax(r));
}
}
internal sealed partial class ThrowExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken throwKeyword;
internal readonly ExpressionSyntax expression;
internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken ThrowKeyword => this.throwKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.throwKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitThrowExpression(this);
public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression)
{
if (throwKeyword != this.ThrowKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, GetDiagnostics(), annotations);
internal ThrowExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var throwKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.throwKeyword);
writer.WriteValue(this.expression);
}
static ThrowExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ThrowExpressionSyntax), r => new ThrowExpressionSyntax(r));
}
}
internal sealed partial class WhenClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken whenKeyword;
internal readonly ExpressionSyntax condition;
internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
public SyntaxToken WhenKeyword => this.whenKeyword;
public ExpressionSyntax Condition => this.condition;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whenKeyword,
1 => this.condition,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhenClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWhenClause(this);
public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition)
{
if (whenKeyword != this.WhenKeyword || condition != this.Condition)
{
var newNode = SyntaxFactory.WhenClause(whenKeyword, condition);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, GetDiagnostics(), annotations);
internal WhenClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var whenKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whenKeyword);
writer.WriteValue(this.condition);
}
static WhenClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WhenClauseSyntax), r => new WhenClauseSyntax(r));
}
}
internal abstract partial class PatternSyntax : ExpressionOrPatternSyntax
{
internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal PatternSyntax(SyntaxKind kind)
: base(kind)
{
}
protected PatternSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class DiscardPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken underscoreToken;
internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
public SyntaxToken UnderscoreToken => this.underscoreToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.underscoreToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDiscardPattern(this);
public DiscardPatternSyntax Update(SyntaxToken underscoreToken)
{
if (underscoreToken != this.UnderscoreToken)
{
var newNode = SyntaxFactory.DiscardPattern(underscoreToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DiscardPatternSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DiscardPatternSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations);
internal DiscardPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var underscoreToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.underscoreToken);
}
static DiscardPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DiscardPatternSyntax), r => new DiscardPatternSyntax(r));
}
}
internal sealed partial class DeclarationPatternSyntax : PatternSyntax
{
internal readonly TypeSyntax type;
internal readonly VariableDesignationSyntax designation;
internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
public TypeSyntax Type => this.type;
public VariableDesignationSyntax Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDeclarationPattern(this);
public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation)
{
if (type != this.Type || designation != this.Designation)
{
var newNode = SyntaxFactory.DeclarationPattern(type, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DeclarationPatternSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DeclarationPatternSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations);
internal DeclarationPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var designation = (VariableDesignationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.designation);
}
static DeclarationPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DeclarationPatternSyntax), r => new DeclarationPatternSyntax(r));
}
}
internal sealed partial class VarPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken varKeyword;
internal readonly VariableDesignationSyntax designation;
internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
public SyntaxToken VarKeyword => this.varKeyword;
public VariableDesignationSyntax Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.varKeyword,
1 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VarPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitVarPattern(this);
public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation)
{
if (varKeyword != this.VarKeyword || designation != this.Designation)
{
var newNode = SyntaxFactory.VarPattern(varKeyword, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, GetDiagnostics(), annotations);
internal VarPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var varKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
var designation = (VariableDesignationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.varKeyword);
writer.WriteValue(this.designation);
}
static VarPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(VarPatternSyntax), r => new VarPatternSyntax(r));
}
}
internal sealed partial class RecursivePatternSyntax : PatternSyntax
{
internal readonly TypeSyntax? type;
internal readonly PositionalPatternClauseSyntax? positionalPatternClause;
internal readonly PropertyPatternClauseSyntax? propertyPatternClause;
internal readonly VariableDesignationSyntax? designation;
internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
if (positionalPatternClause != null)
{
this.AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
if (propertyPatternClause != null)
{
this.AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
if (designation != null)
{
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
if (positionalPatternClause != null)
{
this.AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
if (propertyPatternClause != null)
{
this.AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
if (designation != null)
{
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation)
: base(kind)
{
this.SlotCount = 4;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
if (positionalPatternClause != null)
{
this.AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
if (propertyPatternClause != null)
{
this.AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
if (designation != null)
{
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
public TypeSyntax? Type => this.type;
public PositionalPatternClauseSyntax? PositionalPatternClause => this.positionalPatternClause;
public PropertyPatternClauseSyntax? PropertyPatternClause => this.propertyPatternClause;
public VariableDesignationSyntax? Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.positionalPatternClause,
2 => this.propertyPatternClause,
3 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecursivePatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRecursivePattern(this);
public RecursivePatternSyntax Update(TypeSyntax type, PositionalPatternClauseSyntax positionalPatternClause, PropertyPatternClauseSyntax propertyPatternClause, VariableDesignationSyntax designation)
{
if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation)
{
var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, GetDiagnostics(), annotations);
internal RecursivePatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var positionalPatternClause = (PositionalPatternClauseSyntax?)reader.ReadValue();
if (positionalPatternClause != null)
{
AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
var propertyPatternClause = (PropertyPatternClauseSyntax?)reader.ReadValue();
if (propertyPatternClause != null)
{
AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
var designation = (VariableDesignationSyntax?)reader.ReadValue();
if (designation != null)
{
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.positionalPatternClause);
writer.WriteValue(this.propertyPatternClause);
writer.WriteValue(this.designation);
}
static RecursivePatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RecursivePatternSyntax), r => new RecursivePatternSyntax(r));
}
}
internal sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? subpatterns;
internal readonly SyntaxToken closeParenToken;
internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.subpatterns));
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.subpatterns,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PositionalPatternClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPositionalPatternClause(this);
public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, GetDiagnostics(), annotations);
internal PositionalPatternClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var subpatterns = (GreenNode?)reader.ReadValue();
if (subpatterns != null)
{
AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.subpatterns);
writer.WriteValue(this.closeParenToken);
}
static PositionalPatternClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PositionalPatternClauseSyntax), r => new PositionalPatternClauseSyntax(r));
}
}
internal sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? subpatterns;
internal readonly SyntaxToken closeBraceToken;
internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.subpatterns));
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.subpatterns,
2 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyPatternClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPropertyPatternClause(this);
public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, GetDiagnostics(), annotations);
internal PropertyPatternClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var subpatterns = (GreenNode?)reader.ReadValue();
if (subpatterns != null)
{
AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.subpatterns);
writer.WriteValue(this.closeBraceToken);
}
static PropertyPatternClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PropertyPatternClauseSyntax), r => new PropertyPatternClauseSyntax(r));
}
}
internal sealed partial class SubpatternSyntax : CSharpSyntaxNode
{
internal readonly BaseExpressionColonSyntax? expressionColon;
internal readonly PatternSyntax pattern;
internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (expressionColon != null)
{
this.AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (expressionColon != null)
{
this.AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern)
: base(kind)
{
this.SlotCount = 2;
if (expressionColon != null)
{
this.AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
public BaseExpressionColonSyntax? ExpressionColon => this.expressionColon;
public PatternSyntax Pattern => this.pattern;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expressionColon,
1 => this.pattern,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SubpatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSubpattern(this);
public SubpatternSyntax Update(BaseExpressionColonSyntax expressionColon, PatternSyntax pattern)
{
if (expressionColon != this.ExpressionColon || pattern != this.Pattern)
{
var newNode = SyntaxFactory.Subpattern(expressionColon, pattern);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, GetDiagnostics(), annotations);
internal SubpatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expressionColon = (BaseExpressionColonSyntax?)reader.ReadValue();
if (expressionColon != null)
{
AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expressionColon);
writer.WriteValue(this.pattern);
}
static SubpatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SubpatternSyntax), r => new SubpatternSyntax(r));
}
}
internal sealed partial class ConstantPatternSyntax : PatternSyntax
{
internal readonly ExpressionSyntax expression;
internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>ExpressionSyntax node representing the constant expression.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.expression : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstantPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstantPattern(this);
public ConstantPatternSyntax Update(ExpressionSyntax expression)
{
if (expression != this.Expression)
{
var newNode = SyntaxFactory.ConstantPattern(expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstantPatternSyntax(this.Kind, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstantPatternSyntax(this.Kind, this.expression, GetDiagnostics(), annotations);
internal ConstantPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
}
static ConstantPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstantPatternSyntax), r => new ConstantPatternSyntax(r));
}
}
internal sealed partial class ParenthesizedPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly PatternSyntax pattern;
internal readonly SyntaxToken closeParenToken;
internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public PatternSyntax Pattern => this.pattern;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.pattern,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedPattern(this);
public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, GetDiagnostics(), annotations);
internal ParenthesizedPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.pattern);
writer.WriteValue(this.closeParenToken);
}
static ParenthesizedPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedPatternSyntax), r => new ParenthesizedPatternSyntax(r));
}
}
internal sealed partial class RelationalPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax expression;
internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>SyntaxToken representing the operator of the relational pattern.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RelationalPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRelationalPattern(this);
public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression)
{
if (operatorToken != this.OperatorToken || expression != this.Expression)
{
var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations);
internal RelationalPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.expression);
}
static RelationalPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RelationalPatternSyntax), r => new RelationalPatternSyntax(r));
}
}
internal sealed partial class TypePatternSyntax : PatternSyntax
{
internal readonly TypeSyntax type;
internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
/// <summary>The type for the type pattern.</summary>
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypePatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypePattern(this);
public TypePatternSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.TypePattern(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypePatternSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypePatternSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal TypePatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static TypePatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypePatternSyntax), r => new TypePatternSyntax(r));
}
}
internal sealed partial class BinaryPatternSyntax : PatternSyntax
{
internal readonly PatternSyntax left;
internal readonly SyntaxToken operatorToken;
internal readonly PatternSyntax right;
internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
public PatternSyntax Left => this.left;
public SyntaxToken OperatorToken => this.operatorToken;
public PatternSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.operatorToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBinaryPattern(this);
public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
{
if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right)
{
var newNode = SyntaxFactory.BinaryPattern(this.Kind, left, operatorToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations);
internal BinaryPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var right = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.right);
}
static BinaryPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BinaryPatternSyntax), r => new BinaryPatternSyntax(r));
}
}
internal sealed partial class UnaryPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly PatternSyntax pattern;
internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
public SyntaxToken OperatorToken => this.operatorToken;
public PatternSyntax Pattern => this.pattern;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.pattern,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnaryPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUnaryPattern(this);
public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern)
{
if (operatorToken != this.OperatorToken || pattern != this.Pattern)
{
var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, GetDiagnostics(), annotations);
internal UnaryPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.pattern);
}
static UnaryPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UnaryPatternSyntax), r => new UnaryPatternSyntax(r));
}
}
internal abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode
{
internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal InterpolatedStringContentSyntax(SyntaxKind kind)
: base(kind)
{
}
protected InterpolatedStringContentSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax
{
internal readonly SyntaxToken textToken;
internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
/// <summary>The text contents of a part of the interpolated string.</summary>
public SyntaxToken TextToken => this.textToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.textToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringTextSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolatedStringText(this);
public InterpolatedStringTextSyntax Update(SyntaxToken textToken)
{
if (textToken != this.TextToken)
{
var newNode = SyntaxFactory.InterpolatedStringText(textToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolatedStringTextSyntax(this.Kind, this.textToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolatedStringTextSyntax(this.Kind, this.textToken, GetDiagnostics(), annotations);
internal InterpolatedStringTextSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var textToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.textToken);
}
static InterpolatedStringTextSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringTextSyntax), r => new InterpolatedStringTextSyntax(r));
}
}
internal sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax
{
internal readonly SyntaxToken openBraceToken;
internal readonly ExpressionSyntax expression;
internal readonly InterpolationAlignmentClauseSyntax? alignmentClause;
internal readonly InterpolationFormatClauseSyntax? formatClause;
internal readonly SyntaxToken closeBraceToken;
internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (alignmentClause != null)
{
this.AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
if (formatClause != null)
{
this.AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (alignmentClause != null)
{
this.AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
if (formatClause != null)
{
this.AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (alignmentClause != null)
{
this.AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
if (formatClause != null)
{
this.AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public SyntaxToken OpenBraceToken => this.openBraceToken;
public ExpressionSyntax Expression => this.expression;
public InterpolationAlignmentClauseSyntax? AlignmentClause => this.alignmentClause;
public InterpolationFormatClauseSyntax? FormatClause => this.formatClause;
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.expression,
2 => this.alignmentClause,
3 => this.formatClause,
4 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolation(this);
public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, GetDiagnostics(), annotations);
internal InterpolationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var alignmentClause = (InterpolationAlignmentClauseSyntax?)reader.ReadValue();
if (alignmentClause != null)
{
AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
var formatClause = (InterpolationFormatClauseSyntax?)reader.ReadValue();
if (formatClause != null)
{
AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.alignmentClause);
writer.WriteValue(this.formatClause);
writer.WriteValue(this.closeBraceToken);
}
static InterpolationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolationSyntax), r => new InterpolationSyntax(r));
}
}
internal sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken commaToken;
internal readonly ExpressionSyntax value;
internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
public SyntaxToken CommaToken => this.commaToken;
public ExpressionSyntax Value => this.value;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.commaToken,
1 => this.value,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationAlignmentClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolationAlignmentClause(this);
public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value)
{
if (commaToken != this.CommaToken || value != this.Value)
{
var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, GetDiagnostics(), annotations);
internal InterpolationAlignmentClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var commaToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
var value = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(value);
this.value = value;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.commaToken);
writer.WriteValue(this.value);
}
static InterpolationAlignmentClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolationAlignmentClauseSyntax), r => new InterpolationAlignmentClauseSyntax(r));
}
}
internal sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken colonToken;
internal readonly SyntaxToken formatStringToken;
internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
public SyntaxToken ColonToken => this.colonToken;
/// <summary>The text contents of the format specifier for an interpolation.</summary>
public SyntaxToken FormatStringToken => this.formatStringToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.colonToken,
1 => this.formatStringToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationFormatClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolationFormatClause(this);
public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken)
{
if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken)
{
var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations);
internal InterpolationFormatClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var formatStringToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.formatStringToken);
}
static InterpolationFormatClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolationFormatClauseSyntax), r => new InterpolationFormatClauseSyntax(r));
}
}
internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly StatementSyntax statement;
internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GlobalStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGlobalStatement(this);
public GlobalStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement)
{
var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, GetDiagnostics(), annotations);
internal GlobalStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.statement);
}
static GlobalStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GlobalStatementSyntax), r => new GlobalStatementSyntax(r));
}
}
/// <summary>Represents the base class for all statements syntax classes.</summary>
internal abstract partial class StatementSyntax : CSharpSyntaxNode
{
internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal StatementSyntax(SyntaxKind kind)
: base(kind)
{
}
protected StatementSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
}
internal sealed partial class BlockSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? statements;
internal readonly SyntaxToken closeBraceToken;
internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax>(this.statements);
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.openBraceToken,
2 => this.statements,
3 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BlockSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBlock(this);
public BlockSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
{
if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, GetDiagnostics(), annotations);
internal BlockSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var statements = (GreenNode?)reader.ReadValue();
if (statements != null)
{
AdjustFlagsAndWidth(statements);
this.statements = statements;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.statements);
writer.WriteValue(this.closeBraceToken);
}
static BlockSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BlockSyntax), r => new BlockSyntax(r));
}
}
internal sealed partial class LocalFunctionStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax returnType;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax parameterList;
internal readonly GreenNode? constraintClauses;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public TypeSyntax ReturnType => this.returnType;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public ParameterListSyntax ParameterList => this.parameterList;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public BlockSyntax? Body => this.body;
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.parameterList,
6 => this.constraintClauses,
7 => this.body,
8 => this.expressionBody,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalFunctionStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLocalFunctionStatement(this);
public LocalFunctionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal LocalFunctionStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static LocalFunctionStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LocalFunctionStatementSyntax), r => new LocalFunctionStatementSyntax(r));
}
}
internal sealed partial class LocalDeclarationStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken? usingKeyword;
internal readonly GreenNode? modifiers;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken semicolonToken;
internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
if (usingKeyword != null)
{
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
if (usingKeyword != null)
{
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
if (usingKeyword != null)
{
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken? AwaitKeyword => this.awaitKeyword;
public SyntaxToken? UsingKeyword => this.usingKeyword;
/// <summary>Gets the modifier list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public VariableDeclarationSyntax Declaration => this.declaration;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.usingKeyword,
3 => this.modifiers,
4 => this.declaration,
5 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalDeclarationStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLocalDeclarationStatement(this);
public LocalDeclarationStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations);
internal LocalDeclarationStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var usingKeyword = (SyntaxToken?)reader.ReadValue();
if (usingKeyword != null)
{
AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.usingKeyword);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.declaration);
writer.WriteValue(this.semicolonToken);
}
static LocalDeclarationStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LocalDeclarationStatementSyntax), r => new LocalDeclarationStatementSyntax(r));
}
}
internal sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode
{
internal readonly TypeSyntax type;
internal readonly GreenNode? variables;
internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
public TypeSyntax Type => this.type;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.variables));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.variables,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitVariableDeclaration(this);
public VariableDeclarationSyntax Update(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> variables)
{
if (type != this.Type || variables != this.Variables)
{
var newNode = SyntaxFactory.VariableDeclaration(type, variables);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new VariableDeclarationSyntax(this.Kind, this.type, this.variables, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new VariableDeclarationSyntax(this.Kind, this.type, this.variables, GetDiagnostics(), annotations);
internal VariableDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var variables = (GreenNode?)reader.ReadValue();
if (variables != null)
{
AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.variables);
}
static VariableDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(VariableDeclarationSyntax), r => new VariableDeclarationSyntax(r));
}
}
internal sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken identifier;
internal readonly BracketedArgumentListSyntax? argumentList;
internal readonly EqualsValueClauseSyntax? initializer;
internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public BracketedArgumentListSyntax? ArgumentList => this.argumentList;
public EqualsValueClauseSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.identifier,
1 => this.argumentList,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclaratorSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitVariableDeclarator(this);
public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax argumentList, EqualsValueClauseSyntax initializer)
{
if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer)
{
var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, GetDiagnostics(), annotations);
internal VariableDeclaratorSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var argumentList = (BracketedArgumentListSyntax?)reader.ReadValue();
if (argumentList != null)
{
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
var initializer = (EqualsValueClauseSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
writer.WriteValue(this.argumentList);
writer.WriteValue(this.initializer);
}
static VariableDeclaratorSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(VariableDeclaratorSyntax), r => new VariableDeclaratorSyntax(r));
}
}
internal sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken equalsToken;
internal readonly ExpressionSyntax value;
internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
public SyntaxToken EqualsToken => this.equalsToken;
public ExpressionSyntax Value => this.value;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.equalsToken,
1 => this.value,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EqualsValueClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEqualsValueClause(this);
public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value)
{
if (equalsToken != this.EqualsToken || value != this.Value)
{
var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, GetDiagnostics(), annotations);
internal EqualsValueClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var value = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(value);
this.value = value;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.value);
}
static EqualsValueClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EqualsValueClauseSyntax), r => new EqualsValueClauseSyntax(r));
}
}
internal abstract partial class VariableDesignationSyntax : CSharpSyntaxNode
{
internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal VariableDesignationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected VariableDesignationSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax
{
internal readonly SyntaxToken identifier;
internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
public SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.identifier : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SingleVariableDesignationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSingleVariableDesignation(this);
public SingleVariableDesignationSyntax Update(SyntaxToken identifier)
{
if (identifier != this.Identifier)
{
var newNode = SyntaxFactory.SingleVariableDesignation(identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SingleVariableDesignationSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SingleVariableDesignationSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations);
internal SingleVariableDesignationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
}
static SingleVariableDesignationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SingleVariableDesignationSyntax), r => new SingleVariableDesignationSyntax(r));
}
}
internal sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax
{
internal readonly SyntaxToken underscoreToken;
internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
public SyntaxToken UnderscoreToken => this.underscoreToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.underscoreToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardDesignationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDiscardDesignation(this);
public DiscardDesignationSyntax Update(SyntaxToken underscoreToken)
{
if (underscoreToken != this.UnderscoreToken)
{
var newNode = SyntaxFactory.DiscardDesignation(underscoreToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DiscardDesignationSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DiscardDesignationSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations);
internal DiscardDesignationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var underscoreToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.underscoreToken);
}
static DiscardDesignationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DiscardDesignationSyntax), r => new DiscardDesignationSyntax(r));
}
}
internal sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? variables;
internal readonly SyntaxToken closeParenToken;
internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.variables));
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.variables,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedVariableDesignationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedVariableDesignation(this);
public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> variables, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, GetDiagnostics(), annotations);
internal ParenthesizedVariableDesignationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var variables = (GreenNode?)reader.ReadValue();
if (variables != null)
{
AdjustFlagsAndWidth(variables);
this.variables = variables;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.variables);
writer.WriteValue(this.closeParenToken);
}
static ParenthesizedVariableDesignationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedVariableDesignationSyntax), r => new ParenthesizedVariableDesignationSyntax(r));
}
}
internal sealed partial class ExpressionStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken semicolonToken;
internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public ExpressionSyntax Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.expression,
2 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExpressionStatement(this);
public ExpressionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal ExpressionStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static ExpressionStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExpressionStatementSyntax), r => new ExpressionStatementSyntax(r));
}
}
internal sealed partial class EmptyStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken semicolonToken;
internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 2;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EmptyStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEmptyStatement(this);
public EmptyStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, GetDiagnostics(), annotations);
internal EmptyStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.semicolonToken);
}
static EmptyStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EmptyStatementSyntax), r => new EmptyStatementSyntax(r));
}
}
/// <summary>Represents a labeled statement syntax.</summary>
internal sealed partial class LabeledStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken colonToken;
internal readonly StatementSyntax statement;
internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
/// <summary>Gets a SyntaxToken that represents the colon following the statement's label.</summary>
public SyntaxToken ColonToken => this.colonToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.identifier,
2 => this.colonToken,
3 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LabeledStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLabeledStatement(this);
public LabeledStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement)
{
var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, GetDiagnostics(), annotations);
internal LabeledStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.identifier);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.statement);
}
static LabeledStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LabeledStatementSyntax), r => new LabeledStatementSyntax(r));
}
}
/// <summary>
/// Represents a goto statement syntax
/// </summary>
internal sealed partial class GotoStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken gotoKeyword;
internal readonly SyntaxToken? caseOrDefaultKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
if (caseOrDefaultKeyword != null)
{
this.AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
if (caseOrDefaultKeyword != null)
{
this.AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
if (caseOrDefaultKeyword != null)
{
this.AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>
/// Gets a SyntaxToken that represents the goto keyword.
/// </summary>
public SyntaxToken GotoKeyword => this.gotoKeyword;
/// <summary>
/// Gets a SyntaxToken that represents the case or default keywords if any exists.
/// </summary>
public SyntaxToken? CaseOrDefaultKeyword => this.caseOrDefaultKeyword;
/// <summary>
/// Gets a constant expression for a goto case statement.
/// </summary>
public ExpressionSyntax? Expression => this.expression;
/// <summary>
/// Gets a SyntaxToken that represents the semi-colon at the end of the statement.
/// </summary>
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.gotoKeyword,
2 => this.caseOrDefaultKeyword,
3 => this.expression,
4 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GotoStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGotoStatement(this);
public GotoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.GotoStatement(this.Kind, attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal GotoStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var gotoKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
var caseOrDefaultKeyword = (SyntaxToken?)reader.ReadValue();
if (caseOrDefaultKeyword != null)
{
AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.gotoKeyword);
writer.WriteValue(this.caseOrDefaultKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static GotoStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GotoStatementSyntax), r => new GotoStatementSyntax(r));
}
}
internal sealed partial class BreakStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken breakKeyword;
internal readonly SyntaxToken semicolonToken;
internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken BreakKeyword => this.breakKeyword;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.breakKeyword,
2 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BreakStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBreakStatement(this);
public BreakStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, GetDiagnostics(), annotations);
internal BreakStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var breakKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.breakKeyword);
writer.WriteValue(this.semicolonToken);
}
static BreakStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BreakStatementSyntax), r => new BreakStatementSyntax(r));
}
}
internal sealed partial class ContinueStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken continueKeyword;
internal readonly SyntaxToken semicolonToken;
internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ContinueKeyword => this.continueKeyword;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.continueKeyword,
2 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ContinueStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitContinueStatement(this);
public ContinueStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, GetDiagnostics(), annotations);
internal ContinueStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var continueKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.continueKeyword);
writer.WriteValue(this.semicolonToken);
}
static ContinueStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ContinueStatementSyntax), r => new ContinueStatementSyntax(r));
}
}
internal sealed partial class ReturnStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken returnKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ReturnKeyword => this.returnKeyword;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.returnKeyword,
2 => this.expression,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReturnStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitReturnStatement(this);
public ReturnStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal ReturnStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var returnKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.returnKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static ReturnStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ReturnStatementSyntax), r => new ReturnStatementSyntax(r));
}
}
internal sealed partial class ThrowStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken throwKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ThrowKeyword => this.throwKeyword;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.throwKeyword,
2 => this.expression,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitThrowStatement(this);
public ThrowStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal ThrowStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var throwKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.throwKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static ThrowStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ThrowStatementSyntax), r => new ThrowStatementSyntax(r));
}
}
internal sealed partial class YieldStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken yieldKeyword;
internal readonly SyntaxToken returnOrBreakKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
this.AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
this.AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
this.AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken YieldKeyword => this.yieldKeyword;
public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.yieldKeyword,
2 => this.returnOrBreakKeyword,
3 => this.expression,
4 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.YieldStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitYieldStatement(this);
public YieldStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.YieldStatement(this.Kind, attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal YieldStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var yieldKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
var returnOrBreakKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.yieldKeyword);
writer.WriteValue(this.returnOrBreakKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static YieldStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(YieldStatementSyntax), r => new YieldStatementSyntax(r));
}
}
internal sealed partial class WhileStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken whileKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken WhileKeyword => this.whileKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax Condition => this.condition;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.whileKeyword,
2 => this.openParenToken,
3 => this.condition,
4 => this.closeParenToken,
5 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhileStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWhileStatement(this);
public WhileStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal WhileStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var whileKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.whileKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static WhileStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WhileStatementSyntax), r => new WhileStatementSyntax(r));
}
}
internal sealed partial class DoStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken doKeyword;
internal readonly StatementSyntax statement;
internal readonly SyntaxToken whileKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken closeParenToken;
internal readonly SyntaxToken semicolonToken;
internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken DoKeyword => this.doKeyword;
public StatementSyntax Statement => this.statement;
public SyntaxToken WhileKeyword => this.whileKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax Condition => this.condition;
public SyntaxToken CloseParenToken => this.closeParenToken;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.doKeyword,
2 => this.statement,
3 => this.whileKeyword,
4 => this.openParenToken,
5 => this.condition,
6 => this.closeParenToken,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DoStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDoStatement(this);
public DoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, GetDiagnostics(), annotations);
internal DoStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var doKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
var whileKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.doKeyword);
writer.WriteValue(this.statement);
writer.WriteValue(this.whileKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.semicolonToken);
}
static DoStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DoStatementSyntax), r => new DoStatementSyntax(r));
}
}
internal sealed partial class ForStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken forKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly VariableDeclarationSyntax? declaration;
internal readonly GreenNode? initializers;
internal readonly SyntaxToken firstSemicolonToken;
internal readonly ExpressionSyntax? condition;
internal readonly SyntaxToken secondSemicolonToken;
internal readonly GreenNode? incrementors;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
if (condition != null)
{
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
this.AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
if (incrementors != null)
{
this.AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
if (condition != null)
{
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
this.AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
if (incrementors != null)
{
this.AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
if (condition != null)
{
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
this.AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
if (incrementors != null)
{
this.AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ForKeyword => this.forKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public VariableDeclarationSyntax? Declaration => this.declaration;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.initializers));
public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken;
public ExpressionSyntax? Condition => this.condition;
public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Incrementors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.incrementors));
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.forKeyword,
2 => this.openParenToken,
3 => this.declaration,
4 => this.initializers,
5 => this.firstSemicolonToken,
6 => this.condition,
7 => this.secondSemicolonToken,
8 => this.incrementors,
9 => this.closeParenToken,
10 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitForStatement(this);
public ForStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal ForStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var forKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var declaration = (VariableDeclarationSyntax?)reader.ReadValue();
if (declaration != null)
{
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
var initializers = (GreenNode?)reader.ReadValue();
if (initializers != null)
{
AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
var firstSemicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
var condition = (ExpressionSyntax?)reader.ReadValue();
if (condition != null)
{
AdjustFlagsAndWidth(condition);
this.condition = condition;
}
var secondSemicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
var incrementors = (GreenNode?)reader.ReadValue();
if (incrementors != null)
{
AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.forKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.declaration);
writer.WriteValue(this.initializers);
writer.WriteValue(this.firstSemicolonToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.secondSemicolonToken);
writer.WriteValue(this.incrementors);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static ForStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ForStatementSyntax), r => new ForStatementSyntax(r));
}
}
internal abstract partial class CommonForEachStatementSyntax : StatementSyntax
{
internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal CommonForEachStatementSyntax(SyntaxKind kind)
: base(kind)
{
}
protected CommonForEachStatementSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract SyntaxToken? AwaitKeyword { get; }
public abstract SyntaxToken ForEachKeyword { get; }
public abstract SyntaxToken OpenParenToken { get; }
public abstract SyntaxToken InKeyword { get; }
public abstract ExpressionSyntax Expression { get; }
public abstract SyntaxToken CloseParenToken { get; }
public abstract StatementSyntax Statement { get; }
}
internal sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken forEachKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override SyntaxToken? AwaitKeyword => this.awaitKeyword;
public override SyntaxToken ForEachKeyword => this.forEachKeyword;
public override SyntaxToken OpenParenToken => this.openParenToken;
public TypeSyntax Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override SyntaxToken InKeyword => this.inKeyword;
public override ExpressionSyntax Expression => this.expression;
public override SyntaxToken CloseParenToken => this.closeParenToken;
public override StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.forEachKeyword,
3 => this.openParenToken,
4 => this.type,
5 => this.identifier,
6 => this.inKeyword,
7 => this.expression,
8 => this.closeParenToken,
9 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitForEachStatement(this);
public ForEachStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal ForEachStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var forEachKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.forEachKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static ForEachStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ForEachStatementSyntax), r => new ForEachStatementSyntax(r));
}
}
internal sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken forEachKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax variable;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(variable);
this.variable = variable;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(variable);
this.variable = variable;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(variable);
this.variable = variable;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override SyntaxToken? AwaitKeyword => this.awaitKeyword;
public override SyntaxToken ForEachKeyword => this.forEachKeyword;
public override SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>
/// The variable(s) of the loop. In correct code this is a tuple
/// literal, declaration expression with a tuple designator, or
/// a discard syntax in the form of a simple identifier. In broken
/// code it could be something else.
/// </summary>
public ExpressionSyntax Variable => this.variable;
public override SyntaxToken InKeyword => this.inKeyword;
public override ExpressionSyntax Expression => this.expression;
public override SyntaxToken CloseParenToken => this.closeParenToken;
public override StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.forEachKeyword,
3 => this.openParenToken,
4 => this.variable,
5 => this.inKeyword,
6 => this.expression,
7 => this.closeParenToken,
8 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachVariableStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitForEachVariableStatement(this);
public ForEachVariableStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal ForEachVariableStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var forEachKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var variable = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(variable);
this.variable = variable;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.forEachKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.variable);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static ForEachVariableStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ForEachVariableStatementSyntax), r => new ForEachVariableStatementSyntax(r));
}
}
internal sealed partial class UsingStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken usingKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly VariableDeclarationSyntax? declaration;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken? AwaitKeyword => this.awaitKeyword;
public SyntaxToken UsingKeyword => this.usingKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public VariableDeclarationSyntax? Declaration => this.declaration;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.usingKeyword,
3 => this.openParenToken,
4 => this.declaration,
5 => this.expression,
6 => this.closeParenToken,
7 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUsingStatement(this);
public UsingStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal UsingStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var usingKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var declaration = (VariableDeclarationSyntax?)reader.ReadValue();
if (declaration != null)
{
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.usingKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.declaration);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static UsingStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UsingStatementSyntax), r => new UsingStatementSyntax(r));
}
}
internal sealed partial class FixedStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken fixedKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken FixedKeyword => this.fixedKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public VariableDeclarationSyntax Declaration => this.declaration;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.fixedKeyword,
2 => this.openParenToken,
3 => this.declaration,
4 => this.closeParenToken,
5 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FixedStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFixedStatement(this);
public FixedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal FixedStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var fixedKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.fixedKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.declaration);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static FixedStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FixedStatementSyntax), r => new FixedStatementSyntax(r));
}
}
internal sealed partial class CheckedStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken keyword;
internal readonly BlockSyntax block;
internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken Keyword => this.keyword;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.keyword,
2 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCheckedStatement(this);
public CheckedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block)
{
if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block)
{
var newNode = SyntaxFactory.CheckedStatement(this.Kind, attributeLists, keyword, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, GetDiagnostics(), annotations);
internal CheckedStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.keyword);
writer.WriteValue(this.block);
}
static CheckedStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CheckedStatementSyntax), r => new CheckedStatementSyntax(r));
}
}
internal sealed partial class UnsafeStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken unsafeKeyword;
internal readonly BlockSyntax block;
internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken UnsafeKeyword => this.unsafeKeyword;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.unsafeKeyword,
2 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnsafeStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUnsafeStatement(this);
public UnsafeStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
{
if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block)
{
var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, GetDiagnostics(), annotations);
internal UnsafeStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var unsafeKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.unsafeKeyword);
writer.WriteValue(this.block);
}
static UnsafeStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UnsafeStatementSyntax), r => new UnsafeStatementSyntax(r));
}
}
internal sealed partial class LockStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken lockKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken LockKeyword => this.lockKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax Expression => this.expression;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.lockKeyword,
2 => this.openParenToken,
3 => this.expression,
4 => this.closeParenToken,
5 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LockStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLockStatement(this);
public LockStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal LockStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var lockKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.lockKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static LockStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LockStatementSyntax), r => new LockStatementSyntax(r));
}
}
/// <summary>
/// Represents an if statement syntax.
/// </summary>
internal sealed partial class IfStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken ifKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal readonly ElseClauseSyntax? @else;
internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
if (@else != null)
{
this.AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
if (@else != null)
{
this.AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else)
: base(kind)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
if (@else != null)
{
this.AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>
/// Gets a SyntaxToken that represents the if keyword.
/// </summary>
public SyntaxToken IfKeyword => this.ifKeyword;
/// <summary>
/// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression.
/// </summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>
/// Gets an ExpressionSyntax that represents the condition of the if statement.
/// </summary>
public ExpressionSyntax Condition => this.condition;
/// <summary>
/// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression.
/// </summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
/// <summary>
/// Gets a StatementSyntax the represents the statement to be executed when the condition is true.
/// </summary>
public StatementSyntax Statement => this.statement;
/// <summary>
/// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists.
/// </summary>
public ElseClauseSyntax? Else => this.@else;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.ifKeyword,
2 => this.openParenToken,
3 => this.condition,
4 => this.closeParenToken,
5 => this.statement,
6 => this.@else,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIfStatement(this);
public IfStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else)
{
if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else)
{
var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, GetDiagnostics(), annotations);
internal IfStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 7;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var ifKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
var @else = (ElseClauseSyntax?)reader.ReadValue();
if (@else != null)
{
AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.ifKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
writer.WriteValue(this.@else);
}
static IfStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IfStatementSyntax), r => new IfStatementSyntax(r));
}
}
/// <summary>Represents an else statement syntax.</summary>
internal sealed partial class ElseClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken elseKeyword;
internal readonly StatementSyntax statement;
internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
/// <summary>
/// Gets a syntax token
/// </summary>
public SyntaxToken ElseKeyword => this.elseKeyword;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elseKeyword,
1 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElseClause(this);
public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement)
{
if (elseKeyword != this.ElseKeyword || statement != this.Statement)
{
var newNode = SyntaxFactory.ElseClause(elseKeyword, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, GetDiagnostics(), annotations);
internal ElseClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elseKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elseKeyword);
writer.WriteValue(this.statement);
}
static ElseClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElseClauseSyntax), r => new ElseClauseSyntax(r));
}
}
/// <summary>Represents a switch statement syntax.</summary>
internal sealed partial class SwitchStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken switchKeyword;
internal readonly SyntaxToken? openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken? closeParenToken;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? sections;
internal readonly SyntaxToken closeBraceToken;
internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
if (openParenToken != null)
{
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (closeParenToken != null)
{
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (sections != null)
{
this.AdjustFlagsAndWidth(sections);
this.sections = sections;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
if (openParenToken != null)
{
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (closeParenToken != null)
{
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (sections != null)
{
this.AdjustFlagsAndWidth(sections);
this.sections = sections;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
if (openParenToken != null)
{
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (closeParenToken != null)
{
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (sections != null)
{
this.AdjustFlagsAndWidth(sections);
this.sections = sections;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>
/// Gets a SyntaxToken that represents the switch keyword.
/// </summary>
public SyntaxToken SwitchKeyword => this.switchKeyword;
/// <summary>
/// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression.
/// </summary>
public SyntaxToken? OpenParenToken => this.openParenToken;
/// <summary>
/// Gets an ExpressionSyntax representing the expression of the switch statement.
/// </summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>
/// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression.
/// </summary>
public SyntaxToken? CloseParenToken => this.closeParenToken;
/// <summary>
/// Gets a SyntaxToken that represents the open braces preceding the switch sections.
/// </summary>
public SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>
/// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement.
/// </summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> Sections => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax>(this.sections);
/// <summary>
/// Gets a SyntaxToken that represents the open braces following the switch sections.
/// </summary>
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.switchKeyword,
2 => this.openParenToken,
3 => this.expression,
4 => this.closeParenToken,
5 => this.openBraceToken,
6 => this.sections,
7 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchStatement(this);
public SwitchStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> sections, SyntaxToken closeBraceToken)
{
if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, GetDiagnostics(), annotations);
internal SwitchStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var switchKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
var openParenToken = (SyntaxToken?)reader.ReadValue();
if (openParenToken != null)
{
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken?)reader.ReadValue();
if (closeParenToken != null)
{
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var sections = (GreenNode?)reader.ReadValue();
if (sections != null)
{
AdjustFlagsAndWidth(sections);
this.sections = sections;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.switchKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.sections);
writer.WriteValue(this.closeBraceToken);
}
static SwitchStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchStatementSyntax), r => new SwitchStatementSyntax(r));
}
}
/// <summary>Represents a switch section syntax of a switch statement.</summary>
internal sealed partial class SwitchSectionSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? labels;
internal readonly GreenNode? statements;
internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (labels != null)
{
this.AdjustFlagsAndWidth(labels);
this.labels = labels;
}
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (labels != null)
{
this.AdjustFlagsAndWidth(labels);
this.labels = labels;
}
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements)
: base(kind)
{
this.SlotCount = 2;
if (labels != null)
{
this.AdjustFlagsAndWidth(labels);
this.labels = labels;
}
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
/// <summary>
/// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section.
/// </summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> Labels => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax>(this.labels);
/// <summary>
/// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section.
/// </summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax>(this.statements);
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.labels,
1 => this.statements,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchSectionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchSection(this);
public SwitchSectionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements)
{
if (labels != this.Labels || statements != this.Statements)
{
var newNode = SyntaxFactory.SwitchSection(labels, statements);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchSectionSyntax(this.Kind, this.labels, this.statements, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchSectionSyntax(this.Kind, this.labels, this.statements, GetDiagnostics(), annotations);
internal SwitchSectionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var labels = (GreenNode?)reader.ReadValue();
if (labels != null)
{
AdjustFlagsAndWidth(labels);
this.labels = labels;
}
var statements = (GreenNode?)reader.ReadValue();
if (statements != null)
{
AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.labels);
writer.WriteValue(this.statements);
}
static SwitchSectionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchSectionSyntax), r => new SwitchSectionSyntax(r));
}
}
/// <summary>Represents a switch label within a switch statement.</summary>
internal abstract partial class SwitchLabelSyntax : CSharpSyntaxNode
{
internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal SwitchLabelSyntax(SyntaxKind kind)
: base(kind)
{
}
protected SwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>
/// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label.
/// </summary>
public abstract SyntaxToken Keyword { get; }
/// <summary>
/// Gets a SyntaxToken that represents the colon that terminates the switch label.
/// </summary>
public abstract SyntaxToken ColonToken { get; }
}
/// <summary>Represents a case label within a switch statement.</summary>
internal sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax
{
internal readonly SyntaxToken keyword;
internal readonly PatternSyntax pattern;
internal readonly WhenClauseSyntax? whenClause;
internal readonly SyntaxToken colonToken;
internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the case keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
/// <summary>
/// Gets a PatternSyntax that represents the pattern that gets matched for the case label.
/// </summary>
public PatternSyntax Pattern => this.pattern;
public WhenClauseSyntax? WhenClause => this.whenClause;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.pattern,
2 => this.whenClause,
3 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CasePatternSwitchLabelSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCasePatternSwitchLabel(this);
public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken colonToken)
{
if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, GetDiagnostics(), annotations);
internal CasePatternSwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
var whenClause = (WhenClauseSyntax?)reader.ReadValue();
if (whenClause != null)
{
AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.pattern);
writer.WriteValue(this.whenClause);
writer.WriteValue(this.colonToken);
}
static CasePatternSwitchLabelSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CasePatternSwitchLabelSyntax), r => new CasePatternSwitchLabelSyntax(r));
}
}
/// <summary>Represents a case label within a switch statement.</summary>
internal sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax
{
internal readonly SyntaxToken keyword;
internal readonly ExpressionSyntax value;
internal readonly SyntaxToken colonToken;
internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(value);
this.value = value;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(value);
this.value = value;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(value);
this.value = value;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the case keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
/// <summary>
/// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label.
/// </summary>
public ExpressionSyntax Value => this.value;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.value,
2 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CaseSwitchLabelSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCaseSwitchLabel(this);
public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
{
if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, GetDiagnostics(), annotations);
internal CaseSwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var value = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(value);
this.value = value;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.value);
writer.WriteValue(this.colonToken);
}
static CaseSwitchLabelSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CaseSwitchLabelSyntax), r => new CaseSwitchLabelSyntax(r));
}
}
/// <summary>Represents a default label within a switch statement.</summary>
internal sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken colonToken;
internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the default keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultSwitchLabelSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefaultSwitchLabel(this);
public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken)
{
if (keyword != this.Keyword || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, GetDiagnostics(), annotations);
internal DefaultSwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.colonToken);
}
static DefaultSwitchLabelSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefaultSwitchLabelSyntax), r => new DefaultSwitchLabelSyntax(r));
}
}
internal sealed partial class SwitchExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax governingExpression;
internal readonly SyntaxToken switchKeyword;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? arms;
internal readonly SyntaxToken closeBraceToken;
internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (arms != null)
{
this.AdjustFlagsAndWidth(arms);
this.arms = arms;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (arms != null)
{
this.AdjustFlagsAndWidth(arms);
this.arms = arms;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (arms != null)
{
this.AdjustFlagsAndWidth(arms);
this.arms = arms;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public ExpressionSyntax GoverningExpression => this.governingExpression;
public SyntaxToken SwitchKeyword => this.switchKeyword;
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> Arms => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arms));
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.governingExpression,
1 => this.switchKeyword,
2 => this.openBraceToken,
3 => this.arms,
4 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchExpression(this);
public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, GetDiagnostics(), annotations);
internal SwitchExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var governingExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
var switchKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var arms = (GreenNode?)reader.ReadValue();
if (arms != null)
{
AdjustFlagsAndWidth(arms);
this.arms = arms;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.governingExpression);
writer.WriteValue(this.switchKeyword);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.arms);
writer.WriteValue(this.closeBraceToken);
}
static SwitchExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionSyntax), r => new SwitchExpressionSyntax(r));
}
}
internal sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode
{
internal readonly PatternSyntax pattern;
internal readonly WhenClauseSyntax? whenClause;
internal readonly SyntaxToken equalsGreaterThanToken;
internal readonly ExpressionSyntax expression;
internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public PatternSyntax Pattern => this.pattern;
public WhenClauseSyntax? WhenClause => this.whenClause;
public SyntaxToken EqualsGreaterThanToken => this.equalsGreaterThanToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.pattern,
1 => this.whenClause,
2 => this.equalsGreaterThanToken,
3 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionArmSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchExpressionArm(this);
public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
{
if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression)
{
var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, GetDiagnostics(), annotations);
internal SwitchExpressionArmSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
var whenClause = (WhenClauseSyntax?)reader.ReadValue();
if (whenClause != null)
{
AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
var equalsGreaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.pattern);
writer.WriteValue(this.whenClause);
writer.WriteValue(this.equalsGreaterThanToken);
writer.WriteValue(this.expression);
}
static SwitchExpressionArmSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionArmSyntax), r => new SwitchExpressionArmSyntax(r));
}
}
internal sealed partial class TryStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken tryKeyword;
internal readonly BlockSyntax block;
internal readonly GreenNode? catches;
internal readonly FinallyClauseSyntax? @finally;
internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
if (catches != null)
{
this.AdjustFlagsAndWidth(catches);
this.catches = catches;
}
if (@finally != null)
{
this.AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
if (catches != null)
{
this.AdjustFlagsAndWidth(catches);
this.catches = catches;
}
if (@finally != null)
{
this.AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
if (catches != null)
{
this.AdjustFlagsAndWidth(catches);
this.catches = catches;
}
if (@finally != null)
{
this.AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken TryKeyword => this.tryKeyword;
public BlockSyntax Block => this.block;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> Catches => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax>(this.catches);
public FinallyClauseSyntax? Finally => this.@finally;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.tryKeyword,
2 => this.block,
3 => this.catches,
4 => this.@finally,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TryStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTryStatement(this);
public TryStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> catches, FinallyClauseSyntax @finally)
{
if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally)
{
var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, GetDiagnostics(), annotations);
internal TryStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var tryKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
var catches = (GreenNode?)reader.ReadValue();
if (catches != null)
{
AdjustFlagsAndWidth(catches);
this.catches = catches;
}
var @finally = (FinallyClauseSyntax?)reader.ReadValue();
if (@finally != null)
{
AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.tryKeyword);
writer.WriteValue(this.block);
writer.WriteValue(this.catches);
writer.WriteValue(this.@finally);
}
static TryStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TryStatementSyntax), r => new TryStatementSyntax(r));
}
}
internal sealed partial class CatchClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken catchKeyword;
internal readonly CatchDeclarationSyntax? declaration;
internal readonly CatchFilterClauseSyntax? filter;
internal readonly BlockSyntax block;
internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (filter != null)
{
this.AdjustFlagsAndWidth(filter);
this.filter = filter;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (filter != null)
{
this.AdjustFlagsAndWidth(filter);
this.filter = filter;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (filter != null)
{
this.AdjustFlagsAndWidth(filter);
this.filter = filter;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public SyntaxToken CatchKeyword => this.catchKeyword;
public CatchDeclarationSyntax? Declaration => this.declaration;
public CatchFilterClauseSyntax? Filter => this.filter;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.catchKeyword,
1 => this.declaration,
2 => this.filter,
3 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCatchClause(this);
public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax declaration, CatchFilterClauseSyntax filter, BlockSyntax block)
{
if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block)
{
var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, GetDiagnostics(), annotations);
internal CatchClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var catchKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
var declaration = (CatchDeclarationSyntax?)reader.ReadValue();
if (declaration != null)
{
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
var filter = (CatchFilterClauseSyntax?)reader.ReadValue();
if (filter != null)
{
AdjustFlagsAndWidth(filter);
this.filter = filter;
}
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.catchKeyword);
writer.WriteValue(this.declaration);
writer.WriteValue(this.filter);
writer.WriteValue(this.block);
}
static CatchClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CatchClauseSyntax), r => new CatchClauseSyntax(r));
}
}
internal sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken? identifier;
internal readonly SyntaxToken closeParenToken;
internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public TypeSyntax Type => this.type;
public SyntaxToken? Identifier => this.identifier;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.type,
2 => this.identifier,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCatchDeclaration(this);
public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, GetDiagnostics(), annotations);
internal CatchDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var identifier = (SyntaxToken?)reader.ReadValue();
if (identifier != null)
{
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.closeParenToken);
}
static CatchDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CatchDeclarationSyntax), r => new CatchDeclarationSyntax(r));
}
}
internal sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken whenKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax filterExpression;
internal readonly SyntaxToken closeParenToken;
internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken WhenKeyword => this.whenKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax FilterExpression => this.filterExpression;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whenKeyword,
1 => this.openParenToken,
2 => this.filterExpression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchFilterClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCatchFilterClause(this);
public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
{
if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, GetDiagnostics(), annotations);
internal CatchFilterClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var whenKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var filterExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whenKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.filterExpression);
writer.WriteValue(this.closeParenToken);
}
static CatchFilterClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CatchFilterClauseSyntax), r => new CatchFilterClauseSyntax(r));
}
}
internal sealed partial class FinallyClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken finallyKeyword;
internal readonly BlockSyntax block;
internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public SyntaxToken FinallyKeyword => this.finallyKeyword;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.finallyKeyword,
1 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FinallyClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFinallyClause(this);
public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block)
{
if (finallyKeyword != this.FinallyKeyword || block != this.Block)
{
var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, GetDiagnostics(), annotations);
internal FinallyClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var finallyKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.finallyKeyword);
writer.WriteValue(this.block);
}
static FinallyClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FinallyClauseSyntax), r => new FinallyClauseSyntax(r));
}
}
internal sealed partial class CompilationUnitSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? externs;
internal readonly GreenNode? usings;
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? members;
internal readonly SyntaxToken endOfFileToken;
internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken)
: base(kind)
{
this.SlotCount = 5;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax>(this.externs);
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax>(this.usings);
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public SyntaxToken EndOfFileToken => this.endOfFileToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.externs,
1 => this.usings,
2 => this.attributeLists,
3 => this.members,
4 => this.endOfFileToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CompilationUnitSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCompilationUnit(this);
public CompilationUnitSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken endOfFileToken)
{
if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken)
{
var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, GetDiagnostics(), annotations);
internal CompilationUnitSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var externs = (GreenNode?)reader.ReadValue();
if (externs != null)
{
AdjustFlagsAndWidth(externs);
this.externs = externs;
}
var usings = (GreenNode?)reader.ReadValue();
if (usings != null)
{
AdjustFlagsAndWidth(usings);
this.usings = usings;
}
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var endOfFileToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.externs);
writer.WriteValue(this.usings);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.members);
writer.WriteValue(this.endOfFileToken);
}
static CompilationUnitSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CompilationUnitSyntax), r => new CompilationUnitSyntax(r));
}
}
/// <summary>
/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line.
/// </summary>
internal sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken externKeyword;
internal readonly SyntaxToken aliasKeyword;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken semicolonToken;
internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
this.AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
this.AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
this.AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
/// <summary>SyntaxToken representing the extern keyword.</summary>
public SyntaxToken ExternKeyword => this.externKeyword;
/// <summary>SyntaxToken representing the alias keyword.</summary>
public SyntaxToken AliasKeyword => this.aliasKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
/// <summary>SyntaxToken representing the semicolon token.</summary>
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.externKeyword,
1 => this.aliasKeyword,
2 => this.identifier,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExternAliasDirectiveSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExternAliasDirective(this);
public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
{
if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, GetDiagnostics(), annotations);
internal ExternAliasDirectiveSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var externKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
var aliasKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.externKeyword);
writer.WriteValue(this.aliasKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.semicolonToken);
}
static ExternAliasDirectiveSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExternAliasDirectiveSyntax), r => new ExternAliasDirectiveSyntax(r));
}
}
internal sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken? globalKeyword;
internal readonly SyntaxToken usingKeyword;
internal readonly SyntaxToken? staticKeyword;
internal readonly NameEqualsSyntax? alias;
internal readonly NameSyntax name;
internal readonly SyntaxToken semicolonToken;
internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (globalKeyword != null)
{
this.AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
if (staticKeyword != null)
{
this.AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
if (alias != null)
{
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
}
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (globalKeyword != null)
{
this.AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
if (staticKeyword != null)
{
this.AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
if (alias != null)
{
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
}
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 6;
if (globalKeyword != null)
{
this.AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
if (staticKeyword != null)
{
this.AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
if (alias != null)
{
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
}
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public SyntaxToken? GlobalKeyword => this.globalKeyword;
public SyntaxToken UsingKeyword => this.usingKeyword;
public SyntaxToken? StaticKeyword => this.staticKeyword;
public NameEqualsSyntax? Alias => this.alias;
public NameSyntax Name => this.name;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.globalKeyword,
1 => this.usingKeyword,
2 => this.staticKeyword,
3 => this.alias,
4 => this.name,
5 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingDirectiveSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUsingDirective(this);
public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, NameEqualsSyntax alias, NameSyntax name, SyntaxToken semicolonToken)
{
if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || alias != this.Alias || name != this.Name || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, alias, name, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.alias, this.name, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.alias, this.name, this.semicolonToken, GetDiagnostics(), annotations);
internal UsingDirectiveSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var globalKeyword = (SyntaxToken?)reader.ReadValue();
if (globalKeyword != null)
{
AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
var usingKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
var staticKeyword = (SyntaxToken?)reader.ReadValue();
if (staticKeyword != null)
{
AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
var alias = (NameEqualsSyntax?)reader.ReadValue();
if (alias != null)
{
AdjustFlagsAndWidth(alias);
this.alias = alias;
}
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.globalKeyword);
writer.WriteValue(this.usingKeyword);
writer.WriteValue(this.staticKeyword);
writer.WriteValue(this.alias);
writer.WriteValue(this.name);
writer.WriteValue(this.semicolonToken);
}
static UsingDirectiveSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UsingDirectiveSyntax), r => new UsingDirectiveSyntax(r));
}
}
/// <summary>Member declaration syntax.</summary>
internal abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode
{
internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal MemberDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected MemberDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the attribute declaration list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
/// <summary>Gets the modifier list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers { get; }
}
internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseNamespaceDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseNamespaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract SyntaxToken NamespaceKeyword { get; }
public abstract NameSyntax Name { get; }
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs { get; }
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings { get; }
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members { get; }
}
internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken namespaceKeyword;
internal readonly NameSyntax name;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? externs;
internal readonly GreenNode? usings;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override SyntaxToken NamespaceKeyword => this.namespaceKeyword;
public override NameSyntax Name => this.name;
public SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax>(this.externs);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax>(this.usings);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public SyntaxToken CloseBraceToken => this.closeBraceToken;
/// <summary>Gets the optional semicolon token.</summary>
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.namespaceKeyword,
3 => this.name,
4 => this.openBraceToken,
5 => this.externs,
6 => this.usings,
7 => this.members,
8 => this.closeBraceToken,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NamespaceDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNamespaceDeclaration(this);
public NamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal NamespaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var namespaceKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var externs = (GreenNode?)reader.ReadValue();
if (externs != null)
{
AdjustFlagsAndWidth(externs);
this.externs = externs;
}
var usings = (GreenNode?)reader.ReadValue();
if (usings != null)
{
AdjustFlagsAndWidth(usings);
this.usings = usings;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.namespaceKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.externs);
writer.WriteValue(this.usings);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static NamespaceDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NamespaceDeclarationSyntax), r => new NamespaceDeclarationSyntax(r));
}
}
internal sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken namespaceKeyword;
internal readonly NameSyntax name;
internal readonly SyntaxToken semicolonToken;
internal readonly GreenNode? externs;
internal readonly GreenNode? usings;
internal readonly GreenNode? members;
internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
}
internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
}
internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override SyntaxToken NamespaceKeyword => this.namespaceKeyword;
public override NameSyntax Name => this.name;
public SyntaxToken SemicolonToken => this.semicolonToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax>(this.externs);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax>(this.usings);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.namespaceKeyword,
3 => this.name,
4 => this.semicolonToken,
5 => this.externs,
6 => this.usings,
7 => this.members,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FileScopedNamespaceDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFileScopedNamespaceDeclaration(this);
public FileScopedNamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members)
{
var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, GetDiagnostics(), annotations);
internal FileScopedNamespaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var namespaceKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
var externs = (GreenNode?)reader.ReadValue();
if (externs != null)
{
AdjustFlagsAndWidth(externs);
this.externs = externs;
}
var usings = (GreenNode?)reader.ReadValue();
if (usings != null)
{
AdjustFlagsAndWidth(usings);
this.usings = usings;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.namespaceKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.semicolonToken);
writer.WriteValue(this.externs);
writer.WriteValue(this.usings);
writer.WriteValue(this.members);
}
static FileScopedNamespaceDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FileScopedNamespaceDeclarationSyntax), r => new FileScopedNamespaceDeclarationSyntax(r));
}
}
/// <summary>Class representing one or more attributes applied to a language construct.</summary>
internal sealed partial class AttributeListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBracketToken;
internal readonly AttributeTargetSpecifierSyntax? target;
internal readonly GreenNode? attributes;
internal readonly SyntaxToken closeBracketToken;
internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (target != null)
{
this.AdjustFlagsAndWidth(target);
this.target = target;
}
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (target != null)
{
this.AdjustFlagsAndWidth(target);
this.target = target;
}
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (target != null)
{
this.AdjustFlagsAndWidth(target);
this.target = target;
}
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>Gets the open bracket token.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>Gets the optional construct targeted by the attribute.</summary>
public AttributeTargetSpecifierSyntax? Target => this.target;
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.attributes));
/// <summary>Gets the close bracket token.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.target,
2 => this.attributes,
3 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeList(this);
public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, GetDiagnostics(), annotations);
internal AttributeListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var target = (AttributeTargetSpecifierSyntax?)reader.ReadValue();
if (target != null)
{
AdjustFlagsAndWidth(target);
this.target = target;
}
var attributes = (GreenNode?)reader.ReadValue();
if (attributes != null)
{
AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.target);
writer.WriteValue(this.attributes);
writer.WriteValue(this.closeBracketToken);
}
static AttributeListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeListSyntax), r => new AttributeListSyntax(r));
}
}
/// <summary>Class representing what language construct an attribute targets.</summary>
internal sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken colonToken;
internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.identifier,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeTargetSpecifierSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeTargetSpecifier(this);
public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken)
{
if (identifier != this.Identifier || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, GetDiagnostics(), annotations);
internal AttributeTargetSpecifierSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
writer.WriteValue(this.colonToken);
}
static AttributeTargetSpecifierSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeTargetSpecifierSyntax), r => new AttributeTargetSpecifierSyntax(r));
}
}
/// <summary>Attribute syntax.</summary>
internal sealed partial class AttributeSyntax : CSharpSyntaxNode
{
internal readonly NameSyntax name;
internal readonly AttributeArgumentListSyntax? argumentList;
internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
/// <summary>Gets the name.</summary>
public NameSyntax Name => this.name;
public AttributeArgumentListSyntax? ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttribute(this);
public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax argumentList)
{
if (name != this.Name || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.Attribute(name, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeSyntax(this.Kind, this.name, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeSyntax(this.Kind, this.name, this.argumentList, GetDiagnostics(), annotations);
internal AttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var argumentList = (AttributeArgumentListSyntax?)reader.ReadValue();
if (argumentList != null)
{
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.argumentList);
}
static AttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeSyntax), r => new AttributeSyntax(r));
}
}
/// <summary>Attribute argument list syntax.</summary>
internal sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeParenToken;
internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the open paren token.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Gets the arguments syntax list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>Gets the close paren token.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.arguments,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeArgumentList(this);
public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations);
internal AttributeArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeParenToken);
}
static AttributeArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentListSyntax), r => new AttributeArgumentListSyntax(r));
}
}
/// <summary>Attribute argument syntax.</summary>
internal sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode
{
internal readonly NameEqualsSyntax? nameEquals;
internal readonly NameColonSyntax? nameColon;
internal readonly ExpressionSyntax expression;
internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 3;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public NameEqualsSyntax? NameEquals => this.nameEquals;
public NameColonSyntax? NameColon => this.nameColon;
/// <summary>Gets the expression.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.nameEquals,
1 => this.nameColon,
2 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeArgument(this);
public AttributeArgumentSyntax Update(NameEqualsSyntax nameEquals, NameColonSyntax nameColon, ExpressionSyntax expression)
{
if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression)
{
var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, GetDiagnostics(), annotations);
internal AttributeArgumentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var nameEquals = (NameEqualsSyntax?)reader.ReadValue();
if (nameEquals != null)
{
AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
var nameColon = (NameColonSyntax?)reader.ReadValue();
if (nameColon != null)
{
AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.nameEquals);
writer.WriteValue(this.nameColon);
writer.WriteValue(this.expression);
}
static AttributeArgumentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentSyntax), r => new AttributeArgumentSyntax(r));
}
}
/// <summary>Class representing an identifier name followed by an equals token.</summary>
internal sealed partial class NameEqualsSyntax : CSharpSyntaxNode
{
internal readonly IdentifierNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
/// <summary>Gets the identifier name.</summary>
public IdentifierNameSyntax Name => this.name;
public SyntaxToken EqualsToken => this.equalsToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameEqualsSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNameEquals(this);
public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken)
{
if (name != this.Name || equalsToken != this.EqualsToken)
{
var newNode = SyntaxFactory.NameEquals(name, equalsToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, GetDiagnostics(), annotations);
internal NameEqualsSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
}
static NameEqualsSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NameEqualsSyntax), r => new NameEqualsSyntax(r));
}
}
/// <summary>Type parameter list syntax.</summary>
internal sealed partial class TypeParameterListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken greaterThanToken;
internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
/// <summary>Gets the < token.</summary>
public SyntaxToken LessThanToken => this.lessThanToken;
/// <summary>Gets the parameter list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the > token.</summary>
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.parameters,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeParameterList(this);
public TypeParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations);
internal TypeParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.greaterThanToken);
}
static TypeParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeParameterListSyntax), r => new TypeParameterListSyntax(r));
}
}
/// <summary>Type parameter syntax.</summary>
internal sealed partial class TypeParameterSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? varianceKeyword;
internal readonly SyntaxToken identifier;
internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (varianceKeyword != null)
{
this.AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (varianceKeyword != null)
{
this.AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (varianceKeyword != null)
{
this.AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken? VarianceKeyword => this.varianceKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.varianceKeyword,
2 => this.identifier,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeParameter(this);
public TypeParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier)
{
if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier)
{
var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, GetDiagnostics(), annotations);
internal TypeParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var varianceKeyword = (SyntaxToken?)reader.ReadValue();
if (varianceKeyword != null)
{
AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.varianceKeyword);
writer.WriteValue(this.identifier);
}
static TypeParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeParameterSyntax), r => new TypeParameterSyntax(r));
}
}
/// <summary>Base class for type declaration syntax.</summary>
internal abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseTypeDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseTypeDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the identifier.</summary>
public abstract SyntaxToken Identifier { get; }
/// <summary>Gets the base type list.</summary>
public abstract BaseListSyntax? BaseList { get; }
/// <summary>Gets the open brace token.</summary>
public abstract SyntaxToken? OpenBraceToken { get; }
/// <summary>Gets the close brace token.</summary>
public abstract SyntaxToken? CloseBraceToken { get; }
/// <summary>Gets the optional semicolon token.</summary>
public abstract SyntaxToken? SemicolonToken { get; }
}
/// <summary>Base class for type declaration syntax (class, struct, interface, record).</summary>
internal abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax
{
internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal TypeDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected TypeDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the type keyword token ("class", "struct", "interface", "record").</summary>
public abstract SyntaxToken Keyword { get; }
public abstract TypeParameterListSyntax? TypeParameterList { get; }
/// <summary>Gets the type constraint list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses { get; }
/// <summary>Gets the member declarations.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members { get; }
}
/// <summary>Class type declaration syntax.</summary>
internal sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the class keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.baseList,
6 => this.constraintClauses,
7 => this.openBraceToken,
8 => this.members,
9 => this.closeBraceToken,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitClassDeclaration(this);
public ClassDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal ClassDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static ClassDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ClassDeclarationSyntax), r => new ClassDeclarationSyntax(r));
}
}
/// <summary>Struct type declaration syntax.</summary>
internal sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the struct keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.baseList,
6 => this.constraintClauses,
7 => this.openBraceToken,
8 => this.members,
9 => this.closeBraceToken,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StructDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitStructDeclaration(this);
public StructDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal StructDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static StructDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(StructDeclarationSyntax), r => new StructDeclarationSyntax(r));
}
}
/// <summary>Interface type declaration syntax.</summary>
internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the interface keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.baseList,
6 => this.constraintClauses,
7 => this.openBraceToken,
8 => this.members,
9 => this.closeBraceToken,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterfaceDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterfaceDeclaration(this);
public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal InterfaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static InterfaceDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterfaceDeclarationSyntax), r => new InterfaceDeclarationSyntax(r));
}
}
internal sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken? classOrStructKeyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax? parameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken? openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken? closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 13;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (classOrStructKeyword != null)
{
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (openBraceToken != null)
{
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
if (closeBraceToken != null)
{
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 13;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (classOrStructKeyword != null)
{
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (openBraceToken != null)
{
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
if (closeBraceToken != null)
{
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 13;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (classOrStructKeyword != null)
{
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (openBraceToken != null)
{
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
if (closeBraceToken != null)
{
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override SyntaxToken Keyword => this.keyword;
public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public ParameterListSyntax? ParameterList => this.parameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken? OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken? CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.classOrStructKeyword,
4 => this.identifier,
5 => this.typeParameterList,
6 => this.parameterList,
7 => this.baseList,
8 => this.constraintClauses,
9 => this.openBraceToken,
10 => this.members,
11 => this.closeBraceToken,
12 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecordDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRecordDeclaration(this);
public RecordDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.RecordDeclaration(this.Kind, attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal RecordDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 13;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var classOrStructKeyword = (SyntaxToken?)reader.ReadValue();
if (classOrStructKeyword != null)
{
AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax?)reader.ReadValue();
if (parameterList != null)
{
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken?)reader.ReadValue();
if (openBraceToken != null)
{
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken?)reader.ReadValue();
if (closeBraceToken != null)
{
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.classOrStructKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static RecordDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RecordDeclarationSyntax), r => new RecordDeclarationSyntax(r));
}
}
/// <summary>Enum type declaration syntax.</summary>
internal sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken enumKeyword;
internal readonly SyntaxToken identifier;
internal readonly BaseListSyntax? baseList;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the enum keyword token.</summary>
public SyntaxToken EnumKeyword => this.enumKeyword;
public override SyntaxToken Identifier => this.identifier;
public override BaseListSyntax? BaseList => this.baseList;
public override SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>Gets the members declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.members));
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.enumKeyword,
3 => this.identifier,
4 => this.baseList,
5 => this.openBraceToken,
6 => this.members,
7 => this.closeBraceToken,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEnumDeclaration(this);
public EnumDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal EnumDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var enumKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.enumKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.baseList);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static EnumDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EnumDeclarationSyntax), r => new EnumDeclarationSyntax(r));
}
}
/// <summary>Delegate declaration syntax.</summary>
internal sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken delegateKeyword;
internal readonly TypeSyntax returnType;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax parameterList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken semicolonToken;
internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the "delegate" keyword.</summary>
public SyntaxToken DelegateKeyword => this.delegateKeyword;
/// <summary>Gets the return type.</summary>
public TypeSyntax ReturnType => this.returnType;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
/// <summary>Gets the parameter list.</summary>
public ParameterListSyntax ParameterList => this.parameterList;
/// <summary>Gets the constraint clause list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
/// <summary>Gets the semicolon token.</summary>
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.delegateKeyword,
3 => this.returnType,
4 => this.identifier,
5 => this.typeParameterList,
6 => this.parameterList,
7 => this.constraintClauses,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DelegateDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDelegateDeclaration(this);
public DelegateDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, GetDiagnostics(), annotations);
internal DelegateDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var delegateKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.delegateKeyword);
writer.WriteValue(this.returnType);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.semicolonToken);
}
static DelegateDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DelegateDeclarationSyntax), r => new DelegateDeclarationSyntax(r));
}
}
internal sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken identifier;
internal readonly EqualsValueClauseSyntax? equalsValue;
internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (equalsValue != null)
{
this.AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (equalsValue != null)
{
this.AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (equalsValue != null)
{
this.AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public EqualsValueClauseSyntax? EqualsValue => this.equalsValue;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.identifier,
3 => this.equalsValue,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumMemberDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEnumMemberDeclaration(this);
public EnumMemberDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue)
{
var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, GetDiagnostics(), annotations);
internal EnumMemberDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var equalsValue = (EqualsValueClauseSyntax?)reader.ReadValue();
if (equalsValue != null)
{
AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.identifier);
writer.WriteValue(this.equalsValue);
}
static EnumMemberDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EnumMemberDeclarationSyntax), r => new EnumMemberDeclarationSyntax(r));
}
}
/// <summary>Base list syntax.</summary>
internal sealed partial class BaseListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken colonToken;
internal readonly GreenNode? types;
internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (types != null)
{
this.AdjustFlagsAndWidth(types);
this.types = types;
}
}
internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (types != null)
{
this.AdjustFlagsAndWidth(types);
this.types = types;
}
}
internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (types != null)
{
this.AdjustFlagsAndWidth(types);
this.types = types;
}
}
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>Gets the base type references.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> Types => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.types));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.colonToken,
1 => this.types,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBaseList(this);
public BaseListSyntax Update(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> types)
{
if (colonToken != this.ColonToken || types != this.Types)
{
var newNode = SyntaxFactory.BaseList(colonToken, types);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BaseListSyntax(this.Kind, this.colonToken, this.types, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BaseListSyntax(this.Kind, this.colonToken, this.types, GetDiagnostics(), annotations);
internal BaseListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var types = (GreenNode?)reader.ReadValue();
if (types != null)
{
AdjustFlagsAndWidth(types);
this.types = types;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.types);
}
static BaseListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BaseListSyntax), r => new BaseListSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class BaseTypeSyntax : CSharpSyntaxNode
{
internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseTypeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseTypeSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract TypeSyntax Type { get; }
}
internal sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax
{
internal readonly TypeSyntax type;
internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public override TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleBaseTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSimpleBaseType(this);
public SimpleBaseTypeSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.SimpleBaseType(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SimpleBaseTypeSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SimpleBaseTypeSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal SimpleBaseTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static SimpleBaseTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SimpleBaseTypeSyntax), r => new SimpleBaseTypeSyntax(r));
}
}
internal sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax
{
internal readonly TypeSyntax type;
internal readonly ArgumentListSyntax argumentList;
internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
public override TypeSyntax Type => this.type;
public ArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrimaryConstructorBaseTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPrimaryConstructorBaseType(this);
public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList)
{
if (type != this.Type || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, GetDiagnostics(), annotations);
internal PrimaryConstructorBaseTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.argumentList);
}
static PrimaryConstructorBaseTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PrimaryConstructorBaseTypeSyntax), r => new PrimaryConstructorBaseTypeSyntax(r));
}
}
/// <summary>Type parameter constraint clause.</summary>
internal sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken whereKeyword;
internal readonly IdentifierNameSyntax name;
internal readonly SyntaxToken colonToken;
internal readonly GreenNode? constraints;
internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (constraints != null)
{
this.AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (constraints != null)
{
this.AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (constraints != null)
{
this.AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
public SyntaxToken WhereKeyword => this.whereKeyword;
/// <summary>Gets the identifier.</summary>
public IdentifierNameSyntax Name => this.name;
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>Gets the constraints list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> Constraints => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.constraints));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whereKeyword,
1 => this.name,
2 => this.colonToken,
3 => this.constraints,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterConstraintClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeParameterConstraintClause(this);
public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> constraints)
{
if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints)
{
var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, GetDiagnostics(), annotations);
internal TypeParameterConstraintClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var whereKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
var name = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var constraints = (GreenNode?)reader.ReadValue();
if (constraints != null)
{
AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whereKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.constraints);
}
static TypeParameterConstraintClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeParameterConstraintClauseSyntax), r => new TypeParameterConstraintClauseSyntax(r));
}
}
/// <summary>Base type for type parameter constraint syntax.</summary>
internal abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode
{
internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal TypeParameterConstraintSyntax(SyntaxKind kind)
: base(kind)
{
}
protected TypeParameterConstraintSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Constructor constraint syntax.</summary>
internal sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly SyntaxToken closeParenToken;
internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the "new" keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>Gets the open paren keyword.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Gets the close paren keyword.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.openParenToken,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstructorConstraint(this);
public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
{
if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, GetDiagnostics(), annotations);
internal ConstructorConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.closeParenToken);
}
static ConstructorConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstructorConstraintSyntax), r => new ConstructorConstraintSyntax(r));
}
}
/// <summary>Class or struct constraint syntax.</summary>
internal sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly SyntaxToken classOrStructKeyword;
internal readonly SyntaxToken? questionToken;
internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
if (questionToken != null)
{
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
if (questionToken != null)
{
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
if (questionToken != null)
{
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
/// <summary>Gets the constraint keyword ("class" or "struct").</summary>
public SyntaxToken ClassOrStructKeyword => this.classOrStructKeyword;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken? QuestionToken => this.questionToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.classOrStructKeyword,
1 => this.questionToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassOrStructConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitClassOrStructConstraint(this);
public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken)
{
if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken)
{
var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind, classOrStructKeyword, questionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, GetDiagnostics(), annotations);
internal ClassOrStructConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var classOrStructKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
var questionToken = (SyntaxToken?)reader.ReadValue();
if (questionToken != null)
{
AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.classOrStructKeyword);
writer.WriteValue(this.questionToken);
}
static ClassOrStructConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ClassOrStructConstraintSyntax), r => new ClassOrStructConstraintSyntax(r));
}
}
/// <summary>Type constraint syntax.</summary>
internal sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly TypeSyntax type;
internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
/// <summary>Gets the type syntax.</summary>
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeConstraint(this);
public TypeConstraintSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.TypeConstraint(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeConstraintSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeConstraintSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal TypeConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static TypeConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeConstraintSyntax), r => new TypeConstraintSyntax(r));
}
}
/// <summary>Default constraint syntax.</summary>
internal sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly SyntaxToken defaultKeyword;
internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
/// <summary>Gets the "default" keyword.</summary>
public SyntaxToken DefaultKeyword => this.defaultKeyword;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.defaultKeyword : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefaultConstraint(this);
public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword)
{
if (defaultKeyword != this.DefaultKeyword)
{
var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, GetDiagnostics(), annotations);
internal DefaultConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var defaultKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.defaultKeyword);
}
static DefaultConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefaultConstraintSyntax), r => new DefaultConstraintSyntax(r));
}
}
internal abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseFieldDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseFieldDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract VariableDeclarationSyntax Declaration { get; }
public abstract SyntaxToken SemicolonToken { get; }
}
internal sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken semicolonToken;
internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override VariableDeclarationSyntax Declaration => this.declaration;
public override SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.declaration,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FieldDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFieldDeclaration(this);
public FieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations);
internal FieldDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.declaration);
writer.WriteValue(this.semicolonToken);
}
static FieldDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FieldDeclarationSyntax), r => new FieldDeclarationSyntax(r));
}
}
internal sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken eventKeyword;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken semicolonToken;
internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public SyntaxToken EventKeyword => this.eventKeyword;
public override VariableDeclarationSyntax Declaration => this.declaration;
public override SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.eventKeyword,
3 => this.declaration,
4 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventFieldDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEventFieldDeclaration(this);
public EventFieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, GetDiagnostics(), annotations);
internal EventFieldDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var eventKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.eventKeyword);
writer.WriteValue(this.declaration);
writer.WriteValue(this.semicolonToken);
}
static EventFieldDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EventFieldDeclarationSyntax), r => new EventFieldDeclarationSyntax(r));
}
}
internal sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode
{
internal readonly NameSyntax name;
internal readonly SyntaxToken dotToken;
internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
public NameSyntax Name => this.name;
public SyntaxToken DotToken => this.dotToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.dotToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExplicitInterfaceSpecifierSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExplicitInterfaceSpecifier(this);
public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken)
{
if (name != this.Name || dotToken != this.DotToken)
{
var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, GetDiagnostics(), annotations);
internal ExplicitInterfaceSpecifierSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var dotToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.dotToken);
}
static ExplicitInterfaceSpecifierSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExplicitInterfaceSpecifierSyntax), r => new ExplicitInterfaceSpecifierSyntax(r));
}
}
/// <summary>Base type for method declaration syntax.</summary>
internal abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseMethodDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseMethodDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the parameter list.</summary>
public abstract ParameterListSyntax ParameterList { get; }
public abstract BlockSyntax? Body { get; }
public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; }
/// <summary>Gets the optional semicolon token.</summary>
public abstract SyntaxToken? SemicolonToken { get; }
}
/// <summary>Method declaration syntax.</summary>
internal sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax returnType;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax parameterList;
internal readonly GreenNode? constraintClauses;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the return type syntax.</summary>
public TypeSyntax ReturnType => this.returnType;
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override ParameterListSyntax ParameterList => this.parameterList;
/// <summary>Gets the constraint clause list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.explicitInterfaceSpecifier,
4 => this.identifier,
5 => this.typeParameterList,
6 => this.parameterList,
7 => this.constraintClauses,
8 => this.body,
9 => this.expressionBody,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MethodDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMethodDeclaration(this);
public MethodDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal MethodDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static MethodDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MethodDeclarationSyntax), r => new MethodDeclarationSyntax(r));
}
}
/// <summary>Operator declaration syntax.</summary>
internal sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax returnType;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken operatorKeyword;
internal readonly SyntaxToken operatorToken;
internal readonly ParameterListSyntax parameterList;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the return type.</summary>
public TypeSyntax ReturnType => this.returnType;
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the "operator" keyword.</summary>
public SyntaxToken OperatorKeyword => this.operatorKeyword;
/// <summary>Gets the operator token.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
public override ParameterListSyntax ParameterList => this.parameterList;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.explicitInterfaceSpecifier,
4 => this.operatorKeyword,
5 => this.operatorToken,
6 => this.parameterList,
7 => this.body,
8 => this.expressionBody,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOperatorDeclaration(this);
public OperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal OperatorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static OperatorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OperatorDeclarationSyntax), r => new OperatorDeclarationSyntax(r));
}
}
/// <summary>Conversion operator declaration syntax.</summary>
internal sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken implicitOrExplicitKeyword;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken operatorKeyword;
internal readonly TypeSyntax type;
internal readonly ParameterListSyntax parameterList;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the "implicit" or "explicit" token.</summary>
public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword;
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the "operator" token.</summary>
public SyntaxToken OperatorKeyword => this.operatorKeyword;
/// <summary>Gets the type.</summary>
public TypeSyntax Type => this.type;
public override ParameterListSyntax ParameterList => this.parameterList;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.implicitOrExplicitKeyword,
3 => this.explicitInterfaceSpecifier,
4 => this.operatorKeyword,
5 => this.type,
6 => this.parameterList,
7 => this.body,
8 => this.expressionBody,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConversionOperatorDeclaration(this);
public ConversionOperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, type, parameterList, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal ConversionOperatorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.implicitOrExplicitKeyword);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static ConversionOperatorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorDeclarationSyntax), r => new ConversionOperatorDeclarationSyntax(r));
}
}
/// <summary>Constructor declaration syntax.</summary>
internal sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken identifier;
internal readonly ParameterListSyntax parameterList;
internal readonly ConstructorInitializerSyntax? initializer;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override ParameterListSyntax ParameterList => this.parameterList;
public ConstructorInitializerSyntax? Initializer => this.initializer;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.identifier,
3 => this.parameterList,
4 => this.initializer,
5 => this.body,
6 => this.expressionBody,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstructorDeclaration(this);
public ConstructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal ConstructorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var initializer = (ConstructorInitializerSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.identifier);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.initializer);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static ConstructorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstructorDeclarationSyntax), r => new ConstructorDeclarationSyntax(r));
}
}
/// <summary>Constructor initializer syntax.</summary>
internal sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken colonToken;
internal readonly SyntaxToken thisOrBaseKeyword;
internal readonly ArgumentListSyntax argumentList;
internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>Gets the "this" or "base" keyword.</summary>
public SyntaxToken ThisOrBaseKeyword => this.thisOrBaseKeyword;
public ArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.colonToken,
1 => this.thisOrBaseKeyword,
2 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorInitializerSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstructorInitializer(this);
public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
{
if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ConstructorInitializer(this.Kind, colonToken, thisOrBaseKeyword, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, GetDiagnostics(), annotations);
internal ConstructorInitializerSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var thisOrBaseKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.thisOrBaseKeyword);
writer.WriteValue(this.argumentList);
}
static ConstructorInitializerSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstructorInitializerSyntax), r => new ConstructorInitializerSyntax(r));
}
}
/// <summary>Destructor declaration syntax.</summary>
internal sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken tildeToken;
internal readonly SyntaxToken identifier;
internal readonly ParameterListSyntax parameterList;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the tilde token.</summary>
public SyntaxToken TildeToken => this.tildeToken;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override ParameterListSyntax ParameterList => this.parameterList;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.tildeToken,
3 => this.identifier,
4 => this.parameterList,
5 => this.body,
6 => this.expressionBody,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DestructorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDestructorDeclaration(this);
public DestructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal DestructorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var tildeToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.tildeToken);
writer.WriteValue(this.identifier);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static DestructorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DestructorDeclarationSyntax), r => new DestructorDeclarationSyntax(r));
}
}
/// <summary>Base type for property declaration syntax.</summary>
internal abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax
{
internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BasePropertyDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BasePropertyDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the type syntax.</summary>
public abstract TypeSyntax Type { get; }
/// <summary>Gets the optional explicit interface specifier.</summary>
public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; }
public abstract AccessorListSyntax? AccessorList { get; }
}
internal sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly AccessorListSyntax? accessorList;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly EqualsValueClauseSyntax? initializer;
internal readonly SyntaxToken? semicolonToken;
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax Type => this.type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override AccessorListSyntax? AccessorList => this.accessorList;
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
public EqualsValueClauseSyntax? Initializer => this.initializer;
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
3 => this.explicitInterfaceSpecifier,
4 => this.identifier,
5 => this.accessorList,
6 => this.expressionBody,
7 => this.initializer,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPropertyDeclaration(this);
public PropertyDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, GetDiagnostics(), annotations);
internal PropertyDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var accessorList = (AccessorListSyntax?)reader.ReadValue();
if (accessorList != null)
{
AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var initializer = (EqualsValueClauseSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.identifier);
writer.WriteValue(this.accessorList);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.initializer);
writer.WriteValue(this.semicolonToken);
}
static PropertyDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PropertyDeclarationSyntax), r => new PropertyDeclarationSyntax(r));
}
}
/// <summary>The syntax for the expression body of an expression-bodied member.</summary>
internal sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken arrowToken;
internal readonly ExpressionSyntax expression;
internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken ArrowToken => this.arrowToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.arrowToken,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrowExpressionClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrowExpressionClause(this);
public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression)
{
if (arrowToken != this.ArrowToken || expression != this.Expression)
{
var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, GetDiagnostics(), annotations);
internal ArrowExpressionClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var arrowToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.arrowToken);
writer.WriteValue(this.expression);
}
static ArrowExpressionClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrowExpressionClauseSyntax), r => new ArrowExpressionClauseSyntax(r));
}
}
internal sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken eventKeyword;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly AccessorListSyntax? accessorList;
internal readonly SyntaxToken? semicolonToken;
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public SyntaxToken EventKeyword => this.eventKeyword;
public override TypeSyntax Type => this.type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override AccessorListSyntax? AccessorList => this.accessorList;
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.eventKeyword,
3 => this.type,
4 => this.explicitInterfaceSpecifier,
5 => this.identifier,
6 => this.accessorList,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEventDeclaration(this);
public EventDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, GetDiagnostics(), annotations);
internal EventDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var eventKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var accessorList = (AccessorListSyntax?)reader.ReadValue();
if (accessorList != null)
{
AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.eventKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.identifier);
writer.WriteValue(this.accessorList);
writer.WriteValue(this.semicolonToken);
}
static EventDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EventDeclarationSyntax), r => new EventDeclarationSyntax(r));
}
}
internal sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken thisKeyword;
internal readonly BracketedParameterListSyntax parameterList;
internal readonly AccessorListSyntax? accessorList;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax Type => this.type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
public SyntaxToken ThisKeyword => this.thisKeyword;
/// <summary>Gets the parameter list.</summary>
public BracketedParameterListSyntax ParameterList => this.parameterList;
public override AccessorListSyntax? AccessorList => this.accessorList;
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
3 => this.explicitInterfaceSpecifier,
4 => this.thisKeyword,
5 => this.parameterList,
6 => this.accessorList,
7 => this.expressionBody,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIndexerDeclaration(this);
public IndexerDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal IndexerDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var thisKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
var parameterList = (BracketedParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var accessorList = (AccessorListSyntax?)reader.ReadValue();
if (accessorList != null)
{
AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.thisKeyword);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.accessorList);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static IndexerDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IndexerDeclarationSyntax), r => new IndexerDeclarationSyntax(r));
}
}
internal sealed partial class AccessorListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? accessors;
internal readonly SyntaxToken closeBraceToken;
internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (accessors != null)
{
this.AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (accessors != null)
{
this.AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (accessors != null)
{
this.AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> Accessors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax>(this.accessors);
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.accessors,
2 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAccessorList(this);
public AccessorListSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, GetDiagnostics(), annotations);
internal AccessorListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var accessors = (GreenNode?)reader.ReadValue();
if (accessors != null)
{
AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.accessors);
writer.WriteValue(this.closeBraceToken);
}
static AccessorListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AccessorListSyntax), r => new AccessorListSyntax(r));
}
}
internal sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the modifier list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the keyword token, or identifier if an erroneous accessor declaration.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>Gets the optional body block which may be empty, but it is null if there are no braces.</summary>
public BlockSyntax? Body => this.body;
/// <summary>Gets the optional expression body.</summary>
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.body,
4 => this.expressionBody,
5 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAccessorDeclaration(this);
public AccessorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.AccessorDeclaration(this.Kind, attributeLists, modifiers, keyword, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal AccessorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static AccessorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AccessorDeclarationSyntax), r => new AccessorDeclarationSyntax(r));
}
}
/// <summary>Base type for parameter list syntax.</summary>
internal abstract partial class BaseParameterListSyntax : CSharpSyntaxNode
{
internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseParameterListSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseParameterListSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the parameter list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> Parameters { get; }
}
/// <summary>Parameter list syntax.</summary>
internal sealed partial class ParameterListSyntax : BaseParameterListSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeParenToken;
internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the open paren token.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close paren token.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.parameters,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParameterList(this);
public ParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations);
internal ParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeParenToken);
}
static ParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParameterListSyntax), r => new ParameterListSyntax(r));
}
}
/// <summary>Parameter list syntax with surrounding brackets.</summary>
internal sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeBracketToken;
internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>Gets the open bracket token.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close bracket token.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.parameters,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBracketedParameterList(this);
public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations);
internal BracketedParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeBracketToken);
}
static BracketedParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BracketedParameterListSyntax), r => new BracketedParameterListSyntax(r));
}
}
/// <summary>Base parameter syntax.</summary>
internal abstract partial class BaseParameterSyntax : CSharpSyntaxNode
{
internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseParameterSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseParameterSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the attribute declaration list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
/// <summary>Gets the modifier list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers { get; }
public abstract TypeSyntax? Type { get; }
}
/// <summary>Parameter syntax.</summary>
internal sealed partial class ParameterSyntax : BaseParameterSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax? type;
internal readonly SyntaxToken identifier;
internal readonly EqualsValueClauseSyntax? @default;
internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (@default != null)
{
this.AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (@default != null)
{
this.AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (@default != null)
{
this.AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
/// <summary>Gets the attribute declaration list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the modifier list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax? Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public EqualsValueClauseSyntax? Default => this.@default;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
3 => this.identifier,
4 => this.@default,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParameter(this);
public ParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default)
{
var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, GetDiagnostics(), annotations);
internal ParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var @default = (EqualsValueClauseSyntax?)reader.ReadValue();
if (@default != null)
{
AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.@default);
}
static ParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParameterSyntax), r => new ParameterSyntax(r));
}
}
/// <summary>Parameter syntax.</summary>
internal sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
/// <summary>Gets the attribute declaration list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the modifier list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerParameter(this);
public FunctionPointerParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type)
{
var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations);
internal FunctionPointerParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
}
static FunctionPointerParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterSyntax), r => new FunctionPointerParameterSyntax(r));
}
}
internal sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax? type;
internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
}
internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
}
internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public TypeSyntax? Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IncompleteMemberSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIncompleteMember(this);
public IncompleteMemberSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type)
{
var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations);
internal IncompleteMemberSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
}
static IncompleteMemberSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IncompleteMemberSyntax), r => new IncompleteMemberSyntax(r));
}
}
internal sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax
{
internal readonly GreenNode? tokens;
internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
if (tokens != null)
{
this.AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
if (tokens != null)
{
this.AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens)
: base(kind)
{
this.SlotCount = 1;
if (tokens != null)
{
this.AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Tokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.tokens);
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.tokens : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SkippedTokensTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSkippedTokensTrivia(this);
public SkippedTokensTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> tokens)
{
if (tokens != this.Tokens)
{
var newNode = SyntaxFactory.SkippedTokensTrivia(tokens);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SkippedTokensTriviaSyntax(this.Kind, this.tokens, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SkippedTokensTriviaSyntax(this.Kind, this.tokens, GetDiagnostics(), annotations);
internal SkippedTokensTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var tokens = (GreenNode?)reader.ReadValue();
if (tokens != null)
{
AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.tokens);
}
static SkippedTokensTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SkippedTokensTriviaSyntax), r => new SkippedTokensTriviaSyntax(r));
}
}
internal sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax
{
internal readonly GreenNode? content;
internal readonly SyntaxToken endOfComment;
internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment)
: base(kind)
{
this.SlotCount = 2;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax>(this.content);
public SyntaxToken EndOfComment => this.endOfComment;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.content,
1 => this.endOfComment,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DocumentationCommentTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDocumentationCommentTrivia(this);
public DocumentationCommentTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment)
{
if (content != this.Content || endOfComment != this.EndOfComment)
{
var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind, content, endOfComment);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, GetDiagnostics(), annotations);
internal DocumentationCommentTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var content = (GreenNode?)reader.ReadValue();
if (content != null)
{
AdjustFlagsAndWidth(content);
this.content = content;
}
var endOfComment = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.content);
writer.WriteValue(this.endOfComment);
}
static DocumentationCommentTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DocumentationCommentTriviaSyntax), r => new DocumentationCommentTriviaSyntax(r));
}
}
/// <summary>
/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag).
/// For example, the M in <see cref="M" />.
/// </summary>
internal abstract partial class CrefSyntax : CSharpSyntaxNode
{
internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal CrefSyntax(SyntaxKind kind)
: base(kind)
{
}
protected CrefSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>
/// A symbol reference that definitely refers to a type.
/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer).
/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax
/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol
/// might be a non-type member.
/// </summary>
internal sealed partial class TypeCrefSyntax : CrefSyntax
{
internal readonly TypeSyntax type;
internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeCref(this);
public TypeCrefSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.TypeCref(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeCrefSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeCrefSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal TypeCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static TypeCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeCrefSyntax), r => new TypeCrefSyntax(r));
}
}
/// <summary>
/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace.
/// For example, cref="System.String.ToString()".
/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax
/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol
/// might be a non-type member.
/// </summary>
internal sealed partial class QualifiedCrefSyntax : CrefSyntax
{
internal readonly TypeSyntax container;
internal readonly SyntaxToken dotToken;
internal readonly MemberCrefSyntax member;
internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(container);
this.container = container;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(member);
this.member = member;
}
internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(container);
this.container = container;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(member);
this.member = member;
}
internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(container);
this.container = container;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(member);
this.member = member;
}
public TypeSyntax Container => this.container;
public SyntaxToken DotToken => this.dotToken;
public MemberCrefSyntax Member => this.member;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.container,
1 => this.dotToken,
2 => this.member,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQualifiedCref(this);
public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
{
if (container != this.Container || dotToken != this.DotToken || member != this.Member)
{
var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, GetDiagnostics(), annotations);
internal QualifiedCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var container = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(container);
this.container = container;
var dotToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
var member = (MemberCrefSyntax)reader.ReadValue();
AdjustFlagsAndWidth(member);
this.member = member;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.container);
writer.WriteValue(this.dotToken);
writer.WriteValue(this.member);
}
static QualifiedCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QualifiedCrefSyntax), r => new QualifiedCrefSyntax(r));
}
}
/// <summary>
/// The unqualified part of a CrefSyntax.
/// For example, "ToString()" in "object.ToString()".
/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax
/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol
/// might be a non-type member.
/// </summary>
internal abstract partial class MemberCrefSyntax : CrefSyntax
{
internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal MemberCrefSyntax(SyntaxKind kind)
: base(kind)
{
}
protected MemberCrefSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>
/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name,
/// with an optional type parameter list) and an optional parameter list.
/// For example, "M", "M<T>" or "M(int)".
/// Also, "A::B()" or "string()".
/// </summary>
internal sealed partial class NameMemberCrefSyntax : MemberCrefSyntax
{
internal readonly TypeSyntax name;
internal readonly CrefParameterListSyntax? parameters;
internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public TypeSyntax Name => this.name;
public CrefParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNameMemberCref(this);
public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax parameters)
{
if (name != this.Name || parameters != this.Parameters)
{
var newNode = SyntaxFactory.NameMemberCref(name, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, GetDiagnostics(), annotations);
internal NameMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var parameters = (CrefParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.parameters);
}
static NameMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NameMemberCrefSyntax), r => new NameMemberCrefSyntax(r));
}
}
/// <summary>
/// A MemberCrefSyntax specified by a this keyword and an optional parameter list.
/// For example, "this" or "this[int]".
/// </summary>
internal sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax
{
internal readonly SyntaxToken thisKeyword;
internal readonly CrefBracketedParameterListSyntax? parameters;
internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public SyntaxToken ThisKeyword => this.thisKeyword;
public CrefBracketedParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.thisKeyword,
1 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIndexerMemberCref(this);
public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax parameters)
{
if (thisKeyword != this.ThisKeyword || parameters != this.Parameters)
{
var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, GetDiagnostics(), annotations);
internal IndexerMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var thisKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
var parameters = (CrefBracketedParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.thisKeyword);
writer.WriteValue(this.parameters);
}
static IndexerMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IndexerMemberCrefSyntax), r => new IndexerMemberCrefSyntax(r));
}
}
/// <summary>
/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list.
/// For example, "operator +" or "operator -[int]".
/// NOTE: the operator must be overloadable.
/// </summary>
internal sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax
{
internal readonly SyntaxToken operatorKeyword;
internal readonly SyntaxToken operatorToken;
internal readonly CrefParameterListSyntax? parameters;
internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public SyntaxToken OperatorKeyword => this.operatorKeyword;
/// <summary>Gets the operator token.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
public CrefParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorKeyword,
1 => this.operatorToken,
2 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOperatorMemberCref(this);
public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax parameters)
{
if (operatorKeyword != this.OperatorKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters)
{
var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, operatorToken, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.operatorToken, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.operatorToken, this.parameters, GetDiagnostics(), annotations);
internal OperatorMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var parameters = (CrefParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.parameters);
}
static OperatorMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OperatorMemberCrefSyntax), r => new OperatorMemberCrefSyntax(r));
}
}
/// <summary>
/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list.
/// For example, "implicit operator int" or "explicit operator MyType(int)".
/// </summary>
internal sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax
{
internal readonly SyntaxToken implicitOrExplicitKeyword;
internal readonly SyntaxToken operatorKeyword;
internal readonly TypeSyntax type;
internal readonly CrefParameterListSyntax? parameters;
internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword;
public SyntaxToken OperatorKeyword => this.operatorKeyword;
public TypeSyntax Type => this.type;
public CrefParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.implicitOrExplicitKeyword,
1 => this.operatorKeyword,
2 => this.type,
3 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConversionOperatorMemberCref(this);
public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax parameters)
{
if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || type != this.Type || parameters != this.Parameters)
{
var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, type, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.type, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.type, this.parameters, GetDiagnostics(), annotations);
internal ConversionOperatorMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var parameters = (CrefParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.implicitOrExplicitKeyword);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.parameters);
}
static ConversionOperatorMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorMemberCrefSyntax), r => new ConversionOperatorMemberCrefSyntax(r));
}
}
/// <summary>
/// A list of cref parameters with surrounding punctuation.
/// Unlike regular parameters, cref parameters do not have names.
/// </summary>
internal abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode
{
internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseCrefParameterListSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseCrefParameterListSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the parameter list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> Parameters { get; }
}
/// <summary>
/// A parenthesized list of cref parameters.
/// </summary>
internal sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeParenToken;
internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the open paren token.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close paren token.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.parameters,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCrefParameterList(this);
public CrefParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations);
internal CrefParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeParenToken);
}
static CrefParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CrefParameterListSyntax), r => new CrefParameterListSyntax(r));
}
}
/// <summary>
/// A bracketed list of cref parameters.
/// </summary>
internal sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeBracketToken;
internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>Gets the open bracket token.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close bracket token.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.parameters,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefBracketedParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCrefBracketedParameterList(this);
public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations);
internal CrefBracketedParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeBracketToken);
}
static CrefBracketedParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CrefBracketedParameterListSyntax), r => new CrefBracketedParameterListSyntax(r));
}
}
/// <summary>
/// An element of a BaseCrefParameterListSyntax.
/// Unlike a regular parameter, a cref parameter has only an optional ref or out keyword and a type -
/// there is no name and there are no attributes or other modifiers.
/// </summary>
internal sealed partial class CrefParameterSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken? refKindKeyword;
internal readonly TypeSyntax type;
internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, TypeSyntax type)
: base(kind)
{
this.SlotCount = 2;
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public SyntaxToken? RefKindKeyword => this.refKindKeyword;
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.refKindKeyword,
1 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCrefParameter(this);
public CrefParameterSyntax Update(SyntaxToken refKindKeyword, TypeSyntax type)
{
if (refKindKeyword != this.RefKindKeyword || type != this.Type)
{
var newNode = SyntaxFactory.CrefParameter(refKindKeyword, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.type, GetDiagnostics(), annotations);
internal CrefParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var refKindKeyword = (SyntaxToken?)reader.ReadValue();
if (refKindKeyword != null)
{
AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.refKindKeyword);
writer.WriteValue(this.type);
}
static CrefParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CrefParameterSyntax), r => new CrefParameterSyntax(r));
}
}
internal abstract partial class XmlNodeSyntax : CSharpSyntaxNode
{
internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal XmlNodeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected XmlNodeSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class XmlElementSyntax : XmlNodeSyntax
{
internal readonly XmlElementStartTagSyntax startTag;
internal readonly GreenNode? content;
internal readonly XmlElementEndTagSyntax endTag;
internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
public XmlElementStartTagSyntax StartTag => this.startTag;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax>(this.content);
public XmlElementEndTagSyntax EndTag => this.endTag;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.startTag,
1 => this.content,
2 => this.endTag,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlElement(this);
public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, XmlElementEndTagSyntax endTag)
{
if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag)
{
var newNode = SyntaxFactory.XmlElement(startTag, content, endTag);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, GetDiagnostics(), annotations);
internal XmlElementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var startTag = (XmlElementStartTagSyntax)reader.ReadValue();
AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
var content = (GreenNode?)reader.ReadValue();
if (content != null)
{
AdjustFlagsAndWidth(content);
this.content = content;
}
var endTag = (XmlElementEndTagSyntax)reader.ReadValue();
AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.startTag);
writer.WriteValue(this.content);
writer.WriteValue(this.endTag);
}
static XmlElementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlElementSyntax), r => new XmlElementSyntax(r));
}
}
internal sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly XmlNameSyntax name;
internal readonly GreenNode? attributes;
internal readonly SyntaxToken greaterThanToken;
internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
public SyntaxToken LessThanToken => this.lessThanToken;
public XmlNameSyntax Name => this.name;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax>(this.attributes);
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.name,
2 => this.attributes,
3 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementStartTagSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlElementStartTag(this);
public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, GetDiagnostics(), annotations);
internal XmlElementStartTagSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var attributes = (GreenNode?)reader.ReadValue();
if (attributes != null)
{
AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.name);
writer.WriteValue(this.attributes);
writer.WriteValue(this.greaterThanToken);
}
static XmlElementStartTagSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlElementStartTagSyntax), r => new XmlElementStartTagSyntax(r));
}
}
internal sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanSlashToken;
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken greaterThanToken;
internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
public SyntaxToken LessThanSlashToken => this.lessThanSlashToken;
public XmlNameSyntax Name => this.name;
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanSlashToken,
1 => this.name,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementEndTagSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlElementEndTag(this);
public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
{
if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, GetDiagnostics(), annotations);
internal XmlElementEndTagSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanSlashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanSlashToken);
writer.WriteValue(this.name);
writer.WriteValue(this.greaterThanToken);
}
static XmlElementEndTagSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlElementEndTagSyntax), r => new XmlElementEndTagSyntax(r));
}
}
internal sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken lessThanToken;
internal readonly XmlNameSyntax name;
internal readonly GreenNode? attributes;
internal readonly SyntaxToken slashGreaterThanToken;
internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
public SyntaxToken LessThanToken => this.lessThanToken;
public XmlNameSyntax Name => this.name;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax>(this.attributes);
public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.name,
2 => this.attributes,
3 => this.slashGreaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlEmptyElementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlEmptyElement(this);
public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken slashGreaterThanToken)
{
if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken)
{
var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, GetDiagnostics(), annotations);
internal XmlEmptyElementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var attributes = (GreenNode?)reader.ReadValue();
if (attributes != null)
{
AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
var slashGreaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.name);
writer.WriteValue(this.attributes);
writer.WriteValue(this.slashGreaterThanToken);
}
static XmlEmptyElementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlEmptyElementSyntax), r => new XmlEmptyElementSyntax(r));
}
}
internal sealed partial class XmlNameSyntax : CSharpSyntaxNode
{
internal readonly XmlPrefixSyntax? prefix;
internal readonly SyntaxToken localName;
internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (prefix != null)
{
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
this.AdjustFlagsAndWidth(localName);
this.localName = localName;
}
internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (prefix != null)
{
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
this.AdjustFlagsAndWidth(localName);
this.localName = localName;
}
internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName)
: base(kind)
{
this.SlotCount = 2;
if (prefix != null)
{
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
this.AdjustFlagsAndWidth(localName);
this.localName = localName;
}
public XmlPrefixSyntax? Prefix => this.prefix;
public SyntaxToken LocalName => this.localName;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.prefix,
1 => this.localName,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlName(this);
public XmlNameSyntax Update(XmlPrefixSyntax prefix, SyntaxToken localName)
{
if (prefix != this.Prefix || localName != this.LocalName)
{
var newNode = SyntaxFactory.XmlName(prefix, localName);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlNameSyntax(this.Kind, this.prefix, this.localName, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlNameSyntax(this.Kind, this.prefix, this.localName, GetDiagnostics(), annotations);
internal XmlNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var prefix = (XmlPrefixSyntax?)reader.ReadValue();
if (prefix != null)
{
AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
var localName = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(localName);
this.localName = localName;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.prefix);
writer.WriteValue(this.localName);
}
static XmlNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlNameSyntax), r => new XmlNameSyntax(r));
}
}
internal sealed partial class XmlPrefixSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken prefix;
internal readonly SyntaxToken colonToken;
internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
public SyntaxToken Prefix => this.prefix;
public SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.prefix,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlPrefixSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlPrefix(this);
public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken)
{
if (prefix != this.Prefix || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, GetDiagnostics(), annotations);
internal XmlPrefixSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var prefix = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.prefix);
writer.WriteValue(this.colonToken);
}
static XmlPrefixSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlPrefixSyntax), r => new XmlPrefixSyntax(r));
}
}
internal abstract partial class XmlAttributeSyntax : CSharpSyntaxNode
{
internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal XmlAttributeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected XmlAttributeSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract XmlNameSyntax Name { get; }
public abstract SyntaxToken EqualsToken { get; }
public abstract SyntaxToken StartQuoteToken { get; }
public abstract SyntaxToken EndQuoteToken { get; }
}
internal sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax
{
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal readonly SyntaxToken startQuoteToken;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken endQuoteToken;
internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
public override XmlNameSyntax Name => this.name;
public override SyntaxToken EqualsToken => this.equalsToken;
public override SyntaxToken StartQuoteToken => this.startQuoteToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public override SyntaxToken EndQuoteToken => this.endQuoteToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
2 => this.startQuoteToken,
3 => this.textTokens,
4 => this.endQuoteToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextAttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlTextAttribute(this);
public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endQuoteToken)
{
if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken)
{
var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, GetDiagnostics(), annotations);
internal XmlTextAttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var startQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var endQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.startQuoteToken);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.endQuoteToken);
}
static XmlTextAttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlTextAttributeSyntax), r => new XmlTextAttributeSyntax(r));
}
}
internal sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax
{
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal readonly SyntaxToken startQuoteToken;
internal readonly CrefSyntax cref;
internal readonly SyntaxToken endQuoteToken;
internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(cref);
this.cref = cref;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(cref);
this.cref = cref;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(cref);
this.cref = cref;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
public override XmlNameSyntax Name => this.name;
public override SyntaxToken EqualsToken => this.equalsToken;
public override SyntaxToken StartQuoteToken => this.startQuoteToken;
public CrefSyntax Cref => this.cref;
public override SyntaxToken EndQuoteToken => this.endQuoteToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
2 => this.startQuoteToken,
3 => this.cref,
4 => this.endQuoteToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCrefAttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlCrefAttribute(this);
public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
{
if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken)
{
var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, GetDiagnostics(), annotations);
internal XmlCrefAttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var startQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
var cref = (CrefSyntax)reader.ReadValue();
AdjustFlagsAndWidth(cref);
this.cref = cref;
var endQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.startQuoteToken);
writer.WriteValue(this.cref);
writer.WriteValue(this.endQuoteToken);
}
static XmlCrefAttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlCrefAttributeSyntax), r => new XmlCrefAttributeSyntax(r));
}
}
internal sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax
{
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal readonly SyntaxToken startQuoteToken;
internal readonly IdentifierNameSyntax identifier;
internal readonly SyntaxToken endQuoteToken;
internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
public override XmlNameSyntax Name => this.name;
public override SyntaxToken EqualsToken => this.equalsToken;
public override SyntaxToken StartQuoteToken => this.startQuoteToken;
public IdentifierNameSyntax Identifier => this.identifier;
public override SyntaxToken EndQuoteToken => this.endQuoteToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
2 => this.startQuoteToken,
3 => this.identifier,
4 => this.endQuoteToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameAttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlNameAttribute(this);
public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
{
if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken)
{
var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, GetDiagnostics(), annotations);
internal XmlNameAttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var startQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
var identifier = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var endQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.startQuoteToken);
writer.WriteValue(this.identifier);
writer.WriteValue(this.endQuoteToken);
}
static XmlNameAttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlNameAttributeSyntax), r => new XmlNameAttributeSyntax(r));
}
}
internal sealed partial class XmlTextSyntax : XmlNodeSyntax
{
internal readonly GreenNode? textTokens;
internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens)
: base(kind)
{
this.SlotCount = 1;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.textTokens : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlText(this);
public XmlTextSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens)
{
if (textTokens != this.TextTokens)
{
var newNode = SyntaxFactory.XmlText(textTokens);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlTextSyntax(this.Kind, this.textTokens, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlTextSyntax(this.Kind, this.textTokens, GetDiagnostics(), annotations);
internal XmlTextSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.textTokens);
}
static XmlTextSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlTextSyntax), r => new XmlTextSyntax(r));
}
}
internal sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken startCDataToken;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken endCDataToken;
internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
public SyntaxToken StartCDataToken => this.startCDataToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public SyntaxToken EndCDataToken => this.endCDataToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.startCDataToken,
1 => this.textTokens,
2 => this.endCDataToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCDataSectionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlCDataSection(this);
public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endCDataToken)
{
if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken)
{
var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, GetDiagnostics(), annotations);
internal XmlCDataSectionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var startCDataToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var endCDataToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.startCDataToken);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.endCDataToken);
}
static XmlCDataSectionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlCDataSectionSyntax), r => new XmlCDataSectionSyntax(r));
}
}
internal sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken startProcessingInstructionToken;
internal readonly XmlNameSyntax name;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken endProcessingInstructionToken;
internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken;
public XmlNameSyntax Name => this.name;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.startProcessingInstructionToken,
1 => this.name,
2 => this.textTokens,
3 => this.endProcessingInstructionToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlProcessingInstructionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlProcessingInstruction(this);
public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endProcessingInstructionToken)
{
if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken)
{
var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, GetDiagnostics(), annotations);
internal XmlProcessingInstructionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var startProcessingInstructionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var endProcessingInstructionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.startProcessingInstructionToken);
writer.WriteValue(this.name);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.endProcessingInstructionToken);
}
static XmlProcessingInstructionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlProcessingInstructionSyntax), r => new XmlProcessingInstructionSyntax(r));
}
}
internal sealed partial class XmlCommentSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken lessThanExclamationMinusMinusToken;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken minusMinusGreaterThanToken;
internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanExclamationMinusMinusToken,
1 => this.textTokens,
2 => this.minusMinusGreaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCommentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlComment(this);
public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken minusMinusGreaterThanToken)
{
if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken)
{
var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, GetDiagnostics(), annotations);
internal XmlCommentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanExclamationMinusMinusToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var minusMinusGreaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanExclamationMinusMinusToken);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.minusMinusGreaterThanToken);
}
static XmlCommentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlCommentSyntax), r => new XmlCommentSyntax(r));
}
}
internal abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax
{
internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.flags |= NodeFlags.ContainsDirectives;
}
internal DirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
this.flags |= NodeFlags.ContainsDirectives;
}
protected DirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.flags |= NodeFlags.ContainsDirectives;
}
public abstract SyntaxToken HashToken { get; }
public abstract SyntaxToken EndOfDirectiveToken { get; }
public abstract bool IsActive { get; }
}
internal abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BranchingDirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BranchingDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract bool BranchTaken { get; }
}
internal abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax
{
internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
}
protected ConditionalDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract ExpressionSyntax Condition { get; }
public abstract bool ConditionValue { get; }
}
internal sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken ifKeyword;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal readonly bool branchTaken;
internal readonly bool conditionValue;
internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken IfKeyword => this.ifKeyword;
public override ExpressionSyntax Condition => this.condition;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
public override bool BranchTaken => this.branchTaken;
public override bool ConditionValue => this.conditionValue;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.ifKeyword,
2 => this.condition,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIfDirectiveTrivia(this);
public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations);
internal IfDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var ifKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
this.branchTaken = (bool)reader.ReadBoolean();
this.conditionValue = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.ifKeyword);
writer.WriteValue(this.condition);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
writer.WriteBoolean(this.branchTaken);
writer.WriteBoolean(this.conditionValue);
}
static IfDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IfDirectiveTriviaSyntax), r => new IfDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken elifKeyword;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal readonly bool branchTaken;
internal readonly bool conditionValue;
internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ElifKeyword => this.elifKeyword;
public override ExpressionSyntax Condition => this.condition;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
public override bool BranchTaken => this.branchTaken;
public override bool ConditionValue => this.conditionValue;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.elifKeyword,
2 => this.condition,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElifDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElifDirectiveTrivia(this);
public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations);
internal ElifDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var elifKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
this.branchTaken = (bool)reader.ReadBoolean();
this.conditionValue = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.elifKeyword);
writer.WriteValue(this.condition);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
writer.WriteBoolean(this.branchTaken);
writer.WriteBoolean(this.conditionValue);
}
static ElifDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElifDirectiveTriviaSyntax), r => new ElifDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken elseKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal readonly bool branchTaken;
internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
}
internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
}
internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ElseKeyword => this.elseKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
public override bool BranchTaken => this.branchTaken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.elseKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElseDirectiveTrivia(this);
public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
{
if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, GetDiagnostics(), annotations);
internal ElseDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var elseKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
this.branchTaken = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.elseKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
writer.WriteBoolean(this.branchTaken);
}
static ElseDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElseDirectiveTriviaSyntax), r => new ElseDirectiveTriviaSyntax(r));
}
}
internal sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken endIfKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken EndIfKeyword => this.endIfKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.endIfKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndIfDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEndIfDirectiveTrivia(this);
public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal EndIfDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var endIfKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.endIfKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static EndIfDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EndIfDirectiveTriviaSyntax), r => new EndIfDirectiveTriviaSyntax(r));
}
}
internal sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken regionKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken RegionKeyword => this.regionKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.regionKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RegionDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRegionDirectiveTrivia(this);
public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal RegionDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var regionKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.regionKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static RegionDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RegionDirectiveTriviaSyntax), r => new RegionDirectiveTriviaSyntax(r));
}
}
internal sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken endRegionKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken EndRegionKeyword => this.endRegionKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.endRegionKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndRegionDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEndRegionDirectiveTrivia(this);
public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal EndRegionDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var endRegionKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.endRegionKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static EndRegionDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EndRegionDirectiveTriviaSyntax), r => new EndRegionDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken errorKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ErrorKeyword => this.errorKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.errorKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ErrorDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitErrorDirectiveTrivia(this);
public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal ErrorDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var errorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.errorKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static ErrorDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ErrorDirectiveTriviaSyntax), r => new ErrorDirectiveTriviaSyntax(r));
}
}
internal sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken warningKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken WarningKeyword => this.warningKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.warningKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WarningDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWarningDirectiveTrivia(this);
public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal WarningDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var warningKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.warningKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static WarningDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WarningDirectiveTriviaSyntax), r => new WarningDirectiveTriviaSyntax(r));
}
}
internal sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken Identifier => this.identifier;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.identifier,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BadDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBadDirectiveTrivia(this);
public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal BadDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.identifier);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static BadDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BadDirectiveTriviaSyntax), r => new BadDirectiveTriviaSyntax(r));
}
}
internal sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken defineKeyword;
internal readonly SyntaxToken name;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken DefineKeyword => this.defineKeyword;
public SyntaxToken Name => this.name;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.defineKeyword,
2 => this.name,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefineDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefineDirectiveTrivia(this);
public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal DefineDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var defineKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
var name = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.defineKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static DefineDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefineDirectiveTriviaSyntax), r => new DefineDirectiveTriviaSyntax(r));
}
}
internal sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken undefKeyword;
internal readonly SyntaxToken name;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken UndefKeyword => this.undefKeyword;
public SyntaxToken Name => this.name;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.undefKeyword,
2 => this.name,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UndefDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUndefDirectiveTrivia(this);
public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal UndefDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var undefKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
var name = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.undefKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static UndefDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UndefDirectiveTriviaSyntax), r => new UndefDirectiveTriviaSyntax(r));
}
}
internal abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
}
protected LineOrSpanDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract SyntaxToken LineKeyword { get; }
public abstract SyntaxToken? File { get; }
}
internal sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken lineKeyword;
internal readonly SyntaxToken line;
internal readonly SyntaxToken? file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(line);
this.line = line;
if (file != null)
{
this.AdjustFlagsAndWidth(file);
this.file = file;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(line);
this.line = line;
if (file != null)
{
this.AdjustFlagsAndWidth(file);
this.file = file;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(line);
this.line = line;
if (file != null)
{
this.AdjustFlagsAndWidth(file);
this.file = file;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public override SyntaxToken LineKeyword => this.lineKeyword;
public SyntaxToken Line => this.line;
public override SyntaxToken? File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.lineKeyword,
2 => this.line,
3 => this.file,
4 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLineDirectiveTrivia(this);
public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal LineDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var lineKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
var line = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(line);
this.line = line;
var file = (SyntaxToken?)reader.ReadValue();
if (file != null)
{
AdjustFlagsAndWidth(file);
this.file = file;
}
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.lineKeyword);
writer.WriteValue(this.line);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static LineDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LineDirectiveTriviaSyntax), r => new LineDirectiveTriviaSyntax(r));
}
}
internal sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly SyntaxToken line;
internal readonly SyntaxToken commaToken;
internal readonly SyntaxToken character;
internal readonly SyntaxToken closeParenToken;
internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(line);
this.line = line;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(character);
this.character = character;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(line);
this.line = line;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(character);
this.character = character;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(line);
this.line = line;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(character);
this.character = character;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public SyntaxToken Line => this.line;
public SyntaxToken CommaToken => this.commaToken;
public SyntaxToken Character => this.character;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.line,
2 => this.commaToken,
3 => this.character,
4 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectivePositionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLineDirectivePosition(this);
public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, GetDiagnostics(), annotations);
internal LineDirectivePositionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var line = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(line);
this.line = line;
var commaToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
var character = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(character);
this.character = character;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.line);
writer.WriteValue(this.commaToken);
writer.WriteValue(this.character);
writer.WriteValue(this.closeParenToken);
}
static LineDirectivePositionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LineDirectivePositionSyntax), r => new LineDirectivePositionSyntax(r));
}
}
internal sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken lineKeyword;
internal readonly LineDirectivePositionSyntax start;
internal readonly SyntaxToken minusToken;
internal readonly LineDirectivePositionSyntax end;
internal readonly SyntaxToken? characterOffset;
internal readonly SyntaxToken file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(start);
this.start = start;
this.AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
this.AdjustFlagsAndWidth(end);
this.end = end;
if (characterOffset != null)
{
this.AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(start);
this.start = start;
this.AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
this.AdjustFlagsAndWidth(end);
this.end = end;
if (characterOffset != null)
{
this.AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 8;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(start);
this.start = start;
this.AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
this.AdjustFlagsAndWidth(end);
this.end = end;
if (characterOffset != null)
{
this.AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public override SyntaxToken LineKeyword => this.lineKeyword;
public LineDirectivePositionSyntax Start => this.start;
public SyntaxToken MinusToken => this.minusToken;
public LineDirectivePositionSyntax End => this.end;
public SyntaxToken? CharacterOffset => this.characterOffset;
public override SyntaxToken File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.lineKeyword,
2 => this.start,
3 => this.minusToken,
4 => this.end,
5 => this.characterOffset,
6 => this.file,
7 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineSpanDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLineSpanDirectiveTrivia(this);
public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal LineSpanDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var lineKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
var start = (LineDirectivePositionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(start);
this.start = start;
var minusToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
var end = (LineDirectivePositionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(end);
this.end = end;
var characterOffset = (SyntaxToken?)reader.ReadValue();
if (characterOffset != null)
{
AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.lineKeyword);
writer.WriteValue(this.start);
writer.WriteValue(this.minusToken);
writer.WriteValue(this.end);
writer.WriteValue(this.characterOffset);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static LineSpanDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LineSpanDirectiveTriviaSyntax), r => new LineSpanDirectiveTriviaSyntax(r));
}
}
internal sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken pragmaKeyword;
internal readonly SyntaxToken warningKeyword;
internal readonly SyntaxToken disableOrRestoreKeyword;
internal readonly GreenNode? errorCodes;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
if (errorCodes != null)
{
this.AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
if (errorCodes != null)
{
this.AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
if (errorCodes != null)
{
this.AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken PragmaKeyword => this.pragmaKeyword;
public SyntaxToken WarningKeyword => this.warningKeyword;
public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> ErrorCodes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.errorCodes));
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.pragmaKeyword,
2 => this.warningKeyword,
3 => this.disableOrRestoreKeyword,
4 => this.errorCodes,
5 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this);
public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal PragmaWarningDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var pragmaKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
var warningKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
var disableOrRestoreKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
var errorCodes = (GreenNode?)reader.ReadValue();
if (errorCodes != null)
{
AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.pragmaKeyword);
writer.WriteValue(this.warningKeyword);
writer.WriteValue(this.disableOrRestoreKeyword);
writer.WriteValue(this.errorCodes);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static PragmaWarningDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PragmaWarningDirectiveTriviaSyntax), r => new PragmaWarningDirectiveTriviaSyntax(r));
}
}
internal sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken pragmaKeyword;
internal readonly SyntaxToken checksumKeyword;
internal readonly SyntaxToken file;
internal readonly SyntaxToken guid;
internal readonly SyntaxToken bytes;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 7;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(guid);
this.guid = guid;
this.AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 7;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(guid);
this.guid = guid;
this.AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 7;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(guid);
this.guid = guid;
this.AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken PragmaKeyword => this.pragmaKeyword;
public SyntaxToken ChecksumKeyword => this.checksumKeyword;
public SyntaxToken File => this.file;
public SyntaxToken Guid => this.guid;
public SyntaxToken Bytes => this.bytes;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.pragmaKeyword,
2 => this.checksumKeyword,
3 => this.file,
4 => this.guid,
5 => this.bytes,
6 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this);
public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal PragmaChecksumDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 7;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var pragmaKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
var checksumKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var guid = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(guid);
this.guid = guid;
var bytes = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.pragmaKeyword);
writer.WriteValue(this.checksumKeyword);
writer.WriteValue(this.file);
writer.WriteValue(this.guid);
writer.WriteValue(this.bytes);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static PragmaChecksumDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PragmaChecksumDirectiveTriviaSyntax), r => new PragmaChecksumDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken referenceKeyword;
internal readonly SyntaxToken file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ReferenceKeyword => this.referenceKeyword;
public SyntaxToken File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.referenceKeyword,
2 => this.file,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReferenceDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitReferenceDirectiveTrivia(this);
public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal ReferenceDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var referenceKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.referenceKeyword);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static ReferenceDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ReferenceDirectiveTriviaSyntax), r => new ReferenceDirectiveTriviaSyntax(r));
}
}
internal sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken loadKeyword;
internal readonly SyntaxToken file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken LoadKeyword => this.loadKeyword;
public SyntaxToken File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.loadKeyword,
2 => this.file,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LoadDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLoadDirectiveTrivia(this);
public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal LoadDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var loadKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.loadKeyword);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static LoadDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LoadDirectiveTriviaSyntax), r => new LoadDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken exclamationToken;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ExclamationToken => this.exclamationToken;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.exclamationToken,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ShebangDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitShebangDirectiveTrivia(this);
public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal ShebangDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var exclamationToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.exclamationToken);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static ShebangDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ShebangDirectiveTriviaSyntax), r => new ShebangDirectiveTriviaSyntax(r));
}
}
internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken nullableKeyword;
internal readonly SyntaxToken settingToken;
internal readonly SyntaxToken? targetToken;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
this.AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
if (targetToken != null)
{
this.AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
this.AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
if (targetToken != null)
{
this.AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
this.AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
if (targetToken != null)
{
this.AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken NullableKeyword => this.nullableKeyword;
public SyntaxToken SettingToken => this.settingToken;
public SyntaxToken? TargetToken => this.targetToken;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.nullableKeyword,
2 => this.settingToken,
3 => this.targetToken,
4 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNullableDirectiveTrivia(this);
public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal NullableDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var nullableKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
var settingToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
var targetToken = (SyntaxToken?)reader.ReadValue();
if (targetToken != null)
{
AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.nullableKeyword);
writer.WriteValue(this.settingToken);
writer.WriteValue(this.targetToken);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static NullableDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NullableDirectiveTriviaSyntax), r => new NullableDirectiveTriviaSyntax(r));
}
}
internal partial class CSharpSyntaxVisitor<TResult>
{
public virtual TResult VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBlock(BlockSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParameter(ParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
}
internal partial class CSharpSyntaxVisitor
{
public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node);
public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node);
public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node);
public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node);
public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node);
public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node);
public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node);
public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node);
public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node);
public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node);
public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node);
public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node);
public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node);
public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node);
public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node);
public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node);
public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node);
public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node);
public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node);
public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node);
public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node);
public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node);
public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
}
internal partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor<CSharpSyntaxNode>
{
public override CSharpSyntaxNode VisitIdentifierName(IdentifierNameSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
=> node.Update((NameSyntax)Visit(node.Left), (SyntaxToken)Visit(node.DotToken), (SimpleNameSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitGenericName(GenericNameSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier), (TypeArgumentListSyntax)Visit(node.TypeArgumentList));
public override CSharpSyntaxNode VisitTypeArgumentList(TypeArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitAliasQualifiedName(AliasQualifiedNameSyntax node)
=> node.Update((IdentifierNameSyntax)Visit(node.Alias), (SyntaxToken)Visit(node.ColonColonToken), (SimpleNameSyntax)Visit(node.Name));
public override CSharpSyntaxNode VisitPredefinedType(PredefinedTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword));
public override CSharpSyntaxNode VisitArrayType(ArrayTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.ElementType), VisitList(node.RankSpecifiers));
public override CSharpSyntaxNode VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Sizes), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitPointerType(PointerTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.AsteriskToken));
public override CSharpSyntaxNode VisitFunctionPointerType(FunctionPointerTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.DelegateKeyword), (SyntaxToken)Visit(node.AsteriskToken), (FunctionPointerCallingConventionSyntax)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax)Visit(node.ParameterList));
public override CSharpSyntaxNode VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node)
=> node.Update((SyntaxToken)Visit(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax)Visit(node.UnmanagedCallingConventionList));
public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.CallingConventions), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Name));
public override CSharpSyntaxNode VisitNullableType(NullableTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.QuestionToken));
public override CSharpSyntaxNode VisitTupleType(TupleTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitTupleElement(TupleElementSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node)
=> node.Update((SyntaxToken)Visit(node.OmittedTypeArgumentToken));
public override CSharpSyntaxNode VisitRefType(RefTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.RefKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitParenthesizedExpression(ParenthesizedExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitTupleExpression(TupleExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Operand));
public override CSharpSyntaxNode VisitAwaitExpression(AwaitExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.AwaitKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Operand), (SyntaxToken)Visit(node.OperatorToken));
public override CSharpSyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name));
public override CSharpSyntaxNode VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.WhenNotNull));
public override CSharpSyntaxNode VisitMemberBindingExpression(MemberBindingExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name));
public override CSharpSyntaxNode VisitElementBindingExpression(ElementBindingExpressionSyntax node)
=> node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitRangeExpression(RangeExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.LeftOperand), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.RightOperand));
public override CSharpSyntaxNode VisitImplicitElementAccess(ImplicitElementAccessSyntax node)
=> node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitAssignmentExpression(AssignmentExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitConditionalExpression(ConditionalExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.QuestionToken), (ExpressionSyntax)Visit(node.WhenTrue), (SyntaxToken)Visit(node.ColonToken), (ExpressionSyntax)Visit(node.WhenFalse));
public override CSharpSyntaxNode VisitThisExpression(ThisExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Token));
public override CSharpSyntaxNode VisitBaseExpression(BaseExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Token));
public override CSharpSyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Token));
public override CSharpSyntaxNode VisitMakeRefExpression(MakeRefExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitRefTypeExpression(RefTypeExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitRefValueExpression(RefValueExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.Comma), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitCheckedExpression(CheckedExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitTypeOfExpression(TypeOfExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitSizeOfExpression(SizeOfExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (ArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (BracketedArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitArgumentList(ArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitBracketedArgumentList(BracketedArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitArgument(ArgumentSyntax node)
=> node.Update((NameColonSyntax)Visit(node.NameColon), (SyntaxToken)Visit(node.RefKindKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitExpressionColon(ExpressionColonSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitNameColon(NameColonSyntax node)
=> node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitDeclarationExpression(DeclarationExpressionSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitCastExpression(CastExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node)
=> node.Update(VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody));
public override CSharpSyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax)Visit(node.Parameter), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody));
public override CSharpSyntaxNode VisitRefExpression(RefExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.RefKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ParameterListSyntax)Visit(node.ParameterList), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody));
public override CSharpSyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Expressions), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitWithExpression(WithExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.WithKeyword), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node)
=> node.Update((NameEqualsSyntax)Visit(node.NameEquals), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Initializers), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitArrayCreationExpression(ArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (ArrayTypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Commas), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (TypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (SyntaxToken)Visit(node.OpenBracketToken), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitQueryExpression(QueryExpressionSyntax node)
=> node.Update((FromClauseSyntax)Visit(node.FromClause), (QueryBodySyntax)Visit(node.Body));
public override CSharpSyntaxNode VisitQueryBody(QueryBodySyntax node)
=> node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax)Visit(node.SelectOrGroup), (QueryContinuationSyntax)Visit(node.Continuation));
public override CSharpSyntaxNode VisitFromClause(FromClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.FromKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitLetClause(LetClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.LetKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitJoinClause(JoinClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.JoinKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.InExpression), (SyntaxToken)Visit(node.OnKeyword), (ExpressionSyntax)Visit(node.LeftExpression), (SyntaxToken)Visit(node.EqualsKeyword), (ExpressionSyntax)Visit(node.RightExpression), (JoinIntoClauseSyntax)Visit(node.Into));
public override CSharpSyntaxNode VisitJoinIntoClause(JoinIntoClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitWhereClause(WhereClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhereKeyword), (ExpressionSyntax)Visit(node.Condition));
public override CSharpSyntaxNode VisitOrderByClause(OrderByClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.OrderByKeyword), VisitList(node.Orderings));
public override CSharpSyntaxNode VisitOrdering(OrderingSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.AscendingOrDescendingKeyword));
public override CSharpSyntaxNode VisitSelectClause(SelectClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.SelectKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitGroupClause(GroupClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.GroupKeyword), (ExpressionSyntax)Visit(node.GroupExpression), (SyntaxToken)Visit(node.ByKeyword), (ExpressionSyntax)Visit(node.ByExpression));
public override CSharpSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node)
=> node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier), (QueryBodySyntax)Visit(node.Body));
public override CSharpSyntaxNode VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OmittedArraySizeExpressionToken));
public override CSharpSyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StringStartToken), VisitList(node.Contents), (SyntaxToken)Visit(node.StringEndToken));
public override CSharpSyntaxNode VisitIsPatternExpression(IsPatternExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.IsKeyword), (PatternSyntax)Visit(node.Pattern));
public override CSharpSyntaxNode VisitThrowExpression(ThrowExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitWhenClause(WhenClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhenKeyword), (ExpressionSyntax)Visit(node.Condition));
public override CSharpSyntaxNode VisitDiscardPattern(DiscardPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.UnderscoreToken));
public override CSharpSyntaxNode VisitDeclarationPattern(DeclarationPatternSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitVarPattern(VarPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.VarKeyword), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitRecursivePattern(RecursivePatternSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (PositionalPatternClauseSyntax)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax)Visit(node.PropertyPatternClause), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitPositionalPatternClause(PositionalPatternClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitPropertyPatternClause(PropertyPatternClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitSubpattern(SubpatternSyntax node)
=> node.Update((BaseExpressionColonSyntax)Visit(node.ExpressionColon), (PatternSyntax)Visit(node.Pattern));
public override CSharpSyntaxNode VisitConstantPattern(ConstantPatternSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (PatternSyntax)Visit(node.Pattern), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitRelationalPattern(RelationalPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitTypePattern(TypePatternSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitBinaryPattern(BinaryPatternSyntax node)
=> node.Update((PatternSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitUnaryPattern(UnaryPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Pattern));
public override CSharpSyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node)
=> node.Update((SyntaxToken)Visit(node.TextToken));
public override CSharpSyntaxNode VisitInterpolation(InterpolationSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), (ExpressionSyntax)Visit(node.Expression), (InterpolationAlignmentClauseSyntax)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax)Visit(node.FormatClause), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.CommaToken), (ExpressionSyntax)Visit(node.Value));
public override CSharpSyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.FormatStringToken));
public override CSharpSyntaxNode VisitGlobalStatement(GlobalStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitBlock(BlockSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Statements), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitLocalFunctionStatement(LocalFunctionStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), VisitList(node.Variables));
public override CSharpSyntaxNode VisitVariableDeclarator(VariableDeclaratorSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier), (BracketedArgumentListSyntax)Visit(node.ArgumentList), (EqualsValueClauseSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitEqualsValueClause(EqualsValueClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Value));
public override CSharpSyntaxNode VisitSingleVariableDesignation(SingleVariableDesignationSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitDiscardDesignation(DiscardDesignationSyntax node)
=> node.Update((SyntaxToken)Visit(node.UnderscoreToken));
public override CSharpSyntaxNode VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Variables), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitExpressionStatement(ExpressionStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEmptyStatement(EmptyStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitLabeledStatement(LabeledStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitGotoStatement(GotoStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.GotoKeyword), (SyntaxToken)Visit(node.CaseOrDefaultKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitBreakStatement(BreakStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.BreakKeyword), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitContinueStatement(ContinueStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ContinueKeyword), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitReturnStatement(ReturnStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ReturnKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitThrowStatement(ThrowStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitYieldStatement(YieldStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.YieldKeyword), (SyntaxToken)Visit(node.ReturnOrBreakKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitWhileStatement(WhileStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitDoStatement(DoStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.DoKeyword), (StatementSyntax)Visit(node.Statement), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitForStatement(ForStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ForKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), VisitList(node.Initializers), (SyntaxToken)Visit(node.FirstSemicolonToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.SecondSemicolonToken), VisitList(node.Incrementors), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitForEachStatement(ForEachStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitForEachVariableStatement(ForEachVariableStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Variable), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitUsingStatement(UsingStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitFixedStatement(FixedStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.FixedKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitCheckedStatement(CheckedStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitUnsafeStatement(UnsafeStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.UnsafeKeyword), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitLockStatement(LockStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.LockKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitIfStatement(IfStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.IfKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement), (ElseClauseSyntax)Visit(node.Else));
public override CSharpSyntaxNode VisitElseClause(ElseClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.ElseKeyword), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitSwitchStatement(SwitchStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Sections), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitSwitchSection(SwitchSectionSyntax node)
=> node.Update(VisitList(node.Labels), VisitList(node.Statements));
public override CSharpSyntaxNode VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitCaseSwitchLabel(CaseSwitchLabelSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (ExpressionSyntax)Visit(node.Value), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitSwitchExpression(SwitchExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.GoverningExpression), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Arms), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitSwitchExpressionArm(SwitchExpressionArmSyntax node)
=> node.Update((PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.EqualsGreaterThanToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitTryStatement(TryStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.TryKeyword), (BlockSyntax)Visit(node.Block), VisitList(node.Catches), (FinallyClauseSyntax)Visit(node.Finally));
public override CSharpSyntaxNode VisitCatchClause(CatchClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.CatchKeyword), (CatchDeclarationSyntax)Visit(node.Declaration), (CatchFilterClauseSyntax)Visit(node.Filter), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitCatchDeclaration(CatchDeclarationSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitCatchFilterClause(CatchFilterClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhenKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.FilterExpression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitFinallyClause(FinallyClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.FinallyKeyword), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitCompilationUnit(CompilationUnitSyntax node)
=> node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), (SyntaxToken)Visit(node.EndOfFileToken));
public override CSharpSyntaxNode VisitExternAliasDirective(ExternAliasDirectiveSyntax node)
=> node.Update((SyntaxToken)Visit(node.ExternKeyword), (SyntaxToken)Visit(node.AliasKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
=> node.Update((SyntaxToken)Visit(node.GlobalKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.StaticKeyword), (NameEqualsSyntax)Visit(node.Alias), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members));
public override CSharpSyntaxNode VisitAttributeList(AttributeListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), (AttributeTargetSpecifierSyntax)Visit(node.Target), VisitList(node.Attributes), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitAttribute(AttributeSyntax node)
=> node.Update((NameSyntax)Visit(node.Name), (AttributeArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitAttributeArgumentList(AttributeArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitAttributeArgument(AttributeArgumentSyntax node)
=> node.Update((NameEqualsSyntax)Visit(node.NameEquals), (NameColonSyntax)Visit(node.NameColon), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitNameEquals(NameEqualsSyntax node)
=> node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken));
public override CSharpSyntaxNode VisitTypeParameterList(TypeParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitTypeParameter(TypeParameterSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.VarianceKeyword), (SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EnumKeyword), (SyntaxToken)Visit(node.Identifier), (BaseListSyntax)Visit(node.BaseList), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.EqualsValue));
public override CSharpSyntaxNode VisitBaseList(BaseListSyntax node)
=> node.Update((SyntaxToken)Visit(node.ColonToken), VisitList(node.Types));
public override CSharpSyntaxNode VisitSimpleBaseType(SimpleBaseTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhereKeyword), (IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken), VisitList(node.Constraints));
public override CSharpSyntaxNode VisitConstructorConstraint(ConstructorConstraintSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node)
=> node.Update((SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.QuestionToken));
public override CSharpSyntaxNode VisitTypeConstraint(TypeConstraintSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitDefaultConstraint(DefaultConstraintSyntax node)
=> node.Update((SyntaxToken)Visit(node.DefaultKeyword));
public override CSharpSyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node)
=> node.Update((NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.DotToken));
public override CSharpSyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.OperatorToken), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (TypeSyntax)Visit(node.Type), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitConstructorDeclaration(ConstructorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (ConstructorInitializerSyntax)Visit(node.Initializer), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitConstructorInitializer(ConstructorInitializerSyntax node)
=> node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.ThisOrBaseKeyword), (ArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.TildeToken), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (EqualsValueClauseSyntax)Visit(node.Initializer), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitArrowExpressionClause(ArrowExpressionClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.ArrowToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.ThisKeyword), (BracketedParameterListSyntax)Visit(node.ParameterList), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitAccessorList(AccessorListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Accessors), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitParameterList(ParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitBracketedParameterList(BracketedParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitParameter(ParameterSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.Default));
public override CSharpSyntaxNode VisitFunctionPointerParameter(FunctionPointerParameterSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitIncompleteMember(IncompleteMemberSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node)
=> node.Update(VisitList(node.Tokens));
public override CSharpSyntaxNode VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node)
=> node.Update(VisitList(node.Content), (SyntaxToken)Visit(node.EndOfComment));
public override CSharpSyntaxNode VisitTypeCref(TypeCrefSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitQualifiedCref(QualifiedCrefSyntax node)
=> node.Update((TypeSyntax)Visit(node.Container), (SyntaxToken)Visit(node.DotToken), (MemberCrefSyntax)Visit(node.Member));
public override CSharpSyntaxNode VisitNameMemberCref(NameMemberCrefSyntax node)
=> node.Update((TypeSyntax)Visit(node.Name), (CrefParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitIndexerMemberCref(IndexerMemberCrefSyntax node)
=> node.Update((SyntaxToken)Visit(node.ThisKeyword), (CrefBracketedParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitOperatorMemberCref(OperatorMemberCrefSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.OperatorToken), (CrefParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node)
=> node.Update((SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (SyntaxToken)Visit(node.OperatorKeyword), (TypeSyntax)Visit(node.Type), (CrefParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitCrefParameterList(CrefParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitCrefParameter(CrefParameterSyntax node)
=> node.Update((SyntaxToken)Visit(node.RefKindKeyword), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitXmlElement(XmlElementSyntax node)
=> node.Update((XmlElementStartTagSyntax)Visit(node.StartTag), VisitList(node.Content), (XmlElementEndTagSyntax)Visit(node.EndTag));
public override CSharpSyntaxNode VisitXmlElementStartTag(XmlElementStartTagSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitXmlElementEndTag(XmlElementEndTagSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanSlashToken), (XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitXmlEmptyElement(XmlEmptyElementSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.SlashGreaterThanToken));
public override CSharpSyntaxNode VisitXmlName(XmlNameSyntax node)
=> node.Update((XmlPrefixSyntax)Visit(node.Prefix), (SyntaxToken)Visit(node.LocalName));
public override CSharpSyntaxNode VisitXmlPrefix(XmlPrefixSyntax node)
=> node.Update((SyntaxToken)Visit(node.Prefix), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitXmlTextAttribute(XmlTextAttributeSyntax node)
=> node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndQuoteToken));
public override CSharpSyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
=> node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (CrefSyntax)Visit(node.Cref), (SyntaxToken)Visit(node.EndQuoteToken));
public override CSharpSyntaxNode VisitXmlNameAttribute(XmlNameAttributeSyntax node)
=> node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (IdentifierNameSyntax)Visit(node.Identifier), (SyntaxToken)Visit(node.EndQuoteToken));
public override CSharpSyntaxNode VisitXmlText(XmlTextSyntax node)
=> node.Update(VisitList(node.TextTokens));
public override CSharpSyntaxNode VisitXmlCDataSection(XmlCDataSectionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StartCDataToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndCDataToken));
public override CSharpSyntaxNode VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StartProcessingInstructionToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndProcessingInstructionToken));
public override CSharpSyntaxNode VisitXmlComment(XmlCommentSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.MinusMinusGreaterThanToken));
public override CSharpSyntaxNode VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.IfKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue);
public override CSharpSyntaxNode VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElifKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue);
public override CSharpSyntaxNode VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElseKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken);
public override CSharpSyntaxNode VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndIfKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.RegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndRegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ErrorKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.DefineKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.UndefKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitLineDirectivePosition(LineDirectivePositionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.CommaToken), (SyntaxToken)Visit(node.Character), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (LineDirectivePositionSyntax)Visit(node.Start), (SyntaxToken)Visit(node.MinusToken), (LineDirectivePositionSyntax)Visit(node.End), (SyntaxToken)Visit(node.CharacterOffset), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.ChecksumKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.Guid), (SyntaxToken)Visit(node.Bytes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ReferenceKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LoadKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
}
internal partial class ContextAwareSyntax
{
private SyntaxFactoryContext context;
public ContextAwareSyntax(SyntaxFactoryContext context)
=> this.context = context;
public IdentifierNameSyntax IdentifierName(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.GlobalKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash);
if (cached != null) return (IdentifierNameSyntax)cached;
var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
{
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash);
if (cached != null) return (QualifiedNameSyntax)cached;
var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash);
if (cached != null) return (GenericNameSyntax)cached;
var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash);
if (cached != null) return (TypeArgumentListSyntax)cached;
var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
{
#if DEBUG
if (alias == null) throw new ArgumentNullException(nameof(alias));
if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken));
if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash);
if (cached != null) return (AliasQualifiedNameSyntax)cached;
var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.BoolKeyword:
case SyntaxKind.ByteKeyword:
case SyntaxKind.SByteKeyword:
case SyntaxKind.IntKeyword:
case SyntaxKind.UIntKeyword:
case SyntaxKind.ShortKeyword:
case SyntaxKind.UShortKeyword:
case SyntaxKind.LongKeyword:
case SyntaxKind.ULongKeyword:
case SyntaxKind.FloatKeyword:
case SyntaxKind.DoubleKeyword:
case SyntaxKind.DecimalKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.CharKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.VoidKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash);
if (cached != null) return (PredefinedTypeSyntax)cached;
var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash);
if (cached != null) return (ArrayTypeSyntax)cached;
var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> sizes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (ArrayRankSpecifierSyntax)cached;
var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash);
if (cached != null) return (PointerTypeSyntax)cached;
var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
#endif
return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context);
}
public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash);
if (cached != null) return (FunctionPointerParameterListSyntax)cached;
var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList)
{
#if DEBUG
if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword));
switch (managedOrUnmanagedKeyword.Kind)
{
case SyntaxKind.ManagedKeyword:
case SyntaxKind.UnmanagedKeyword: break;
default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash);
if (cached != null) return (FunctionPointerCallingConventionSyntax)cached;
var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> callingConventions, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash);
if (cached != null) return (NullableTypeSyntax)cached;
var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> elements, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash);
if (cached != null) return (TupleTypeSyntax)cached;
var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash);
if (cached != null) return (TupleElementSyntax)cached;
var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken)
{
#if DEBUG
if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken));
if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash);
if (cached != null) return (OmittedTypeArgumentSyntax)cached;
var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (readOnlyKeyword != null)
{
switch (readOnlyKeyword.Kind)
{
case SyntaxKind.ReadOnlyKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(readOnlyKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash);
if (cached != null) return (RefTypeSyntax)cached;
var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash);
if (cached != null) return (ParenthesizedExpressionSyntax)cached;
var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash);
if (cached != null) return (TupleExpressionSyntax)cached;
var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand)
{
switch (kind)
{
case SyntaxKind.UnaryPlusExpression:
case SyntaxKind.UnaryMinusExpression:
case SyntaxKind.BitwiseNotExpression:
case SyntaxKind.LogicalNotExpression:
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.PreDecrementExpression:
case SyntaxKind.AddressOfExpression:
case SyntaxKind.PointerIndirectionExpression:
case SyntaxKind.IndexExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.CaretToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (operand == null) throw new ArgumentNullException(nameof(operand));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, this.context, out hash);
if (cached != null) return (PrefixUnaryExpressionSyntax)cached;
var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword));
if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash);
if (cached != null) return (AwaitExpressionSyntax)cached;
var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
{
switch (kind)
{
case SyntaxKind.PostIncrementExpression:
case SyntaxKind.PostDecrementExpression:
case SyntaxKind.SuppressNullableWarningExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operand == null) throw new ArgumentNullException(nameof(operand));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.ExclamationToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, this.context, out hash);
if (cached != null) return (PostfixUnaryExpressionSyntax)cached;
var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
{
switch (kind)
{
case SyntaxKind.SimpleMemberAccessExpression:
case SyntaxKind.PointerMemberAccessExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.DotToken:
case SyntaxKind.MinusGreaterThanToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, this.context, out hash);
if (cached != null) return (MemberAccessExpressionSyntax)cached;
var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken));
if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash);
if (cached != null) return (ConditionalAccessExpressionSyntax)cached;
var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash);
if (cached != null) return (MemberBindingExpressionSyntax)cached;
var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash);
if (cached != null) return (ElementBindingExpressionSyntax)cached;
var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash);
if (cached != null) return (RangeExpressionSyntax)cached;
var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash);
if (cached != null) return (ImplicitElementAccessSyntax)cached;
var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.AddExpression:
case SyntaxKind.SubtractExpression:
case SyntaxKind.MultiplyExpression:
case SyntaxKind.DivideExpression:
case SyntaxKind.ModuloExpression:
case SyntaxKind.LeftShiftExpression:
case SyntaxKind.RightShiftExpression:
case SyntaxKind.LogicalOrExpression:
case SyntaxKind.LogicalAndExpression:
case SyntaxKind.BitwiseOrExpression:
case SyntaxKind.BitwiseAndExpression:
case SyntaxKind.ExclusiveOrExpression:
case SyntaxKind.EqualsExpression:
case SyntaxKind.NotEqualsExpression:
case SyntaxKind.LessThanExpression:
case SyntaxKind.LessThanOrEqualExpression:
case SyntaxKind.GreaterThanExpression:
case SyntaxKind.GreaterThanOrEqualExpression:
case SyntaxKind.IsExpression:
case SyntaxKind.AsExpression:
case SyntaxKind.CoalesceExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarBarToken:
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.IsKeyword:
case SyntaxKind.AsKeyword:
case SyntaxKind.QuestionQuestionToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash);
if (cached != null) return (BinaryExpressionSyntax)cached;
var result = new BinaryExpressionSyntax(kind, left, operatorToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.SimpleAssignmentExpression:
case SyntaxKind.AddAssignmentExpression:
case SyntaxKind.SubtractAssignmentExpression:
case SyntaxKind.MultiplyAssignmentExpression:
case SyntaxKind.DivideAssignmentExpression:
case SyntaxKind.ModuloAssignmentExpression:
case SyntaxKind.AndAssignmentExpression:
case SyntaxKind.ExclusiveOrAssignmentExpression:
case SyntaxKind.OrAssignmentExpression:
case SyntaxKind.LeftShiftAssignmentExpression:
case SyntaxKind.RightShiftAssignmentExpression:
case SyntaxKind.CoalesceAssignmentExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash);
if (cached != null) return (AssignmentExpressionSyntax)cached;
var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
{
#if DEBUG
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse));
#endif
return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context);
}
public ThisExpressionSyntax ThisExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash);
if (cached != null) return (ThisExpressionSyntax)cached;
var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BaseExpressionSyntax BaseExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash);
if (cached != null) return (BaseExpressionSyntax)cached;
var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token)
{
switch (kind)
{
case SyntaxKind.ArgListExpression:
case SyntaxKind.NumericLiteralExpression:
case SyntaxKind.StringLiteralExpression:
case SyntaxKind.CharacterLiteralExpression:
case SyntaxKind.TrueLiteralExpression:
case SyntaxKind.FalseLiteralExpression:
case SyntaxKind.NullLiteralExpression:
case SyntaxKind.DefaultLiteralExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
switch (token.Kind)
{
case SyntaxKind.ArgListKeyword:
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.StringLiteralToken:
case SyntaxKind.CharacterLiteralToken:
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.DefaultKeyword: break;
default: throw new ArgumentException(nameof(token));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, token, this.context, out hash);
if (cached != null) return (LiteralExpressionSyntax)cached;
var result = new LiteralExpressionSyntax(kind, token, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context);
}
public RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context);
}
public RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (comma == null) throw new ArgumentNullException(nameof(comma));
if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context);
}
public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
switch (kind)
{
case SyntaxKind.CheckedExpression:
case SyntaxKind.UncheckedExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken, this.context);
}
public DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context);
}
public TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context);
}
public SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context);
}
public InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash);
if (cached != null) return (InvocationExpressionSyntax)cached;
var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash);
if (cached != null) return (ElementAccessExpressionSyntax)cached;
var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash);
if (cached != null) return (ArgumentListSyntax)cached;
var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (BracketedArgumentListSyntax)cached;
var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash);
if (cached != null) return (ArgumentSyntax)cached;
var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash);
if (cached != null) return (ExpressionColonSyntax)cached;
var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash);
if (cached != null) return (NameColonSyntax)cached;
var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash);
if (cached != null) return (DeclarationExpressionSyntax)cached;
var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context);
}
public AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context);
}
public SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameter == null) throw new ArgumentNullException(nameof(parameter));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context);
}
public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash);
if (cached != null) return (RefExpressionSyntax)cached;
var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context);
}
public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken)
{
switch (kind)
{
case SyntaxKind.ObjectInitializerExpression:
case SyntaxKind.CollectionInitializerExpression:
case SyntaxKind.ArrayInitializerExpression:
case SyntaxKind.ComplexElementInitializerExpression:
case SyntaxKind.WithInitializerExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, this.context, out hash);
if (cached != null) return (InitializerExpressionSyntax)cached;
var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash);
if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached;
var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context);
}
public WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword));
if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash);
if (cached != null) return (WithExpressionSyntax)cached;
var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash);
if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached;
var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers, SyntaxToken closeBraceToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context);
}
public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash);
if (cached != null) return (ArrayCreationExpressionSyntax)cached;
var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context);
}
public StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash);
if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached;
var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context);
}
public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body)
{
#if DEBUG
if (fromClause == null) throw new ArgumentNullException(nameof(fromClause));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash);
if (cached != null) return (QueryExpressionSyntax)cached;
var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
{
#if DEBUG
if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash);
if (cached != null) return (QueryBodySyntax)cached;
var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword));
if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context);
}
public LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
{
#if DEBUG
if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword));
if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context);
}
public JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into)
{
#if DEBUG
if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword));
if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (inExpression == null) throw new ArgumentNullException(nameof(inExpression));
if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword));
if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword));
if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression));
if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword));
if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword));
if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression));
#endif
return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context);
}
public JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash);
if (cached != null) return (JoinIntoClauseSyntax)cached;
var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash);
if (cached != null) return (WhereClauseSyntax)cached;
var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> orderings)
{
#if DEBUG
if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword));
if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash);
if (cached != null) return (OrderByClauseSyntax)cached;
var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword)
{
switch (kind)
{
case SyntaxKind.AscendingOrdering:
case SyntaxKind.DescendingOrdering: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (ascendingOrDescendingKeyword != null)
{
switch (ascendingOrDescendingKeyword.Kind)
{
case SyntaxKind.AscendingKeyword:
case SyntaxKind.DescendingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword));
}
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, this.context, out hash);
if (cached != null) return (OrderingSyntax)cached;
var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword));
if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash);
if (cached != null) return (SelectClauseSyntax)cached;
var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
{
#if DEBUG
if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword));
if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword));
if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression));
if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword));
if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword));
if (byExpression == null) throw new ArgumentNullException(nameof(byExpression));
#endif
return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context);
}
public QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash);
if (cached != null) return (QueryContinuationSyntax)cached;
var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken)
{
#if DEBUG
if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken));
if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash);
if (cached != null) return (OmittedArraySizeExpressionSyntax)cached;
var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken)
{
#if DEBUG
if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken));
switch (stringStartToken.Kind)
{
case SyntaxKind.InterpolatedStringStartToken:
case SyntaxKind.InterpolatedVerbatimStringStartToken: break;
default: throw new ArgumentException(nameof(stringStartToken));
}
if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken));
if (stringEndToken.Kind != SyntaxKind.InterpolatedStringEndToken) throw new ArgumentException(nameof(stringEndToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash);
if (cached != null) return (InterpolatedStringExpressionSyntax)cached;
var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword));
if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash);
if (cached != null) return (IsPatternExpressionSyntax)cached;
var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash);
if (cached != null) return (ThrowExpressionSyntax)cached;
var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash);
if (cached != null) return (WhenClauseSyntax)cached;
var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash);
if (cached != null) return (DiscardPatternSyntax)cached;
var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash);
if (cached != null) return (DeclarationPatternSyntax)cached;
var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation)
{
#if DEBUG
if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword));
if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash);
if (cached != null) return (VarPatternSyntax)cached;
var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation)
{
#if DEBUG
#endif
return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context);
}
public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash);
if (cached != null) return (PositionalPatternClauseSyntax)cached;
var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash);
if (cached != null) return (PropertyPatternClauseSyntax)cached;
var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash);
if (cached != null) return (SubpatternSyntax)cached;
var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash);
if (cached != null) return (ConstantPatternSyntax)cached;
var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash);
if (cached != null) return (ParenthesizedPatternSyntax)cached;
var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash);
if (cached != null) return (RelationalPatternSyntax)cached;
var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypePatternSyntax TypePattern(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash);
if (cached != null) return (TypePatternSyntax)cached;
var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
{
switch (kind)
{
case SyntaxKind.OrPattern:
case SyntaxKind.AndPattern: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.OrKeyword:
case SyntaxKind.AndKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash);
if (cached != null) return (BinaryPatternSyntax)cached;
var result = new BinaryPatternSyntax(kind, left, operatorToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash);
if (cached != null) return (UnaryPatternSyntax)cached;
var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken)
{
#if DEBUG
if (textToken == null) throw new ArgumentNullException(nameof(textToken));
if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash);
if (cached != null) return (InterpolatedStringTextSyntax)cached;
var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context);
}
public InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value)
{
#if DEBUG
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash);
if (cached != null) return (InterpolationAlignmentClauseSyntax)cached;
var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken));
if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash);
if (cached != null) return (InterpolationFormatClauseSyntax)cached;
var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, StatementSyntax statement)
{
#if DEBUG
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash);
if (cached != null) return (GlobalStatementSyntax)cached;
var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context);
}
public LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context);
}
public LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword != null)
{
switch (usingKeyword.Kind)
{
case SyntaxKind.UsingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(usingKeyword));
}
}
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context);
}
public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> variables)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash);
if (cached != null) return (VariableDeclarationSyntax)cached;
var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash);
if (cached != null) return (VariableDeclaratorSyntax)cached;
var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value)
{
#if DEBUG
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash);
if (cached != null) return (EqualsValueClauseSyntax)cached;
var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash);
if (cached != null) return (SingleVariableDesignationSyntax)cached;
var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash);
if (cached != null) return (DiscardDesignationSyntax)cached;
var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> variables, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash);
if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached;
var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash);
if (cached != null) return (ExpressionStatementSyntax)cached;
var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken semicolonToken)
{
#if DEBUG
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash);
if (cached != null) return (EmptyStatementSyntax)cached;
var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context);
}
public GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.GotoStatement:
case SyntaxKind.GotoCaseStatement:
case SyntaxKind.GotoDefaultStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword));
if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword));
if (caseOrDefaultKeyword != null)
{
switch (caseOrDefaultKeyword.Kind)
{
case SyntaxKind.CaseKeyword:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(caseOrDefaultKeyword));
}
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context);
}
public BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword));
if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash);
if (cached != null) return (BreakStatementSyntax)cached;
var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword));
if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash);
if (cached != null) return (ContinueStatementSyntax)cached;
var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword));
if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context);
}
public ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context);
}
public YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.YieldReturnStatement:
case SyntaxKind.YieldBreakStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword));
if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword));
if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword));
switch (returnOrBreakKeyword.Kind)
{
case SyntaxKind.ReturnKeyword:
case SyntaxKind.BreakKeyword: break;
default: throw new ArgumentException(nameof(returnOrBreakKeyword));
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context);
}
public WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context);
}
public DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
{
#if DEBUG
if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword));
if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context);
}
public ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword));
if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken));
if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken));
if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken));
if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context);
}
public ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context);
}
public ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (variable == null) throw new ArgumentNullException(nameof(variable));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context);
}
public UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context);
}
public FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword));
if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context);
}
public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block)
{
switch (kind)
{
case SyntaxKind.CheckedStatement:
case SyntaxKind.UncheckedStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, this.context, out hash);
if (cached != null) return (CheckedStatementSyntax)cached;
var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
{
#if DEBUG
if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword));
if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash);
if (cached != null) return (UnsafeStatementSyntax)cached;
var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword));
if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context);
}
public IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else)
{
#if DEBUG
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context);
}
public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement)
{
#if DEBUG
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash);
if (cached != null) return (ElseClauseSyntax)cached;
var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> sections, SyntaxToken closeBraceToken)
{
#if DEBUG
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openParenToken != null)
{
switch (openParenToken.Kind)
{
case SyntaxKind.OpenParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openParenToken));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken != null)
{
switch (closeParenToken.Kind)
{
case SyntaxKind.CloseParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeParenToken));
}
}
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context);
}
public SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements)
{
#if DEBUG
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash);
if (cached != null) return (SwitchSectionSyntax)cached;
var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context);
}
public CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (value == null) throw new ArgumentNullException(nameof(value));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash);
if (cached != null) return (CaseSwitchLabelSyntax)cached;
var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash);
if (cached != null) return (DefaultSwitchLabelSyntax)cached;
var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
#if DEBUG
if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression));
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context);
}
public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken));
if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context);
}
public TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> catches, FinallyClauseSyntax? @finally)
{
#if DEBUG
if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword));
if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context);
}
public CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block)
{
#if DEBUG
if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword));
if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context);
}
public CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context);
}
public CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context);
}
public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block)
{
#if DEBUG
if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword));
if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash);
if (cached != null) return (FinallyClauseSyntax)cached;
var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken endOfFileToken)
{
#if DEBUG
if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken));
if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken));
#endif
return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context);
}
public ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
{
#if DEBUG
if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword));
if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword));
if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword));
if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context);
}
public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken)
{
#if DEBUG
if (globalKeyword != null)
{
switch (globalKeyword.Kind)
{
case SyntaxKind.GlobalKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(globalKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, alias, name, semicolonToken, this.context);
}
public NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context);
}
public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context);
}
public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context);
}
public AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash);
if (cached != null) return (AttributeTargetSpecifierSyntax)cached;
var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, this.context, out hash);
if (cached != null) return (AttributeSyntax)cached;
var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash);
if (cached != null) return (AttributeArgumentListSyntax)cached;
var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash);
if (cached != null) return (AttributeArgumentSyntax)cached;
var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash);
if (cached != null) return (NameEqualsSyntax)cached;
var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash);
if (cached != null) return (TypeParameterListSyntax)cached;
var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier)
{
#if DEBUG
if (varianceKeyword != null)
{
switch (varianceKeyword.Kind)
{
case SyntaxKind.InKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(varianceKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash);
if (cached != null) return (TypeParameterSyntax)cached;
var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (classOrStructKeyword != null)
{
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken != null)
{
switch (openBraceToken.Kind)
{
case SyntaxKind.OpenBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openBraceToken));
}
}
if (closeBraceToken != null)
{
switch (closeBraceToken.Kind)
{
case SyntaxKind.CloseBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeBraceToken));
}
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword));
if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context);
}
public EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context);
}
public BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> types)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash);
if (cached != null) return (BaseListSyntax)cached;
var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash);
if (cached != null) return (SimpleBaseTypeSyntax)cached;
var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash);
if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached;
var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> constraints)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context);
}
public ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash);
if (cached != null) return (ConstructorConstraintSyntax)cached;
var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken)
{
switch (kind)
{
case SyntaxKind.ClassConstraint:
case SyntaxKind.StructConstraint: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword));
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
if (questionToken != null)
{
switch (questionToken.Kind)
{
case SyntaxKind.QuestionToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(questionToken));
}
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, this.context, out hash);
if (cached != null) return (ClassOrStructConstraintSyntax)cached;
var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeConstraintSyntax TypeConstraint(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash);
if (cached != null) return (TypeConstraintSyntax)cached;
var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword)
{
#if DEBUG
if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword));
if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash);
if (cached != null) return (DefaultConstraintSyntax)cached;
var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context);
}
public EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context);
}
public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash);
if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached;
var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context);
}
public OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.IsKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context);
}
public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context);
}
public ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context);
}
public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
{
switch (kind)
{
case SyntaxKind.BaseConstructorInitializer:
case SyntaxKind.ThisConstructorInitializer: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword));
switch (thisOrBaseKeyword.Kind)
{
case SyntaxKind.BaseKeyword:
case SyntaxKind.ThisKeyword: break;
default: throw new ArgumentException(nameof(thisOrBaseKeyword));
}
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, this.context, out hash);
if (cached != null) return (ConstructorInitializerSyntax)cached;
var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken));
if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context);
}
public PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context);
}
public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression)
{
#if DEBUG
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash);
if (cached != null) return (ArrowExpressionClauseSyntax)cached;
var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context);
}
public IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context);
}
public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash);
if (cached != null) return (AccessorListSyntax)cached;
var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.GetAccessorDeclaration:
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.InitAccessorDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.UnknownAccessorDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.InitKeyword:
case SyntaxKind.AddKeyword:
case SyntaxKind.RemoveKeyword:
case SyntaxKind.IdentifierToken: break;
default: throw new ArgumentException(nameof(keyword));
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context);
}
public ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash);
if (cached != null) return (ParameterListSyntax)cached;
var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (BracketedParameterListSyntax)cached;
var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.ArgListKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context);
}
public FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash);
if (cached != null) return (FunctionPointerParameterSyntax)cached;
var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type)
{
#if DEBUG
#endif
return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context);
}
public SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> tokens)
{
#if DEBUG
#endif
return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context);
}
public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment)
{
switch (kind)
{
case SyntaxKind.SingleLineDocumentationCommentTrivia:
case SyntaxKind.MultiLineDocumentationCommentTrivia: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment));
if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment));
#endif
return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment, this.context);
}
public TypeCrefSyntax TypeCref(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash);
if (cached != null) return (TypeCrefSyntax)cached;
var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
{
#if DEBUG
if (container == null) throw new ArgumentNullException(nameof(container));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (member == null) throw new ArgumentNullException(nameof(member));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash);
if (cached != null) return (QualifiedCrefSyntax)cached;
var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash);
if (cached != null) return (NameMemberCrefSyntax)cached;
var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters)
{
#if DEBUG
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash);
if (cached != null) return (IndexerMemberCrefSyntax)cached;
var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters, this.context, out hash);
if (cached != null) return (OperatorMemberCrefSyntax)cached;
var result = new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, type, parameters, this.context);
}
public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash);
if (cached != null) return (CrefParameterListSyntax)cached;
var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (CrefBracketedParameterListSyntax)cached;
var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, TypeSyntax type)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, type, this.context, out hash);
if (cached != null) return (CrefParameterSyntax)cached;
var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, XmlElementEndTagSyntax endTag)
{
#if DEBUG
if (startTag == null) throw new ArgumentNullException(nameof(startTag));
if (endTag == null) throw new ArgumentNullException(nameof(endTag));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash);
if (cached != null) return (XmlElementSyntax)cached;
var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context);
}
public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken));
if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash);
if (cached != null) return (XmlElementEndTagSyntax)cached;
var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken slashGreaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken));
if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken));
#endif
return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context);
}
public XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName)
{
#if DEBUG
if (localName == null) throw new ArgumentNullException(nameof(localName));
if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash);
if (cached != null) return (XmlNameSyntax)cached;
var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken)
{
#if DEBUG
if (prefix == null) throw new ArgumentNullException(nameof(prefix));
if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash);
if (cached != null) return (XmlPrefixSyntax)cached;
var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context);
}
public XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (cref == null) throw new ArgumentNullException(nameof(cref));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context);
}
public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context);
}
public XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens)
{
#if DEBUG
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash);
if (cached != null) return (XmlTextSyntax)cached;
var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endCDataToken)
{
#if DEBUG
if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken));
if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken));
if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken));
if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash);
if (cached != null) return (XmlCDataSectionSyntax)cached;
var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endProcessingInstructionToken)
{
#if DEBUG
if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken));
if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken));
if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken));
#endif
return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context);
}
public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken minusMinusGreaterThanToken)
{
#if DEBUG
if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken));
if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken));
if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken));
if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash);
if (cached != null) return (XmlCommentSyntax)cached;
var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context);
}
public ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword));
if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context);
}
public ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context);
}
public EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword));
if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context);
}
public RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword));
if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context);
}
public EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword));
if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context);
}
public ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword));
if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context);
}
public WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context);
}
public BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context);
}
public DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword));
if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context);
}
public UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword));
if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context);
}
public LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (line == null) throw new ArgumentNullException(nameof(line));
switch (line.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.HiddenKeyword: break;
default: throw new ArgumentException(nameof(line));
}
if (file != null)
{
switch (file.Kind)
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(file));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context);
}
public LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (line == null) throw new ArgumentNullException(nameof(line));
if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line));
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken));
if (character == null) throw new ArgumentNullException(nameof(character));
if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context);
}
public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (start == null) throw new ArgumentNullException(nameof(start));
if (minusToken == null) throw new ArgumentNullException(nameof(minusToken));
if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken));
if (end == null) throw new ArgumentNullException(nameof(end));
if (characterOffset != null)
{
switch (characterOffset.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(characterOffset));
}
}
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context);
}
public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword));
switch (disableOrRestoreKeyword.Kind)
{
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(disableOrRestoreKeyword));
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context);
}
public PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword));
if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (guid == null) throw new ArgumentNullException(nameof(guid));
if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid));
if (bytes == null) throw new ArgumentNullException(nameof(bytes));
if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context);
}
public ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword));
if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context);
}
public LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword));
if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context);
}
public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken));
if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context);
}
public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword));
if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword));
if (settingToken == null) throw new ArgumentNullException(nameof(settingToken));
switch (settingToken.Kind)
{
case SyntaxKind.EnableKeyword:
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(settingToken));
}
if (targetToken != null)
{
switch (targetToken.Kind)
{
case SyntaxKind.WarningsKeyword:
case SyntaxKind.AnnotationsKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(targetToken));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context);
}
}
internal static partial class SyntaxFactory
{
public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.GlobalKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash);
if (cached != null) return (IdentifierNameSyntax)cached;
var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
{
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash);
if (cached != null) return (QualifiedNameSyntax)cached;
var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash);
if (cached != null) return (GenericNameSyntax)cached;
var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash);
if (cached != null) return (TypeArgumentListSyntax)cached;
var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
{
#if DEBUG
if (alias == null) throw new ArgumentNullException(nameof(alias));
if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken));
if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash);
if (cached != null) return (AliasQualifiedNameSyntax)cached;
var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.BoolKeyword:
case SyntaxKind.ByteKeyword:
case SyntaxKind.SByteKeyword:
case SyntaxKind.IntKeyword:
case SyntaxKind.UIntKeyword:
case SyntaxKind.ShortKeyword:
case SyntaxKind.UShortKeyword:
case SyntaxKind.LongKeyword:
case SyntaxKind.ULongKeyword:
case SyntaxKind.FloatKeyword:
case SyntaxKind.DoubleKeyword:
case SyntaxKind.DecimalKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.CharKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.VoidKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash);
if (cached != null) return (PredefinedTypeSyntax)cached;
var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash);
if (cached != null) return (ArrayTypeSyntax)cached;
var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> sizes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash);
if (cached != null) return (ArrayRankSpecifierSyntax)cached;
var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash);
if (cached != null) return (PointerTypeSyntax)cached;
var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
#endif
return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList);
}
public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash);
if (cached != null) return (FunctionPointerParameterListSyntax)cached;
var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList)
{
#if DEBUG
if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword));
switch (managedOrUnmanagedKeyword.Kind)
{
case SyntaxKind.ManagedKeyword:
case SyntaxKind.UnmanagedKeyword: break;
default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash);
if (cached != null) return (FunctionPointerCallingConventionSyntax)cached;
var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> callingConventions, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash);
if (cached != null) return (NullableTypeSyntax)cached;
var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> elements, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash);
if (cached != null) return (TupleTypeSyntax)cached;
var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash);
if (cached != null) return (TupleElementSyntax)cached;
var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken)
{
#if DEBUG
if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken));
if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash);
if (cached != null) return (OmittedTypeArgumentSyntax)cached;
var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (readOnlyKeyword != null)
{
switch (readOnlyKeyword.Kind)
{
case SyntaxKind.ReadOnlyKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(readOnlyKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash);
if (cached != null) return (RefTypeSyntax)cached;
var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash);
if (cached != null) return (ParenthesizedExpressionSyntax)cached;
var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash);
if (cached != null) return (TupleExpressionSyntax)cached;
var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand)
{
switch (kind)
{
case SyntaxKind.UnaryPlusExpression:
case SyntaxKind.UnaryMinusExpression:
case SyntaxKind.BitwiseNotExpression:
case SyntaxKind.LogicalNotExpression:
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.PreDecrementExpression:
case SyntaxKind.AddressOfExpression:
case SyntaxKind.PointerIndirectionExpression:
case SyntaxKind.IndexExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.CaretToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (operand == null) throw new ArgumentNullException(nameof(operand));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, out hash);
if (cached != null) return (PrefixUnaryExpressionSyntax)cached;
var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword));
if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash);
if (cached != null) return (AwaitExpressionSyntax)cached;
var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
{
switch (kind)
{
case SyntaxKind.PostIncrementExpression:
case SyntaxKind.PostDecrementExpression:
case SyntaxKind.SuppressNullableWarningExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operand == null) throw new ArgumentNullException(nameof(operand));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.ExclamationToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, out hash);
if (cached != null) return (PostfixUnaryExpressionSyntax)cached;
var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
{
switch (kind)
{
case SyntaxKind.SimpleMemberAccessExpression:
case SyntaxKind.PointerMemberAccessExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.DotToken:
case SyntaxKind.MinusGreaterThanToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, out hash);
if (cached != null) return (MemberAccessExpressionSyntax)cached;
var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken));
if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash);
if (cached != null) return (ConditionalAccessExpressionSyntax)cached;
var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash);
if (cached != null) return (MemberBindingExpressionSyntax)cached;
var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash);
if (cached != null) return (ElementBindingExpressionSyntax)cached;
var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash);
if (cached != null) return (RangeExpressionSyntax)cached;
var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash);
if (cached != null) return (ImplicitElementAccessSyntax)cached;
var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.AddExpression:
case SyntaxKind.SubtractExpression:
case SyntaxKind.MultiplyExpression:
case SyntaxKind.DivideExpression:
case SyntaxKind.ModuloExpression:
case SyntaxKind.LeftShiftExpression:
case SyntaxKind.RightShiftExpression:
case SyntaxKind.LogicalOrExpression:
case SyntaxKind.LogicalAndExpression:
case SyntaxKind.BitwiseOrExpression:
case SyntaxKind.BitwiseAndExpression:
case SyntaxKind.ExclusiveOrExpression:
case SyntaxKind.EqualsExpression:
case SyntaxKind.NotEqualsExpression:
case SyntaxKind.LessThanExpression:
case SyntaxKind.LessThanOrEqualExpression:
case SyntaxKind.GreaterThanExpression:
case SyntaxKind.GreaterThanOrEqualExpression:
case SyntaxKind.IsExpression:
case SyntaxKind.AsExpression:
case SyntaxKind.CoalesceExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarBarToken:
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.IsKeyword:
case SyntaxKind.AsKeyword:
case SyntaxKind.QuestionQuestionToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash);
if (cached != null) return (BinaryExpressionSyntax)cached;
var result = new BinaryExpressionSyntax(kind, left, operatorToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.SimpleAssignmentExpression:
case SyntaxKind.AddAssignmentExpression:
case SyntaxKind.SubtractAssignmentExpression:
case SyntaxKind.MultiplyAssignmentExpression:
case SyntaxKind.DivideAssignmentExpression:
case SyntaxKind.ModuloAssignmentExpression:
case SyntaxKind.AndAssignmentExpression:
case SyntaxKind.ExclusiveOrAssignmentExpression:
case SyntaxKind.OrAssignmentExpression:
case SyntaxKind.LeftShiftAssignmentExpression:
case SyntaxKind.RightShiftAssignmentExpression:
case SyntaxKind.CoalesceAssignmentExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash);
if (cached != null) return (AssignmentExpressionSyntax)cached;
var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
{
#if DEBUG
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse));
#endif
return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse);
}
public static ThisExpressionSyntax ThisExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash);
if (cached != null) return (ThisExpressionSyntax)cached;
var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BaseExpressionSyntax BaseExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash);
if (cached != null) return (BaseExpressionSyntax)cached;
var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token)
{
switch (kind)
{
case SyntaxKind.ArgListExpression:
case SyntaxKind.NumericLiteralExpression:
case SyntaxKind.StringLiteralExpression:
case SyntaxKind.CharacterLiteralExpression:
case SyntaxKind.TrueLiteralExpression:
case SyntaxKind.FalseLiteralExpression:
case SyntaxKind.NullLiteralExpression:
case SyntaxKind.DefaultLiteralExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
switch (token.Kind)
{
case SyntaxKind.ArgListKeyword:
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.StringLiteralToken:
case SyntaxKind.CharacterLiteralToken:
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.DefaultKeyword: break;
default: throw new ArgumentException(nameof(token));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, token, out hash);
if (cached != null) return (LiteralExpressionSyntax)cached;
var result = new LiteralExpressionSyntax(kind, token);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken);
}
public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken);
}
public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (comma == null) throw new ArgumentNullException(nameof(comma));
if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken);
}
public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
switch (kind)
{
case SyntaxKind.CheckedExpression:
case SyntaxKind.UncheckedExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken);
}
public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken);
}
public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken);
}
public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken);
}
public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash);
if (cached != null) return (InvocationExpressionSyntax)cached;
var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash);
if (cached != null) return (ElementAccessExpressionSyntax)cached;
var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash);
if (cached != null) return (ArgumentListSyntax)cached;
var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash);
if (cached != null) return (BracketedArgumentListSyntax)cached;
var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash);
if (cached != null) return (ArgumentSyntax)cached;
var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash);
if (cached != null) return (ExpressionColonSyntax)cached;
var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash);
if (cached != null) return (NameColonSyntax)cached;
var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash);
if (cached != null) return (DeclarationExpressionSyntax)cached;
var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression);
}
public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody);
}
public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameter == null) throw new ArgumentNullException(nameof(parameter));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody);
}
public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash);
if (cached != null) return (RefExpressionSyntax)cached;
var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody);
}
public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken)
{
switch (kind)
{
case SyntaxKind.ObjectInitializerExpression:
case SyntaxKind.CollectionInitializerExpression:
case SyntaxKind.ArrayInitializerExpression:
case SyntaxKind.ComplexElementInitializerExpression:
case SyntaxKind.WithInitializerExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, out hash);
if (cached != null) return (InitializerExpressionSyntax)cached;
var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash);
if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached;
var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer);
}
public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword));
if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash);
if (cached != null) return (WithExpressionSyntax)cached;
var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash);
if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached;
var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers, SyntaxToken closeBraceToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken);
}
public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash);
if (cached != null) return (ArrayCreationExpressionSyntax)cached;
var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer);
}
public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash);
if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached;
var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer);
}
public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body)
{
#if DEBUG
if (fromClause == null) throw new ArgumentNullException(nameof(fromClause));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash);
if (cached != null) return (QueryExpressionSyntax)cached;
var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
{
#if DEBUG
if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash);
if (cached != null) return (QueryBodySyntax)cached;
var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword));
if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression);
}
public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
{
#if DEBUG
if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword));
if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression);
}
public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into)
{
#if DEBUG
if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword));
if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (inExpression == null) throw new ArgumentNullException(nameof(inExpression));
if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword));
if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword));
if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression));
if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword));
if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword));
if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression));
#endif
return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into);
}
public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash);
if (cached != null) return (JoinIntoClauseSyntax)cached;
var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash);
if (cached != null) return (WhereClauseSyntax)cached;
var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> orderings)
{
#if DEBUG
if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword));
if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash);
if (cached != null) return (OrderByClauseSyntax)cached;
var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword)
{
switch (kind)
{
case SyntaxKind.AscendingOrdering:
case SyntaxKind.DescendingOrdering: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (ascendingOrDescendingKeyword != null)
{
switch (ascendingOrDescendingKeyword.Kind)
{
case SyntaxKind.AscendingKeyword:
case SyntaxKind.DescendingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword));
}
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, out hash);
if (cached != null) return (OrderingSyntax)cached;
var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword));
if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash);
if (cached != null) return (SelectClauseSyntax)cached;
var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
{
#if DEBUG
if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword));
if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword));
if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression));
if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword));
if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword));
if (byExpression == null) throw new ArgumentNullException(nameof(byExpression));
#endif
return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression);
}
public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash);
if (cached != null) return (QueryContinuationSyntax)cached;
var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken)
{
#if DEBUG
if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken));
if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash);
if (cached != null) return (OmittedArraySizeExpressionSyntax)cached;
var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken)
{
#if DEBUG
if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken));
switch (stringStartToken.Kind)
{
case SyntaxKind.InterpolatedStringStartToken:
case SyntaxKind.InterpolatedVerbatimStringStartToken: break;
default: throw new ArgumentException(nameof(stringStartToken));
}
if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken));
if (stringEndToken.Kind != SyntaxKind.InterpolatedStringEndToken) throw new ArgumentException(nameof(stringEndToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash);
if (cached != null) return (InterpolatedStringExpressionSyntax)cached;
var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword));
if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash);
if (cached != null) return (IsPatternExpressionSyntax)cached;
var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash);
if (cached != null) return (ThrowExpressionSyntax)cached;
var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash);
if (cached != null) return (WhenClauseSyntax)cached;
var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash);
if (cached != null) return (DiscardPatternSyntax)cached;
var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash);
if (cached != null) return (DeclarationPatternSyntax)cached;
var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation)
{
#if DEBUG
if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword));
if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash);
if (cached != null) return (VarPatternSyntax)cached;
var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation)
{
#if DEBUG
#endif
return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation);
}
public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash);
if (cached != null) return (PositionalPatternClauseSyntax)cached;
var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash);
if (cached != null) return (PropertyPatternClauseSyntax)cached;
var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash);
if (cached != null) return (SubpatternSyntax)cached;
var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash);
if (cached != null) return (ConstantPatternSyntax)cached;
var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash);
if (cached != null) return (ParenthesizedPatternSyntax)cached;
var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash);
if (cached != null) return (RelationalPatternSyntax)cached;
var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypePatternSyntax TypePattern(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash);
if (cached != null) return (TypePatternSyntax)cached;
var result = new TypePatternSyntax(SyntaxKind.TypePattern, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
{
switch (kind)
{
case SyntaxKind.OrPattern:
case SyntaxKind.AndPattern: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.OrKeyword:
case SyntaxKind.AndKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash);
if (cached != null) return (BinaryPatternSyntax)cached;
var result = new BinaryPatternSyntax(kind, left, operatorToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash);
if (cached != null) return (UnaryPatternSyntax)cached;
var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken)
{
#if DEBUG
if (textToken == null) throw new ArgumentNullException(nameof(textToken));
if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash);
if (cached != null) return (InterpolatedStringTextSyntax)cached;
var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken);
}
public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value)
{
#if DEBUG
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash);
if (cached != null) return (InterpolationAlignmentClauseSyntax)cached;
var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken));
if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash);
if (cached != null) return (InterpolationFormatClauseSyntax)cached;
var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, StatementSyntax statement)
{
#if DEBUG
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash);
if (cached != null) return (GlobalStatementSyntax)cached;
var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken);
}
public static LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken);
}
public static LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword != null)
{
switch (usingKeyword.Kind)
{
case SyntaxKind.UsingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(usingKeyword));
}
}
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken);
}
public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> variables)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash);
if (cached != null) return (VariableDeclarationSyntax)cached;
var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash);
if (cached != null) return (VariableDeclaratorSyntax)cached;
var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value)
{
#if DEBUG
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash);
if (cached != null) return (EqualsValueClauseSyntax)cached;
var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash);
if (cached != null) return (SingleVariableDesignationSyntax)cached;
var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash);
if (cached != null) return (DiscardDesignationSyntax)cached;
var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> variables, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash);
if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached;
var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash);
if (cached != null) return (ExpressionStatementSyntax)cached;
var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken semicolonToken)
{
#if DEBUG
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash);
if (cached != null) return (EmptyStatementSyntax)cached;
var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement);
}
public static GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.GotoStatement:
case SyntaxKind.GotoCaseStatement:
case SyntaxKind.GotoDefaultStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword));
if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword));
if (caseOrDefaultKeyword != null)
{
switch (caseOrDefaultKeyword.Kind)
{
case SyntaxKind.CaseKeyword:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(caseOrDefaultKeyword));
}
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken);
}
public static BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword));
if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash);
if (cached != null) return (BreakStatementSyntax)cached;
var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword));
if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash);
if (cached != null) return (ContinueStatementSyntax)cached;
var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword));
if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken);
}
public static ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken);
}
public static YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.YieldReturnStatement:
case SyntaxKind.YieldBreakStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword));
if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword));
if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword));
switch (returnOrBreakKeyword.Kind)
{
case SyntaxKind.ReturnKeyword:
case SyntaxKind.BreakKeyword: break;
default: throw new ArgumentException(nameof(returnOrBreakKeyword));
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken);
}
public static WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement);
}
public static DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
{
#if DEBUG
if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword));
if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken);
}
public static ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword));
if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken));
if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken));
if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken));
if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement);
}
public static ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement);
}
public static ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (variable == null) throw new ArgumentNullException(nameof(variable));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement);
}
public static UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement);
}
public static FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword));
if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement);
}
public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block)
{
switch (kind)
{
case SyntaxKind.CheckedStatement:
case SyntaxKind.UncheckedStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, out hash);
if (cached != null) return (CheckedStatementSyntax)cached;
var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
{
#if DEBUG
if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword));
if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash);
if (cached != null) return (UnsafeStatementSyntax)cached;
var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword));
if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement);
}
public static IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else)
{
#if DEBUG
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else);
}
public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement)
{
#if DEBUG
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash);
if (cached != null) return (ElseClauseSyntax)cached;
var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> sections, SyntaxToken closeBraceToken)
{
#if DEBUG
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openParenToken != null)
{
switch (openParenToken.Kind)
{
case SyntaxKind.OpenParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openParenToken));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken != null)
{
switch (closeParenToken.Kind)
{
case SyntaxKind.CloseParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeParenToken));
}
}
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken);
}
public static SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements)
{
#if DEBUG
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash);
if (cached != null) return (SwitchSectionSyntax)cached;
var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken);
}
public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (value == null) throw new ArgumentNullException(nameof(value));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash);
if (cached != null) return (CaseSwitchLabelSyntax)cached;
var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash);
if (cached != null) return (DefaultSwitchLabelSyntax)cached;
var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
#if DEBUG
if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression));
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken);
}
public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken));
if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression);
}
public static TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> catches, FinallyClauseSyntax? @finally)
{
#if DEBUG
if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword));
if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally);
}
public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block)
{
#if DEBUG
if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword));
if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block);
}
public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken);
}
public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken);
}
public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block)
{
#if DEBUG
if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword));
if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash);
if (cached != null) return (FinallyClauseSyntax)cached;
var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken endOfFileToken)
{
#if DEBUG
if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken));
if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken));
#endif
return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken);
}
public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
{
#if DEBUG
if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword));
if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword));
if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword));
if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken);
}
public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken)
{
#if DEBUG
if (globalKeyword != null)
{
switch (globalKeyword.Kind)
{
case SyntaxKind.GlobalKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(globalKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, alias, name, semicolonToken);
}
public static NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken);
}
public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node);
}
public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken);
}
public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash);
if (cached != null) return (AttributeTargetSpecifierSyntax)cached;
var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, out hash);
if (cached != null) return (AttributeSyntax)cached;
var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash);
if (cached != null) return (AttributeArgumentListSyntax)cached;
var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash);
if (cached != null) return (AttributeArgumentSyntax)cached;
var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash);
if (cached != null) return (NameEqualsSyntax)cached;
var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash);
if (cached != null) return (TypeParameterListSyntax)cached;
var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier)
{
#if DEBUG
if (varianceKeyword != null)
{
switch (varianceKeyword.Kind)
{
case SyntaxKind.InKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(varianceKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash);
if (cached != null) return (TypeParameterSyntax)cached;
var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (classOrStructKeyword != null)
{
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken != null)
{
switch (openBraceToken.Kind)
{
case SyntaxKind.OpenBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openBraceToken));
}
}
if (closeBraceToken != null)
{
switch (closeBraceToken.Kind)
{
case SyntaxKind.CloseBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeBraceToken));
}
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword));
if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken);
}
public static EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue);
}
public static BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> types)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash);
if (cached != null) return (BaseListSyntax)cached;
var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash);
if (cached != null) return (SimpleBaseTypeSyntax)cached;
var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash);
if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached;
var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> constraints)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node);
}
public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash);
if (cached != null) return (ConstructorConstraintSyntax)cached;
var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken)
{
switch (kind)
{
case SyntaxKind.ClassConstraint:
case SyntaxKind.StructConstraint: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword));
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
if (questionToken != null)
{
switch (questionToken.Kind)
{
case SyntaxKind.QuestionToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(questionToken));
}
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, out hash);
if (cached != null) return (ClassOrStructConstraintSyntax)cached;
var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeConstraintSyntax TypeConstraint(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash);
if (cached != null) return (TypeConstraintSyntax)cached;
var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword)
{
#if DEBUG
if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword));
if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash);
if (cached != null) return (DefaultConstraintSyntax)cached;
var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken);
}
public static EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken);
}
public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash);
if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached;
var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken);
}
public static OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.IsKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken);
}
public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, type, parameterList, body, expressionBody, semicolonToken);
}
public static ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken);
}
public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
{
switch (kind)
{
case SyntaxKind.BaseConstructorInitializer:
case SyntaxKind.ThisConstructorInitializer: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword));
switch (thisOrBaseKeyword.Kind)
{
case SyntaxKind.BaseKeyword:
case SyntaxKind.ThisKeyword: break;
default: throw new ArgumentException(nameof(thisOrBaseKeyword));
}
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, out hash);
if (cached != null) return (ConstructorInitializerSyntax)cached;
var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken));
if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken);
}
public static PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken);
}
public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression)
{
#if DEBUG
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash);
if (cached != null) return (ArrowExpressionClauseSyntax)cached;
var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken);
}
public static IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken);
}
public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash);
if (cached != null) return (AccessorListSyntax)cached;
var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.GetAccessorDeclaration:
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.InitAccessorDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.UnknownAccessorDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.InitKeyword:
case SyntaxKind.AddKeyword:
case SyntaxKind.RemoveKeyword:
case SyntaxKind.IdentifierToken: break;
default: throw new ArgumentException(nameof(keyword));
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken);
}
public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash);
if (cached != null) return (ParameterListSyntax)cached;
var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash);
if (cached != null) return (BracketedParameterListSyntax)cached;
var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.ArgListKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default);
}
public static FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash);
if (cached != null) return (FunctionPointerParameterSyntax)cached;
var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type)
{
#if DEBUG
#endif
return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type);
}
public static SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> tokens)
{
#if DEBUG
#endif
return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node);
}
public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment)
{
switch (kind)
{
case SyntaxKind.SingleLineDocumentationCommentTrivia:
case SyntaxKind.MultiLineDocumentationCommentTrivia: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment));
if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment));
#endif
return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment);
}
public static TypeCrefSyntax TypeCref(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash);
if (cached != null) return (TypeCrefSyntax)cached;
var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
{
#if DEBUG
if (container == null) throw new ArgumentNullException(nameof(container));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (member == null) throw new ArgumentNullException(nameof(member));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash);
if (cached != null) return (QualifiedCrefSyntax)cached;
var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash);
if (cached != null) return (NameMemberCrefSyntax)cached;
var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters)
{
#if DEBUG
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash);
if (cached != null) return (IndexerMemberCrefSyntax)cached;
var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters, out hash);
if (cached != null) return (OperatorMemberCrefSyntax)cached;
var result = new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, type, parameters);
}
public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash);
if (cached != null) return (CrefParameterListSyntax)cached;
var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash);
if (cached != null) return (CrefBracketedParameterListSyntax)cached;
var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, TypeSyntax type)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, type, out hash);
if (cached != null) return (CrefParameterSyntax)cached;
var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, XmlElementEndTagSyntax endTag)
{
#if DEBUG
if (startTag == null) throw new ArgumentNullException(nameof(startTag));
if (endTag == null) throw new ArgumentNullException(nameof(endTag));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash);
if (cached != null) return (XmlElementSyntax)cached;
var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken);
}
public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken));
if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash);
if (cached != null) return (XmlElementEndTagSyntax)cached;
var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken slashGreaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken));
if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken));
#endif
return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken);
}
public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName)
{
#if DEBUG
if (localName == null) throw new ArgumentNullException(nameof(localName));
if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash);
if (cached != null) return (XmlNameSyntax)cached;
var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken)
{
#if DEBUG
if (prefix == null) throw new ArgumentNullException(nameof(prefix));
if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash);
if (cached != null) return (XmlPrefixSyntax)cached;
var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken);
}
public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (cref == null) throw new ArgumentNullException(nameof(cref));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken);
}
public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken);
}
public static XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens)
{
#if DEBUG
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash);
if (cached != null) return (XmlTextSyntax)cached;
var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endCDataToken)
{
#if DEBUG
if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken));
if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken));
if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken));
if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash);
if (cached != null) return (XmlCDataSectionSyntax)cached;
var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endProcessingInstructionToken)
{
#if DEBUG
if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken));
if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken));
if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken));
#endif
return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken);
}
public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken minusMinusGreaterThanToken)
{
#if DEBUG
if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken));
if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken));
if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken));
if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash);
if (cached != null) return (XmlCommentSyntax)cached;
var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
}
public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword));
if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
}
public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken);
}
public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword));
if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive);
}
public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword));
if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive);
}
public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword));
if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive);
}
public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword));
if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive);
}
public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive);
}
public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive);
}
public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword));
if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive);
}
public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword));
if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive);
}
public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (line == null) throw new ArgumentNullException(nameof(line));
switch (line.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.HiddenKeyword: break;
default: throw new ArgumentException(nameof(line));
}
if (file != null)
{
switch (file.Kind)
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(file));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive);
}
public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (line == null) throw new ArgumentNullException(nameof(line));
if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line));
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken));
if (character == null) throw new ArgumentNullException(nameof(character));
if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken);
}
public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (start == null) throw new ArgumentNullException(nameof(start));
if (minusToken == null) throw new ArgumentNullException(nameof(minusToken));
if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken));
if (end == null) throw new ArgumentNullException(nameof(end));
if (characterOffset != null)
{
switch (characterOffset.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(characterOffset));
}
}
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive);
}
public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword));
switch (disableOrRestoreKeyword.Kind)
{
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(disableOrRestoreKeyword));
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive);
}
public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword));
if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (guid == null) throw new ArgumentNullException(nameof(guid));
if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid));
if (bytes == null) throw new ArgumentNullException(nameof(bytes));
if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive);
}
public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword));
if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive);
}
public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword));
if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive);
}
public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken));
if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive);
}
public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword));
if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword));
if (settingToken == null) throw new ArgumentNullException(nameof(settingToken));
switch (settingToken.Kind)
{
case SyntaxKind.EnableKeyword:
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(settingToken));
}
if (targetToken != null)
{
switch (targetToken.Kind)
{
case SyntaxKind.WarningsKeyword:
case SyntaxKind.AnnotationsKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(targetToken));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
}
internal static IEnumerable<Type> GetNodeTypes()
=> new Type[]
{
typeof(IdentifierNameSyntax),
typeof(QualifiedNameSyntax),
typeof(GenericNameSyntax),
typeof(TypeArgumentListSyntax),
typeof(AliasQualifiedNameSyntax),
typeof(PredefinedTypeSyntax),
typeof(ArrayTypeSyntax),
typeof(ArrayRankSpecifierSyntax),
typeof(PointerTypeSyntax),
typeof(FunctionPointerTypeSyntax),
typeof(FunctionPointerParameterListSyntax),
typeof(FunctionPointerCallingConventionSyntax),
typeof(FunctionPointerUnmanagedCallingConventionListSyntax),
typeof(FunctionPointerUnmanagedCallingConventionSyntax),
typeof(NullableTypeSyntax),
typeof(TupleTypeSyntax),
typeof(TupleElementSyntax),
typeof(OmittedTypeArgumentSyntax),
typeof(RefTypeSyntax),
typeof(ParenthesizedExpressionSyntax),
typeof(TupleExpressionSyntax),
typeof(PrefixUnaryExpressionSyntax),
typeof(AwaitExpressionSyntax),
typeof(PostfixUnaryExpressionSyntax),
typeof(MemberAccessExpressionSyntax),
typeof(ConditionalAccessExpressionSyntax),
typeof(MemberBindingExpressionSyntax),
typeof(ElementBindingExpressionSyntax),
typeof(RangeExpressionSyntax),
typeof(ImplicitElementAccessSyntax),
typeof(BinaryExpressionSyntax),
typeof(AssignmentExpressionSyntax),
typeof(ConditionalExpressionSyntax),
typeof(ThisExpressionSyntax),
typeof(BaseExpressionSyntax),
typeof(LiteralExpressionSyntax),
typeof(MakeRefExpressionSyntax),
typeof(RefTypeExpressionSyntax),
typeof(RefValueExpressionSyntax),
typeof(CheckedExpressionSyntax),
typeof(DefaultExpressionSyntax),
typeof(TypeOfExpressionSyntax),
typeof(SizeOfExpressionSyntax),
typeof(InvocationExpressionSyntax),
typeof(ElementAccessExpressionSyntax),
typeof(ArgumentListSyntax),
typeof(BracketedArgumentListSyntax),
typeof(ArgumentSyntax),
typeof(ExpressionColonSyntax),
typeof(NameColonSyntax),
typeof(DeclarationExpressionSyntax),
typeof(CastExpressionSyntax),
typeof(AnonymousMethodExpressionSyntax),
typeof(SimpleLambdaExpressionSyntax),
typeof(RefExpressionSyntax),
typeof(ParenthesizedLambdaExpressionSyntax),
typeof(InitializerExpressionSyntax),
typeof(ImplicitObjectCreationExpressionSyntax),
typeof(ObjectCreationExpressionSyntax),
typeof(WithExpressionSyntax),
typeof(AnonymousObjectMemberDeclaratorSyntax),
typeof(AnonymousObjectCreationExpressionSyntax),
typeof(ArrayCreationExpressionSyntax),
typeof(ImplicitArrayCreationExpressionSyntax),
typeof(StackAllocArrayCreationExpressionSyntax),
typeof(ImplicitStackAllocArrayCreationExpressionSyntax),
typeof(QueryExpressionSyntax),
typeof(QueryBodySyntax),
typeof(FromClauseSyntax),
typeof(LetClauseSyntax),
typeof(JoinClauseSyntax),
typeof(JoinIntoClauseSyntax),
typeof(WhereClauseSyntax),
typeof(OrderByClauseSyntax),
typeof(OrderingSyntax),
typeof(SelectClauseSyntax),
typeof(GroupClauseSyntax),
typeof(QueryContinuationSyntax),
typeof(OmittedArraySizeExpressionSyntax),
typeof(InterpolatedStringExpressionSyntax),
typeof(IsPatternExpressionSyntax),
typeof(ThrowExpressionSyntax),
typeof(WhenClauseSyntax),
typeof(DiscardPatternSyntax),
typeof(DeclarationPatternSyntax),
typeof(VarPatternSyntax),
typeof(RecursivePatternSyntax),
typeof(PositionalPatternClauseSyntax),
typeof(PropertyPatternClauseSyntax),
typeof(SubpatternSyntax),
typeof(ConstantPatternSyntax),
typeof(ParenthesizedPatternSyntax),
typeof(RelationalPatternSyntax),
typeof(TypePatternSyntax),
typeof(BinaryPatternSyntax),
typeof(UnaryPatternSyntax),
typeof(InterpolatedStringTextSyntax),
typeof(InterpolationSyntax),
typeof(InterpolationAlignmentClauseSyntax),
typeof(InterpolationFormatClauseSyntax),
typeof(GlobalStatementSyntax),
typeof(BlockSyntax),
typeof(LocalFunctionStatementSyntax),
typeof(LocalDeclarationStatementSyntax),
typeof(VariableDeclarationSyntax),
typeof(VariableDeclaratorSyntax),
typeof(EqualsValueClauseSyntax),
typeof(SingleVariableDesignationSyntax),
typeof(DiscardDesignationSyntax),
typeof(ParenthesizedVariableDesignationSyntax),
typeof(ExpressionStatementSyntax),
typeof(EmptyStatementSyntax),
typeof(LabeledStatementSyntax),
typeof(GotoStatementSyntax),
typeof(BreakStatementSyntax),
typeof(ContinueStatementSyntax),
typeof(ReturnStatementSyntax),
typeof(ThrowStatementSyntax),
typeof(YieldStatementSyntax),
typeof(WhileStatementSyntax),
typeof(DoStatementSyntax),
typeof(ForStatementSyntax),
typeof(ForEachStatementSyntax),
typeof(ForEachVariableStatementSyntax),
typeof(UsingStatementSyntax),
typeof(FixedStatementSyntax),
typeof(CheckedStatementSyntax),
typeof(UnsafeStatementSyntax),
typeof(LockStatementSyntax),
typeof(IfStatementSyntax),
typeof(ElseClauseSyntax),
typeof(SwitchStatementSyntax),
typeof(SwitchSectionSyntax),
typeof(CasePatternSwitchLabelSyntax),
typeof(CaseSwitchLabelSyntax),
typeof(DefaultSwitchLabelSyntax),
typeof(SwitchExpressionSyntax),
typeof(SwitchExpressionArmSyntax),
typeof(TryStatementSyntax),
typeof(CatchClauseSyntax),
typeof(CatchDeclarationSyntax),
typeof(CatchFilterClauseSyntax),
typeof(FinallyClauseSyntax),
typeof(CompilationUnitSyntax),
typeof(ExternAliasDirectiveSyntax),
typeof(UsingDirectiveSyntax),
typeof(NamespaceDeclarationSyntax),
typeof(FileScopedNamespaceDeclarationSyntax),
typeof(AttributeListSyntax),
typeof(AttributeTargetSpecifierSyntax),
typeof(AttributeSyntax),
typeof(AttributeArgumentListSyntax),
typeof(AttributeArgumentSyntax),
typeof(NameEqualsSyntax),
typeof(TypeParameterListSyntax),
typeof(TypeParameterSyntax),
typeof(ClassDeclarationSyntax),
typeof(StructDeclarationSyntax),
typeof(InterfaceDeclarationSyntax),
typeof(RecordDeclarationSyntax),
typeof(EnumDeclarationSyntax),
typeof(DelegateDeclarationSyntax),
typeof(EnumMemberDeclarationSyntax),
typeof(BaseListSyntax),
typeof(SimpleBaseTypeSyntax),
typeof(PrimaryConstructorBaseTypeSyntax),
typeof(TypeParameterConstraintClauseSyntax),
typeof(ConstructorConstraintSyntax),
typeof(ClassOrStructConstraintSyntax),
typeof(TypeConstraintSyntax),
typeof(DefaultConstraintSyntax),
typeof(FieldDeclarationSyntax),
typeof(EventFieldDeclarationSyntax),
typeof(ExplicitInterfaceSpecifierSyntax),
typeof(MethodDeclarationSyntax),
typeof(OperatorDeclarationSyntax),
typeof(ConversionOperatorDeclarationSyntax),
typeof(ConstructorDeclarationSyntax),
typeof(ConstructorInitializerSyntax),
typeof(DestructorDeclarationSyntax),
typeof(PropertyDeclarationSyntax),
typeof(ArrowExpressionClauseSyntax),
typeof(EventDeclarationSyntax),
typeof(IndexerDeclarationSyntax),
typeof(AccessorListSyntax),
typeof(AccessorDeclarationSyntax),
typeof(ParameterListSyntax),
typeof(BracketedParameterListSyntax),
typeof(ParameterSyntax),
typeof(FunctionPointerParameterSyntax),
typeof(IncompleteMemberSyntax),
typeof(SkippedTokensTriviaSyntax),
typeof(DocumentationCommentTriviaSyntax),
typeof(TypeCrefSyntax),
typeof(QualifiedCrefSyntax),
typeof(NameMemberCrefSyntax),
typeof(IndexerMemberCrefSyntax),
typeof(OperatorMemberCrefSyntax),
typeof(ConversionOperatorMemberCrefSyntax),
typeof(CrefParameterListSyntax),
typeof(CrefBracketedParameterListSyntax),
typeof(CrefParameterSyntax),
typeof(XmlElementSyntax),
typeof(XmlElementStartTagSyntax),
typeof(XmlElementEndTagSyntax),
typeof(XmlEmptyElementSyntax),
typeof(XmlNameSyntax),
typeof(XmlPrefixSyntax),
typeof(XmlTextAttributeSyntax),
typeof(XmlCrefAttributeSyntax),
typeof(XmlNameAttributeSyntax),
typeof(XmlTextSyntax),
typeof(XmlCDataSectionSyntax),
typeof(XmlProcessingInstructionSyntax),
typeof(XmlCommentSyntax),
typeof(IfDirectiveTriviaSyntax),
typeof(ElifDirectiveTriviaSyntax),
typeof(ElseDirectiveTriviaSyntax),
typeof(EndIfDirectiveTriviaSyntax),
typeof(RegionDirectiveTriviaSyntax),
typeof(EndRegionDirectiveTriviaSyntax),
typeof(ErrorDirectiveTriviaSyntax),
typeof(WarningDirectiveTriviaSyntax),
typeof(BadDirectiveTriviaSyntax),
typeof(DefineDirectiveTriviaSyntax),
typeof(UndefDirectiveTriviaSyntax),
typeof(LineDirectiveTriviaSyntax),
typeof(LineDirectivePositionSyntax),
typeof(LineSpanDirectiveTriviaSyntax),
typeof(PragmaWarningDirectiveTriviaSyntax),
typeof(PragmaChecksumDirectiveTriviaSyntax),
typeof(ReferenceDirectiveTriviaSyntax),
typeof(LoadDirectiveTriviaSyntax),
typeof(ShebangDirectiveTriviaSyntax),
typeof(NullableDirectiveTriviaSyntax),
};
}
}
| // <auto-generated />
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.Syntax.InternalSyntax;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
{
/// <summary>Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class NameSyntax : TypeSyntax
{
internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal NameSyntax(SyntaxKind kind)
: base(kind)
{
}
protected NameSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class SimpleNameSyntax : NameSyntax
{
internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal SimpleNameSyntax(SyntaxKind kind)
: base(kind)
{
}
protected SimpleNameSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>SyntaxToken representing the identifier of the simple name.</summary>
public abstract SyntaxToken Identifier { get; }
}
/// <summary>Class which represents the syntax node for identifier name.</summary>
internal sealed partial class IdentifierNameSyntax : SimpleNameSyntax
{
internal readonly SyntaxToken identifier;
internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
/// <summary>SyntaxToken representing the keyword for the kind of the identifier name.</summary>
public override SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.identifier : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IdentifierNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIdentifierName(this);
public IdentifierNameSyntax Update(SyntaxToken identifier)
{
if (identifier != this.Identifier)
{
var newNode = SyntaxFactory.IdentifierName(identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IdentifierNameSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IdentifierNameSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations);
internal IdentifierNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
}
static IdentifierNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IdentifierNameSyntax), r => new IdentifierNameSyntax(r));
}
}
/// <summary>Class which represents the syntax node for qualified name.</summary>
internal sealed partial class QualifiedNameSyntax : NameSyntax
{
internal readonly NameSyntax left;
internal readonly SyntaxToken dotToken;
internal readonly SimpleNameSyntax right;
internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
/// <summary>NameSyntax node representing the name on the left side of the dot token of the qualified name.</summary>
public NameSyntax Left => this.left;
/// <summary>SyntaxToken representing the dot.</summary>
public SyntaxToken DotToken => this.dotToken;
/// <summary>SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name.</summary>
public SimpleNameSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.dotToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQualifiedName(this);
public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
{
if (left != this.Left || dotToken != this.DotToken || right != this.Right)
{
var newNode = SyntaxFactory.QualifiedName(left, dotToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, GetDiagnostics(), annotations);
internal QualifiedNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var dotToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
var right = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.dotToken);
writer.WriteValue(this.right);
}
static QualifiedNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QualifiedNameSyntax), r => new QualifiedNameSyntax(r));
}
}
/// <summary>Class which represents the syntax node for generic name.</summary>
internal sealed partial class GenericNameSyntax : SimpleNameSyntax
{
internal readonly SyntaxToken identifier;
internal readonly TypeArgumentListSyntax typeArgumentList;
internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
/// <summary>SyntaxToken representing the name of the identifier of the generic name.</summary>
public override SyntaxToken Identifier => this.identifier;
/// <summary>TypeArgumentListSyntax node representing the list of type arguments of the generic name.</summary>
public TypeArgumentListSyntax TypeArgumentList => this.typeArgumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.identifier,
1 => this.typeArgumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GenericNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGenericName(this);
public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
{
if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList)
{
var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, GetDiagnostics(), annotations);
internal GenericNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeArgumentList = (TypeArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(typeArgumentList);
this.typeArgumentList = typeArgumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeArgumentList);
}
static GenericNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GenericNameSyntax), r => new GenericNameSyntax(r));
}
}
/// <summary>Class which represents the syntax node for type argument list.</summary>
internal sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken greaterThanToken;
internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
/// <summary>SyntaxToken representing less than.</summary>
public SyntaxToken LessThanToken => this.lessThanToken;
/// <summary>SeparatedSyntaxList of TypeSyntax node representing the type arguments.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing greater than.</summary>
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.arguments,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeArgumentList(this);
public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, GetDiagnostics(), annotations);
internal TypeArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.greaterThanToken);
}
static TypeArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeArgumentListSyntax), r => new TypeArgumentListSyntax(r));
}
}
/// <summary>Class which represents the syntax node for alias qualified name.</summary>
internal sealed partial class AliasQualifiedNameSyntax : NameSyntax
{
internal readonly IdentifierNameSyntax alias;
internal readonly SyntaxToken colonColonToken;
internal readonly SimpleNameSyntax name;
internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
this.AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
this.AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
this.AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>IdentifierNameSyntax node representing the name of the alias</summary>
public IdentifierNameSyntax Alias => this.alias;
/// <summary>SyntaxToken representing colon colon.</summary>
public SyntaxToken ColonColonToken => this.colonColonToken;
/// <summary>SimpleNameSyntax node representing the name that is being alias qualified.</summary>
public SimpleNameSyntax Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.alias,
1 => this.colonColonToken,
2 => this.name,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AliasQualifiedNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAliasQualifiedName(this);
public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
{
if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name)
{
var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, GetDiagnostics(), annotations);
internal AliasQualifiedNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var alias = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(alias);
this.alias = alias;
var colonColonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonColonToken);
this.colonColonToken = colonColonToken;
var name = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.alias);
writer.WriteValue(this.colonColonToken);
writer.WriteValue(this.name);
}
static AliasQualifiedNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AliasQualifiedNameSyntax), r => new AliasQualifiedNameSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class TypeSyntax : ExpressionSyntax
{
internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal TypeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected TypeSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Class which represents the syntax node for predefined types.</summary>
internal sealed partial class PredefinedTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken keyword;
internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
/// <summary>SyntaxToken which represents the keyword corresponding to the predefined type.</summary>
public SyntaxToken Keyword => this.keyword;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.keyword : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PredefinedTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPredefinedType(this);
public PredefinedTypeSyntax Update(SyntaxToken keyword)
{
if (keyword != this.Keyword)
{
var newNode = SyntaxFactory.PredefinedType(keyword);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PredefinedTypeSyntax(this.Kind, this.keyword, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PredefinedTypeSyntax(this.Kind, this.keyword, GetDiagnostics(), annotations);
internal PredefinedTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
}
static PredefinedTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PredefinedTypeSyntax), r => new PredefinedTypeSyntax(r));
}
}
/// <summary>Class which represents the syntax node for the array type.</summary>
internal sealed partial class ArrayTypeSyntax : TypeSyntax
{
internal readonly TypeSyntax elementType;
internal readonly GreenNode? rankSpecifiers;
internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
if (rankSpecifiers != null)
{
this.AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
if (rankSpecifiers != null)
{
this.AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
if (rankSpecifiers != null)
{
this.AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
/// <summary>TypeSyntax node representing the type of the element of the array.</summary>
public TypeSyntax ElementType => this.elementType;
/// <summary>SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> RankSpecifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax>(this.rankSpecifiers);
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elementType,
1 => this.rankSpecifiers,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrayType(this);
public ArrayTypeSyntax Update(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers)
{
if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers)
{
var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, GetDiagnostics(), annotations);
internal ArrayTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elementType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
var rankSpecifiers = (GreenNode?)reader.ReadValue();
if (rankSpecifiers != null)
{
AdjustFlagsAndWidth(rankSpecifiers);
this.rankSpecifiers = rankSpecifiers;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elementType);
writer.WriteValue(this.rankSpecifiers);
}
static ArrayTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrayTypeSyntax), r => new ArrayTypeSyntax(r));
}
}
internal sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? sizes;
internal readonly SyntaxToken closeBracketToken;
internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (sizes != null)
{
this.AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (sizes != null)
{
this.AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (sizes != null)
{
this.AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
public SyntaxToken OpenBracketToken => this.openBracketToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Sizes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.sizes));
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.sizes,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayRankSpecifierSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrayRankSpecifier(this);
public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> sizes, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, GetDiagnostics(), annotations);
internal ArrayRankSpecifierSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var sizes = (GreenNode?)reader.ReadValue();
if (sizes != null)
{
AdjustFlagsAndWidth(sizes);
this.sizes = sizes;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.sizes);
writer.WriteValue(this.closeBracketToken);
}
static ArrayRankSpecifierSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrayRankSpecifierSyntax), r => new ArrayRankSpecifierSyntax(r));
}
}
/// <summary>Class which represents the syntax node for pointer type.</summary>
internal sealed partial class PointerTypeSyntax : TypeSyntax
{
internal readonly TypeSyntax elementType;
internal readonly SyntaxToken asteriskToken;
internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
/// <summary>TypeSyntax node that represents the element type of the pointer.</summary>
public TypeSyntax ElementType => this.elementType;
/// <summary>SyntaxToken representing the asterisk.</summary>
public SyntaxToken AsteriskToken => this.asteriskToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elementType,
1 => this.asteriskToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PointerTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPointerType(this);
public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken)
{
if (elementType != this.ElementType || asteriskToken != this.AsteriskToken)
{
var newNode = SyntaxFactory.PointerType(elementType, asteriskToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, GetDiagnostics(), annotations);
internal PointerTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elementType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
var asteriskToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elementType);
writer.WriteValue(this.asteriskToken);
}
static PointerTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PointerTypeSyntax), r => new PointerTypeSyntax(r));
}
}
internal sealed partial class FunctionPointerTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken delegateKeyword;
internal readonly SyntaxToken asteriskToken;
internal readonly FunctionPointerCallingConventionSyntax? callingConvention;
internal readonly FunctionPointerParameterListSyntax parameterList;
internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
if (callingConvention != null)
{
this.AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
if (callingConvention != null)
{
this.AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
if (callingConvention != null)
{
this.AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
/// <summary>SyntaxToken representing the delegate keyword.</summary>
public SyntaxToken DelegateKeyword => this.delegateKeyword;
/// <summary>SyntaxToken representing the asterisk.</summary>
public SyntaxToken AsteriskToken => this.asteriskToken;
/// <summary>Node representing the optional calling convention.</summary>
public FunctionPointerCallingConventionSyntax? CallingConvention => this.callingConvention;
/// <summary>List of the parameter types and return type of the function pointer.</summary>
public FunctionPointerParameterListSyntax ParameterList => this.parameterList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.delegateKeyword,
1 => this.asteriskToken,
2 => this.callingConvention,
3 => this.parameterList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerType(this);
public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax callingConvention, FunctionPointerParameterListSyntax parameterList)
{
if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList)
{
var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, GetDiagnostics(), annotations);
internal FunctionPointerTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var delegateKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
var asteriskToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(asteriskToken);
this.asteriskToken = asteriskToken;
var callingConvention = (FunctionPointerCallingConventionSyntax?)reader.ReadValue();
if (callingConvention != null)
{
AdjustFlagsAndWidth(callingConvention);
this.callingConvention = callingConvention;
}
var parameterList = (FunctionPointerParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.delegateKeyword);
writer.WriteValue(this.asteriskToken);
writer.WriteValue(this.callingConvention);
writer.WriteValue(this.parameterList);
}
static FunctionPointerTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerTypeSyntax), r => new FunctionPointerTypeSyntax(r));
}
}
/// <summary>Function pointer parameter list syntax.</summary>
internal sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken greaterThanToken;
internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
/// <summary>SyntaxToken representing the less than token.</summary>
public SyntaxToken LessThanToken => this.lessThanToken;
/// <summary>SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>SyntaxToken representing the greater than token.</summary>
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.parameters,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerParameterList(this);
public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations);
internal FunctionPointerParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.greaterThanToken);
}
static FunctionPointerParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterListSyntax), r => new FunctionPointerParameterListSyntax(r));
}
}
/// <summary>Function pointer calling convention syntax.</summary>
internal sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken managedOrUnmanagedKeyword;
internal readonly FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList;
internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
if (unmanagedCallingConventionList != null)
{
this.AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
if (unmanagedCallingConventionList != null)
{
this.AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
if (unmanagedCallingConventionList != null)
{
this.AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
/// <summary>SyntaxToken representing whether the calling convention is managed or unmanaged.</summary>
public SyntaxToken ManagedOrUnmanagedKeyword => this.managedOrUnmanagedKeyword;
/// <summary>Optional list of identifiers that will contribute to an unmanaged calling convention.</summary>
public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => this.unmanagedCallingConventionList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.managedOrUnmanagedKeyword,
1 => this.unmanagedCallingConventionList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerCallingConventionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerCallingConvention(this);
public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax unmanagedCallingConventionList)
{
if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList)
{
var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, GetDiagnostics(), annotations);
internal FunctionPointerCallingConventionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var managedOrUnmanagedKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(managedOrUnmanagedKeyword);
this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword;
var unmanagedCallingConventionList = (FunctionPointerUnmanagedCallingConventionListSyntax?)reader.ReadValue();
if (unmanagedCallingConventionList != null)
{
AdjustFlagsAndWidth(unmanagedCallingConventionList);
this.unmanagedCallingConventionList = unmanagedCallingConventionList;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.managedOrUnmanagedKeyword);
writer.WriteValue(this.unmanagedCallingConventionList);
}
static FunctionPointerCallingConventionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerCallingConventionSyntax), r => new FunctionPointerCallingConventionSyntax(r));
}
}
/// <summary>Function pointer calling convention syntax.</summary>
internal sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? callingConventions;
internal readonly SyntaxToken closeBracketToken;
internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (callingConventions != null)
{
this.AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (callingConventions != null)
{
this.AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (callingConventions != null)
{
this.AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>SyntaxToken representing open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SeparatedSyntaxList of calling convention identifiers.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> CallingConventions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.callingConventions));
/// <summary>SyntaxToken representing close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.callingConventions,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this);
public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> callingConventions, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, GetDiagnostics(), annotations);
internal FunctionPointerUnmanagedCallingConventionListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var callingConventions = (GreenNode?)reader.ReadValue();
if (callingConventions != null)
{
AdjustFlagsAndWidth(callingConventions);
this.callingConventions = callingConventions;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.callingConventions);
writer.WriteValue(this.closeBracketToken);
}
static FunctionPointerUnmanagedCallingConventionListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionListSyntax), r => new FunctionPointerUnmanagedCallingConventionListSyntax(r));
}
}
/// <summary>Individual function pointer unmanaged calling convention.</summary>
internal sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken name;
internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>SyntaxToken representing the calling convention identifier.</summary>
public SyntaxToken Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.name : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this);
public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name)
{
if (name != this.Name)
{
var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, GetDiagnostics(), annotations);
internal FunctionPointerUnmanagedCallingConventionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var name = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
}
static FunctionPointerUnmanagedCallingConventionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionSyntax), r => new FunctionPointerUnmanagedCallingConventionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a nullable type.</summary>
internal sealed partial class NullableTypeSyntax : TypeSyntax
{
internal readonly TypeSyntax elementType;
internal readonly SyntaxToken questionToken;
internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
/// <summary>TypeSyntax node representing the type of the element.</summary>
public TypeSyntax ElementType => this.elementType;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken QuestionToken => this.questionToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elementType,
1 => this.questionToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNullableType(this);
public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken)
{
if (elementType != this.ElementType || questionToken != this.QuestionToken)
{
var newNode = SyntaxFactory.NullableType(elementType, questionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, GetDiagnostics(), annotations);
internal NullableTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elementType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(elementType);
this.elementType = elementType;
var questionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elementType);
writer.WriteValue(this.questionToken);
}
static NullableTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NullableTypeSyntax), r => new NullableTypeSyntax(r));
}
}
/// <summary>Class which represents the syntax node for tuple type.</summary>
internal sealed partial class TupleTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? elements;
internal readonly SyntaxToken closeParenToken;
internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (elements != null)
{
this.AdjustFlagsAndWidth(elements);
this.elements = elements;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (elements != null)
{
this.AdjustFlagsAndWidth(elements);
this.elements = elements;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (elements != null)
{
this.AdjustFlagsAndWidth(elements);
this.elements = elements;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> Elements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.elements));
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.elements,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTupleType(this);
public TupleTypeSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> elements, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, GetDiagnostics(), annotations);
internal TupleTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var elements = (GreenNode?)reader.ReadValue();
if (elements != null)
{
AdjustFlagsAndWidth(elements);
this.elements = elements;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.elements);
writer.WriteValue(this.closeParenToken);
}
static TupleTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TupleTypeSyntax), r => new TupleTypeSyntax(r));
}
}
/// <summary>Tuple type element.</summary>
internal sealed partial class TupleElementSyntax : CSharpSyntaxNode
{
internal readonly TypeSyntax type;
internal readonly SyntaxToken? identifier;
internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
/// <summary>Gets the type of the tuple element.</summary>
public TypeSyntax Type => this.type;
/// <summary>Gets the name of the tuple element.</summary>
public SyntaxToken? Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.identifier,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleElementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTupleElement(this);
public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier)
{
if (type != this.Type || identifier != this.Identifier)
{
var newNode = SyntaxFactory.TupleElement(type, identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TupleElementSyntax(this.Kind, this.type, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TupleElementSyntax(this.Kind, this.type, this.identifier, GetDiagnostics(), annotations);
internal TupleElementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var identifier = (SyntaxToken?)reader.ReadValue();
if (identifier != null)
{
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
}
static TupleElementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TupleElementSyntax), r => new TupleElementSyntax(r));
}
}
/// <summary>Class which represents a placeholder in the type argument list of an unbound generic type.</summary>
internal sealed partial class OmittedTypeArgumentSyntax : TypeSyntax
{
internal readonly SyntaxToken omittedTypeArgumentToken;
internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
/// <summary>SyntaxToken representing the omitted type argument.</summary>
public SyntaxToken OmittedTypeArgumentToken => this.omittedTypeArgumentToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.omittedTypeArgumentToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedTypeArgumentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOmittedTypeArgument(this);
public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken)
{
if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken)
{
var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, GetDiagnostics(), annotations);
internal OmittedTypeArgumentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var omittedTypeArgumentToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(omittedTypeArgumentToken);
this.omittedTypeArgumentToken = omittedTypeArgumentToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.omittedTypeArgumentToken);
}
static OmittedTypeArgumentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OmittedTypeArgumentSyntax), r => new OmittedTypeArgumentSyntax(r));
}
}
/// <summary>The ref modifier of a method's return value or a local.</summary>
internal sealed partial class RefTypeSyntax : TypeSyntax
{
internal readonly SyntaxToken refKeyword;
internal readonly SyntaxToken? readOnlyKeyword;
internal readonly TypeSyntax type;
internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
if (readOnlyKeyword != null)
{
this.AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
if (readOnlyKeyword != null)
{
this.AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
if (readOnlyKeyword != null)
{
this.AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public SyntaxToken RefKeyword => this.refKeyword;
/// <summary>Gets the optional "readonly" keyword.</summary>
public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword;
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.refKeyword,
1 => this.readOnlyKeyword,
2 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefType(this);
public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type)
{
if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type)
{
var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations);
internal RefTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var refKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
var readOnlyKeyword = (SyntaxToken?)reader.ReadValue();
if (readOnlyKeyword != null)
{
AdjustFlagsAndWidth(readOnlyKeyword);
this.readOnlyKeyword = readOnlyKeyword;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.refKeyword);
writer.WriteValue(this.readOnlyKeyword);
writer.WriteValue(this.type);
}
static RefTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefTypeSyntax), r => new RefTypeSyntax(r));
}
}
internal abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode
{
internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal ExpressionOrPatternSyntax(SyntaxKind kind)
: base(kind)
{
}
protected ExpressionOrPatternSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax
{
internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal ExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected ExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Class which represents the syntax node for parenthesized expression.</summary>
internal sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>ExpressionSyntax node representing the expression enclosed within the parenthesis.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.expression,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedExpression(this);
public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal ParenthesizedExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static ParenthesizedExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedExpressionSyntax), r => new ParenthesizedExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for tuple expression.</summary>
internal sealed partial class TupleExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeParenToken;
internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>SeparatedSyntaxList of ArgumentSyntax representing the list of arguments.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.arguments,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTupleExpression(this);
public TupleExpressionSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations);
internal TupleExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeParenToken);
}
static TupleExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TupleExpressionSyntax), r => new TupleExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for prefix unary expression.</summary>
internal sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax operand;
internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
}
internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
}
internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
}
/// <summary>SyntaxToken representing the kind of the operator of the prefix unary expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax representing the operand of the prefix unary expression.</summary>
public ExpressionSyntax Operand => this.operand;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.operand,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrefixUnaryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPrefixUnaryExpression(this);
public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand)
{
if (operatorToken != this.OperatorToken || operand != this.Operand)
{
var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind, operatorToken, operand);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, GetDiagnostics(), annotations);
internal PrefixUnaryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var operand = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(operand);
this.operand = operand;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.operand);
}
static PrefixUnaryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PrefixUnaryExpressionSyntax), r => new PrefixUnaryExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for an "await" expression.</summary>
internal sealed partial class AwaitExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken awaitKeyword;
internal readonly ExpressionSyntax expression;
internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>SyntaxToken representing the kind "await" keyword.</summary>
public SyntaxToken AwaitKeyword => this.awaitKeyword;
/// <summary>ExpressionSyntax representing the operand of the "await" operator.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.awaitKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AwaitExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAwaitExpression(this);
public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression)
{
if (awaitKeyword != this.AwaitKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, GetDiagnostics(), annotations);
internal AwaitExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var awaitKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.expression);
}
static AwaitExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AwaitExpressionSyntax), r => new AwaitExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for postfix unary expression.</summary>
internal sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax operand;
internal readonly SyntaxToken operatorToken;
internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operand);
this.operand = operand;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
/// <summary>ExpressionSyntax representing the operand of the postfix unary expression.</summary>
public ExpressionSyntax Operand => this.operand;
/// <summary>SyntaxToken representing the kind of the operator of the postfix unary expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operand,
1 => this.operatorToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PostfixUnaryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPostfixUnaryExpression(this);
public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken)
{
if (operand != this.Operand || operatorToken != this.OperatorToken)
{
var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind, operand, operatorToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, GetDiagnostics(), annotations);
internal PostfixUnaryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operand = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(operand);
this.operand = operand;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operand);
writer.WriteValue(this.operatorToken);
}
static PostfixUnaryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PostfixUnaryExpressionSyntax), r => new PostfixUnaryExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for member access expression.</summary>
internal sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken operatorToken;
internal readonly SimpleNameSyntax name;
internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>ExpressionSyntax node representing the object that the member belongs to.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing the kind of the operator in the member access expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>SimpleNameSyntax node representing the member being accessed.</summary>
public SimpleNameSyntax Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.operatorToken,
2 => this.name,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberAccessExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMemberAccessExpression(this);
public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
{
if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name)
{
var newNode = SyntaxFactory.MemberAccessExpression(this.Kind, expression, operatorToken, name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, GetDiagnostics(), annotations);
internal MemberAccessExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var name = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.name);
}
static MemberAccessExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MemberAccessExpressionSyntax), r => new MemberAccessExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for conditional access expression.</summary>
internal sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax whenNotNull;
internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
/// <summary>ExpressionSyntax node representing the object conditionally accessed.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the access expression to be executed when the object is not null.</summary>
public ExpressionSyntax WhenNotNull => this.whenNotNull;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.operatorToken,
2 => this.whenNotNull,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalAccessExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConditionalAccessExpression(this);
public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
{
if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull)
{
var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, GetDiagnostics(), annotations);
internal ConditionalAccessExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var whenNotNull = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(whenNotNull);
this.whenNotNull = whenNotNull;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.whenNotNull);
}
static ConditionalAccessExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConditionalAccessExpressionSyntax), r => new ConditionalAccessExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for member binding expression.</summary>
internal sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly SimpleNameSyntax name;
internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
}
/// <summary>SyntaxToken representing dot.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>SimpleNameSyntax node representing the member being bound to.</summary>
public SimpleNameSyntax Name => this.name;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.name,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberBindingExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMemberBindingExpression(this);
public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name)
{
if (operatorToken != this.OperatorToken || name != this.Name)
{
var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, GetDiagnostics(), annotations);
internal MemberBindingExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var name = (SimpleNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.name);
}
static MemberBindingExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MemberBindingExpressionSyntax), r => new MemberBindingExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for element binding expression.</summary>
internal sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax
{
internal readonly BracketedArgumentListSyntax argumentList;
internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>BracketedArgumentListSyntax node representing the list of arguments of the element binding expression.</summary>
public BracketedArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.argumentList : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementBindingExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElementBindingExpression(this);
public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList)
{
if (argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ElementBindingExpression(argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElementBindingExpressionSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElementBindingExpressionSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations);
internal ElementBindingExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var argumentList = (BracketedArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.argumentList);
}
static ElementBindingExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElementBindingExpressionSyntax), r => new ElementBindingExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a range expression.</summary>
internal sealed partial class RangeExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax? leftOperand;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax? rightOperand;
internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (leftOperand != null)
{
this.AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (rightOperand != null)
{
this.AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (leftOperand != null)
{
this.AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (rightOperand != null)
{
this.AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand)
: base(kind)
{
this.SlotCount = 3;
if (leftOperand != null)
{
this.AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (rightOperand != null)
{
this.AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
/// <summary>ExpressionSyntax node representing the expression on the left of the range operator.</summary>
public ExpressionSyntax? LeftOperand => this.leftOperand;
/// <summary>SyntaxToken representing the operator of the range expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the expression on the right of the range operator.</summary>
public ExpressionSyntax? RightOperand => this.rightOperand;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.leftOperand,
1 => this.operatorToken,
2 => this.rightOperand,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RangeExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRangeExpression(this);
public RangeExpressionSyntax Update(ExpressionSyntax leftOperand, SyntaxToken operatorToken, ExpressionSyntax rightOperand)
{
if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand)
{
var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, GetDiagnostics(), annotations);
internal RangeExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var leftOperand = (ExpressionSyntax?)reader.ReadValue();
if (leftOperand != null)
{
AdjustFlagsAndWidth(leftOperand);
this.leftOperand = leftOperand;
}
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var rightOperand = (ExpressionSyntax?)reader.ReadValue();
if (rightOperand != null)
{
AdjustFlagsAndWidth(rightOperand);
this.rightOperand = rightOperand;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.leftOperand);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.rightOperand);
}
static RangeExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RangeExpressionSyntax), r => new RangeExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for implicit element access expression.</summary>
internal sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax
{
internal readonly BracketedArgumentListSyntax argumentList;
internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression.</summary>
public BracketedArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.argumentList : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitElementAccessSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitElementAccess(this);
public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList)
{
if (argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ImplicitElementAccess(argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitElementAccessSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitElementAccessSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations);
internal ImplicitElementAccessSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var argumentList = (BracketedArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.argumentList);
}
static ImplicitElementAccessSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitElementAccessSyntax), r => new ImplicitElementAccessSyntax(r));
}
}
/// <summary>Class which represents an expression that has a binary operator.</summary>
internal sealed partial class BinaryExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax left;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax right;
internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
/// <summary>ExpressionSyntax node representing the expression on the left of the binary operator.</summary>
public ExpressionSyntax Left => this.left;
/// <summary>SyntaxToken representing the operator of the binary expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the expression on the right of the binary operator.</summary>
public ExpressionSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.operatorToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBinaryExpression(this);
public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right)
{
var newNode = SyntaxFactory.BinaryExpression(this.Kind, left, operatorToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations);
internal BinaryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var right = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.right);
}
static BinaryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BinaryExpressionSyntax), r => new BinaryExpressionSyntax(r));
}
}
/// <summary>Class which represents an expression that has an assignment operator.</summary>
internal sealed partial class AssignmentExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax left;
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax right;
internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
/// <summary>ExpressionSyntax node representing the expression on the left of the assignment operator.</summary>
public ExpressionSyntax Left => this.left;
/// <summary>SyntaxToken representing the operator of the assignment expression.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
/// <summary>ExpressionSyntax node representing the expression on the right of the assignment operator.</summary>
public ExpressionSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.operatorToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AssignmentExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAssignmentExpression(this);
public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right)
{
var newNode = SyntaxFactory.AssignmentExpression(this.Kind, left, operatorToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations);
internal AssignmentExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var right = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.right);
}
static AssignmentExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AssignmentExpressionSyntax), r => new AssignmentExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for conditional expression.</summary>
internal sealed partial class ConditionalExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken questionToken;
internal readonly ExpressionSyntax whenTrue;
internal readonly SyntaxToken colonToken;
internal readonly ExpressionSyntax whenFalse;
internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
this.AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
this.AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
this.AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
/// <summary>ExpressionSyntax node representing the condition of the conditional expression.</summary>
public ExpressionSyntax Condition => this.condition;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken QuestionToken => this.questionToken;
/// <summary>ExpressionSyntax node representing the expression to be executed when the condition is true.</summary>
public ExpressionSyntax WhenTrue => this.whenTrue;
/// <summary>SyntaxToken representing the colon.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>ExpressionSyntax node representing the expression to be executed when the condition is false.</summary>
public ExpressionSyntax WhenFalse => this.whenFalse;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.condition,
1 => this.questionToken,
2 => this.whenTrue,
3 => this.colonToken,
4 => this.whenFalse,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConditionalExpression(this);
public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
{
if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse)
{
var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, GetDiagnostics(), annotations);
internal ConditionalExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var questionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
var whenTrue = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(whenTrue);
this.whenTrue = whenTrue;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var whenFalse = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(whenFalse);
this.whenFalse = whenFalse;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.condition);
writer.WriteValue(this.questionToken);
writer.WriteValue(this.whenTrue);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.whenFalse);
}
static ConditionalExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConditionalExpressionSyntax), r => new ConditionalExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class InstanceExpressionSyntax : ExpressionSyntax
{
internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal InstanceExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected InstanceExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Class which represents the syntax node for a this expression.</summary>
internal sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax
{
internal readonly SyntaxToken token;
internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
/// <summary>SyntaxToken representing the this keyword.</summary>
public SyntaxToken Token => this.token;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.token : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThisExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitThisExpression(this);
public ThisExpressionSyntax Update(SyntaxToken token)
{
if (token != this.Token)
{
var newNode = SyntaxFactory.ThisExpression(token);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ThisExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ThisExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations);
internal ThisExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var token = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(token);
this.token = token;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.token);
}
static ThisExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ThisExpressionSyntax), r => new ThisExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a base expression.</summary>
internal sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax
{
internal readonly SyntaxToken token;
internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
/// <summary>SyntaxToken representing the base keyword.</summary>
public SyntaxToken Token => this.token;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.token : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBaseExpression(this);
public BaseExpressionSyntax Update(SyntaxToken token)
{
if (token != this.Token)
{
var newNode = SyntaxFactory.BaseExpression(token);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BaseExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BaseExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations);
internal BaseExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var token = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(token);
this.token = token;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.token);
}
static BaseExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BaseExpressionSyntax), r => new BaseExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for a literal expression.</summary>
internal sealed partial class LiteralExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken token;
internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(token);
this.token = token;
}
/// <summary>SyntaxToken representing the keyword corresponding to the kind of the literal expression.</summary>
public SyntaxToken Token => this.token;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.token : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LiteralExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLiteralExpression(this);
public LiteralExpressionSyntax Update(SyntaxToken token)
{
if (token != this.Token)
{
var newNode = SyntaxFactory.LiteralExpression(this.Kind, token);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LiteralExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LiteralExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations);
internal LiteralExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var token = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(token);
this.token = token;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.token);
}
static LiteralExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LiteralExpressionSyntax), r => new LiteralExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for MakeRef expression.</summary>
internal sealed partial class MakeRefExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the MakeRefKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MakeRefExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMakeRefExpression(this);
public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal MakeRefExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static MakeRefExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MakeRefExpressionSyntax), r => new MakeRefExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for RefType expression.</summary>
internal sealed partial class RefTypeExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the RefTypeKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefTypeExpression(this);
public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal RefTypeExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static RefTypeExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefTypeExpressionSyntax), r => new RefTypeExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for RefValue expression.</summary>
internal sealed partial class RefValueExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken comma;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(comma);
this.comma = comma;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(comma);
this.comma = comma;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(comma);
this.comma = comma;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the RefValueKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Typed reference expression.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>Comma separating the arguments.</summary>
public SyntaxToken Comma => this.comma;
/// <summary>The type of the value.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.comma,
4 => this.type,
5 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefValueExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefValueExpression(this);
public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal RefValueExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var comma = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(comma);
this.comma = comma;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.comma);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static RefValueExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefValueExpressionSyntax), r => new RefValueExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for Checked or Unchecked expression.</summary>
internal sealed partial class CheckedExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the checked or unchecked keyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.expression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCheckedExpression(this);
public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CheckedExpression(this.Kind, keyword, openParenToken, expression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations);
internal CheckedExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
}
static CheckedExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CheckedExpressionSyntax), r => new CheckedExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for Default expression.</summary>
internal sealed partial class DefaultExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the DefaultKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.type,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefaultExpression(this);
public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal DefaultExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static DefaultExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefaultExpressionSyntax), r => new DefaultExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for TypeOf expression.</summary>
internal sealed partial class TypeOfExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the TypeOfKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>The expression to return type of.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.type,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeOfExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeOfExpression(this);
public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal TypeOfExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static TypeOfExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeOfExpressionSyntax), r => new TypeOfExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for SizeOf expression.</summary>
internal sealed partial class SizeOfExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing the SizeOfKeyword.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Argument of the primary function.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.openParenToken,
2 => this.type,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SizeOfExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSizeOfExpression(this);
public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations);
internal SizeOfExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
}
static SizeOfExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SizeOfExpressionSyntax), r => new SizeOfExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for invocation expression.</summary>
internal sealed partial class InvocationExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly ArgumentListSyntax argumentList;
internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>ExpressionSyntax node representing the expression part of the invocation.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>ArgumentListSyntax node representing the list of arguments of the invocation expression.</summary>
public ArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InvocationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInvocationExpression(this);
public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList)
{
if (expression != this.Expression || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.InvocationExpression(expression, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations);
internal InvocationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.argumentList);
}
static InvocationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InvocationExpressionSyntax), r => new InvocationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for element access expression.</summary>
internal sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly BracketedArgumentListSyntax argumentList;
internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>ExpressionSyntax node representing the expression which is accessing the element.</summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>BracketedArgumentListSyntax node representing the list of arguments of the element access expression.</summary>
public BracketedArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementAccessExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElementAccessExpression(this);
public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
{
if (expression != this.Expression || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations);
internal ElementAccessExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var argumentList = (BracketedArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.argumentList);
}
static ElementAccessExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElementAccessExpressionSyntax), r => new ElementAccessExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode
{
internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseArgumentListSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseArgumentListSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments { get; }
}
/// <summary>Class which represents the syntax node for the list of arguments.</summary>
internal sealed partial class ArgumentListSyntax : BaseArgumentListSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeParenToken;
internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>SyntaxToken representing open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>SeparatedSyntaxList of ArgumentSyntax representing the list of arguments.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.arguments,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArgumentList(this);
public ArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations);
internal ArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeParenToken);
}
static ArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArgumentListSyntax), r => new ArgumentListSyntax(r));
}
}
/// <summary>Class which represents the syntax node for bracketed argument list.</summary>
internal sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeBracketToken;
internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>SyntaxToken representing open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SeparatedSyntaxList of ArgumentSyntax representing the list of arguments.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>SyntaxToken representing close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.arguments,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBracketedArgumentList(this);
public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, GetDiagnostics(), annotations);
internal BracketedArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeBracketToken);
}
static BracketedArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BracketedArgumentListSyntax), r => new BracketedArgumentListSyntax(r));
}
}
/// <summary>Class which represents the syntax node for argument.</summary>
internal sealed partial class ArgumentSyntax : CSharpSyntaxNode
{
internal readonly NameColonSyntax? nameColon;
internal readonly SyntaxToken? refKindKeyword;
internal readonly ExpressionSyntax expression;
internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 3;
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>NameColonSyntax node representing the optional name arguments.</summary>
public NameColonSyntax? NameColon => this.nameColon;
/// <summary>SyntaxToken representing the optional ref or out keyword.</summary>
public SyntaxToken? RefKindKeyword => this.refKindKeyword;
/// <summary>ExpressionSyntax node representing the argument.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.nameColon,
1 => this.refKindKeyword,
2 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArgument(this);
public ArgumentSyntax Update(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression)
{
if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, GetDiagnostics(), annotations);
internal ArgumentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var nameColon = (NameColonSyntax?)reader.ReadValue();
if (nameColon != null)
{
AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
var refKindKeyword = (SyntaxToken?)reader.ReadValue();
if (refKindKeyword != null)
{
AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.nameColon);
writer.WriteValue(this.refKindKeyword);
writer.WriteValue(this.expression);
}
static ArgumentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArgumentSyntax), r => new ArgumentSyntax(r));
}
}
internal abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode
{
internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseExpressionColonSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseExpressionColonSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract ExpressionSyntax Expression { get; }
public abstract SyntaxToken ColonToken { get; }
}
internal sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken colonToken;
internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
public override ExpressionSyntax Expression => this.expression;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionColonSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExpressionColon(this);
public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken)
{
if (expression != this.Expression || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.ExpressionColon(expression, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, GetDiagnostics(), annotations);
internal ExpressionColonSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.colonToken);
}
static ExpressionColonSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExpressionColonSyntax), r => new ExpressionColonSyntax(r));
}
}
/// <summary>Class which represents the syntax node for name colon syntax.</summary>
internal sealed partial class NameColonSyntax : BaseExpressionColonSyntax
{
internal readonly IdentifierNameSyntax name;
internal readonly SyntaxToken colonToken;
internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>IdentifierNameSyntax representing the identifier name.</summary>
public IdentifierNameSyntax Name => this.name;
/// <summary>SyntaxToken representing colon.</summary>
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameColonSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNameColon(this);
public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken)
{
if (name != this.Name || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.NameColon(name, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NameColonSyntax(this.Kind, this.name, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NameColonSyntax(this.Kind, this.name, this.colonToken, GetDiagnostics(), annotations);
internal NameColonSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.colonToken);
}
static NameColonSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NameColonSyntax), r => new NameColonSyntax(r));
}
}
/// <summary>Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration.</summary>
internal sealed partial class DeclarationExpressionSyntax : ExpressionSyntax
{
internal readonly TypeSyntax type;
internal readonly VariableDesignationSyntax designation;
internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
public TypeSyntax Type => this.type;
/// <summary>Declaration representing the variable declared in an out parameter or deconstruction.</summary>
public VariableDesignationSyntax Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDeclarationExpression(this);
public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation)
{
if (type != this.Type || designation != this.Designation)
{
var newNode = SyntaxFactory.DeclarationExpression(type, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations);
internal DeclarationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var designation = (VariableDesignationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.designation);
}
static DeclarationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DeclarationExpressionSyntax), r => new DeclarationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for cast expression.</summary>
internal sealed partial class CastExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken closeParenToken;
internal readonly ExpressionSyntax expression;
internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>SyntaxToken representing the open parenthesis.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>TypeSyntax node representing the type to which the expression is being cast.</summary>
public TypeSyntax Type => this.type;
/// <summary>SyntaxToken representing the close parenthesis.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
/// <summary>ExpressionSyntax node representing the expression that is being casted.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.type,
2 => this.closeParenToken,
3 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CastExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCastExpression(this);
public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
{
if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression)
{
var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, GetDiagnostics(), annotations);
internal CastExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.expression);
}
static CastExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CastExpressionSyntax), r => new CastExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent anonymous function expressions are derived.</summary>
internal abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax
{
internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal AnonymousFunctionExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected AnonymousFunctionExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers { get; }
/// <summary>
/// BlockSyntax node representing the body of the anonymous function.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public abstract BlockSyntax? Block { get; }
/// <summary>
/// ExpressionSyntax node representing the body of the anonymous function.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public abstract ExpressionSyntax? ExpressionBody { get; }
}
/// <summary>Class which represents the syntax node for anonymous method expression.</summary>
internal sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax
{
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken delegateKeyword;
internal readonly ParameterListSyntax? parameterList;
internal readonly BlockSyntax block;
internal readonly ExpressionSyntax? expressionBody;
internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody)
: base(kind)
{
this.SlotCount = 5;
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>SyntaxToken representing the delegate keyword.</summary>
public SyntaxToken DelegateKeyword => this.delegateKeyword;
/// <summary>List of parameters of the anonymous method expression, or null if there no parameters are specified.</summary>
public ParameterListSyntax? ParameterList => this.parameterList;
/// <summary>
/// BlockSyntax node representing the body of the anonymous function.
/// This will never be null.
/// </summary>
public override BlockSyntax Block => this.block;
/// <summary>
/// Inherited from AnonymousFunctionExpressionSyntax, but not used for
/// AnonymousMethodExpressionSyntax. This will always be null.
/// </summary>
public override ExpressionSyntax? ExpressionBody => this.expressionBody;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.modifiers,
1 => this.delegateKeyword,
2 => this.parameterList,
3 => this.block,
4 => this.expressionBody,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousMethodExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAnonymousMethodExpression(this);
public AnonymousMethodExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody)
{
if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody)
{
var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, GetDiagnostics(), annotations);
internal AnonymousMethodExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var delegateKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
var parameterList = (ParameterListSyntax?)reader.ReadValue();
if (parameterList != null)
{
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
var expressionBody = (ExpressionSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.delegateKeyword);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.block);
writer.WriteValue(this.expressionBody);
}
static AnonymousMethodExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AnonymousMethodExpressionSyntax), r => new AnonymousMethodExpressionSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent lambda expressions are derived.</summary>
internal abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax
{
internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal LambdaExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected LambdaExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
/// <summary>SyntaxToken representing equals greater than.</summary>
public abstract SyntaxToken ArrowToken { get; }
}
/// <summary>Class which represents the syntax node for a simple lambda expression.</summary>
internal sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly ParameterSyntax parameter;
internal readonly SyntaxToken arrowToken;
internal readonly BlockSyntax? block;
internal readonly ExpressionSyntax? expressionBody;
internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>ParameterSyntax node representing the parameter of the lambda expression.</summary>
public ParameterSyntax Parameter => this.parameter;
/// <summary>SyntaxToken representing equals greater than.</summary>
public override SyntaxToken ArrowToken => this.arrowToken;
/// <summary>
/// BlockSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override BlockSyntax? Block => this.block;
/// <summary>
/// ExpressionSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override ExpressionSyntax? ExpressionBody => this.expressionBody;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.parameter,
3 => this.arrowToken,
4 => this.block,
5 => this.expressionBody,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleLambdaExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSimpleLambdaExpression(this);
public SimpleLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody)
{
var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations);
internal SimpleLambdaExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var parameter = (ParameterSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameter);
this.parameter = parameter;
var arrowToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
var block = (BlockSyntax?)reader.ReadValue();
if (block != null)
{
AdjustFlagsAndWidth(block);
this.block = block;
}
var expressionBody = (ExpressionSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.parameter);
writer.WriteValue(this.arrowToken);
writer.WriteValue(this.block);
writer.WriteValue(this.expressionBody);
}
static SimpleLambdaExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SimpleLambdaExpressionSyntax), r => new SimpleLambdaExpressionSyntax(r));
}
}
internal sealed partial class RefExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken refKeyword;
internal readonly ExpressionSyntax expression;
internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken RefKeyword => this.refKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.refKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRefExpression(this);
public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression)
{
if (refKeyword != this.RefKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.RefExpression(refKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, GetDiagnostics(), annotations);
internal RefExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var refKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(refKeyword);
this.refKeyword = refKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.refKeyword);
writer.WriteValue(this.expression);
}
static RefExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RefExpressionSyntax), r => new RefExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for parenthesized lambda expression.</summary>
internal sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax? returnType;
internal readonly ParameterListSyntax parameterList;
internal readonly SyntaxToken arrowToken;
internal readonly BlockSyntax? block;
internal readonly ExpressionSyntax? expressionBody;
internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (returnType != null)
{
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (returnType != null)
{
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
: base(kind)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (returnType != null)
{
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
if (block != null)
{
this.AdjustFlagsAndWidth(block);
this.block = block;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public TypeSyntax? ReturnType => this.returnType;
/// <summary>ParameterListSyntax node representing the list of parameters for the lambda expression.</summary>
public ParameterListSyntax ParameterList => this.parameterList;
/// <summary>SyntaxToken representing equals greater than.</summary>
public override SyntaxToken ArrowToken => this.arrowToken;
/// <summary>
/// BlockSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override BlockSyntax? Block => this.block;
/// <summary>
/// ExpressionSyntax node representing the body of the lambda.
/// Only one of Block or ExpressionBody will be non-null.
/// </summary>
public override ExpressionSyntax? ExpressionBody => this.expressionBody;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.parameterList,
4 => this.arrowToken,
5 => this.block,
6 => this.expressionBody,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedLambdaExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedLambdaExpression(this);
public ParenthesizedLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody)
{
var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations);
internal ParenthesizedLambdaExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 7;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax?)reader.ReadValue();
if (returnType != null)
{
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var arrowToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
var block = (BlockSyntax?)reader.ReadValue();
if (block != null)
{
AdjustFlagsAndWidth(block);
this.block = block;
}
var expressionBody = (ExpressionSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.arrowToken);
writer.WriteValue(this.block);
writer.WriteValue(this.expressionBody);
}
static ParenthesizedLambdaExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedLambdaExpressionSyntax), r => new ParenthesizedLambdaExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for initializer expression.</summary>
internal sealed partial class InitializerExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? expressions;
internal readonly SyntaxToken closeBraceToken;
internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (expressions != null)
{
this.AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (expressions != null)
{
this.AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (expressions != null)
{
this.AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
/// <summary>SyntaxToken representing the open brace.</summary>
public SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Expressions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.expressions));
/// <summary>SyntaxToken representing the close brace.</summary>
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.expressions,
2 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InitializerExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInitializerExpression(this);
public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.InitializerExpression(this.Kind, openBraceToken, expressions, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, GetDiagnostics(), annotations);
internal InitializerExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var expressions = (GreenNode?)reader.ReadValue();
if (expressions != null)
{
AdjustFlagsAndWidth(expressions);
this.expressions = expressions;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.expressions);
writer.WriteValue(this.closeBraceToken);
}
static InitializerExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InitializerExpressionSyntax), r => new InitializerExpressionSyntax(r));
}
}
internal abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax
{
internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseObjectCreationExpressionSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public abstract SyntaxToken NewKeyword { get; }
/// <summary>ArgumentListSyntax representing the list of arguments passed as part of the object creation expression.</summary>
public abstract ArgumentListSyntax? ArgumentList { get; }
/// <summary>InitializerExpressionSyntax representing the initializer expression for the object being created.</summary>
public abstract InitializerExpressionSyntax? Initializer { get; }
}
/// <summary>Class which represents the syntax node for implicit object creation expression.</summary>
internal sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly ArgumentListSyntax argumentList;
internal readonly InitializerExpressionSyntax? initializer;
internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public override SyntaxToken NewKeyword => this.newKeyword;
/// <summary>ArgumentListSyntax representing the list of arguments passed as part of the object creation expression.</summary>
public override ArgumentListSyntax ArgumentList => this.argumentList;
/// <summary>InitializerExpressionSyntax representing the initializer expression for the object being created.</summary>
public override InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.argumentList,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitObjectCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitObjectCreationExpression(this);
public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, GetDiagnostics(), annotations);
internal ImplicitObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.argumentList);
writer.WriteValue(this.initializer);
}
static ImplicitObjectCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitObjectCreationExpressionSyntax), r => new ImplicitObjectCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for object creation expression.</summary>
internal sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly TypeSyntax type;
internal readonly ArgumentListSyntax? argumentList;
internal readonly InitializerExpressionSyntax? initializer;
internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public override SyntaxToken NewKeyword => this.newKeyword;
/// <summary>TypeSyntax representing the type of the object being created.</summary>
public TypeSyntax Type => this.type;
/// <summary>ArgumentListSyntax representing the list of arguments passed as part of the object creation expression.</summary>
public override ArgumentListSyntax? ArgumentList => this.argumentList;
/// <summary>InitializerExpressionSyntax representing the initializer expression for the object being created.</summary>
public override InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.type,
2 => this.argumentList,
3 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ObjectCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitObjectCreationExpression(this);
public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, GetDiagnostics(), annotations);
internal ObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var argumentList = (ArgumentListSyntax?)reader.ReadValue();
if (argumentList != null)
{
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.argumentList);
writer.WriteValue(this.initializer);
}
static ObjectCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ObjectCreationExpressionSyntax), r => new ObjectCreationExpressionSyntax(r));
}
}
internal sealed partial class WithExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken withKeyword;
internal readonly InitializerExpressionSyntax initializer;
internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
public ExpressionSyntax Expression => this.expression;
public SyntaxToken WithKeyword => this.withKeyword;
/// <summary>InitializerExpressionSyntax representing the initializer expression for the with expression.</summary>
public InitializerExpressionSyntax Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.withKeyword,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WithExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWithExpression(this);
public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
{
if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer)
{
var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, GetDiagnostics(), annotations);
internal WithExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var withKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(withKeyword);
this.withKeyword = withKeyword;
var initializer = (InitializerExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.withKeyword);
writer.WriteValue(this.initializer);
}
static WithExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WithExpressionSyntax), r => new WithExpressionSyntax(r));
}
}
internal sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode
{
internal readonly NameEqualsSyntax? nameEquals;
internal readonly ExpressionSyntax expression;
internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>NameEqualsSyntax representing the optional name of the member being initialized.</summary>
public NameEqualsSyntax? NameEquals => this.nameEquals;
/// <summary>ExpressionSyntax representing the value the member is initialized with.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.nameEquals,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this);
public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax nameEquals, ExpressionSyntax expression)
{
if (nameEquals != this.NameEquals || expression != this.Expression)
{
var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, GetDiagnostics(), annotations);
internal AnonymousObjectMemberDeclaratorSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var nameEquals = (NameEqualsSyntax?)reader.ReadValue();
if (nameEquals != null)
{
AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.nameEquals);
writer.WriteValue(this.expression);
}
static AnonymousObjectMemberDeclaratorSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectMemberDeclaratorSyntax), r => new AnonymousObjectMemberDeclaratorSyntax(r));
}
}
/// <summary>Class which represents the syntax node for anonymous object creation expression.</summary>
internal sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? initializers;
internal readonly SyntaxToken closeBraceToken;
internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>SyntaxToken representing the open brace.</summary>
public SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.initializers));
/// <summary>SyntaxToken representing the close brace.</summary>
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.openBraceToken,
2 => this.initializers,
3 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAnonymousObjectCreationExpression(this);
public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers, SyntaxToken closeBraceToken)
{
if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, GetDiagnostics(), annotations);
internal AnonymousObjectCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var initializers = (GreenNode?)reader.ReadValue();
if (initializers != null)
{
AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.initializers);
writer.WriteValue(this.closeBraceToken);
}
static AnonymousObjectCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectCreationExpressionSyntax), r => new AnonymousObjectCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for array creation expression.</summary>
internal sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly ArrayTypeSyntax type;
internal readonly InitializerExpressionSyntax? initializer;
internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>ArrayTypeSyntax node representing the type of the array.</summary>
public ArrayTypeSyntax Type => this.type;
/// <summary>InitializerExpressionSyntax node representing the initializer of the array creation expression.</summary>
public InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.type,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrayCreationExpression(this);
public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, GetDiagnostics(), annotations);
internal ArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var type = (ArrayTypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.initializer);
}
static ArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrayCreationExpressionSyntax), r => new ArrayCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for implicit array creation expression.</summary>
internal sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? commas;
internal readonly SyntaxToken closeBracketToken;
internal readonly InitializerExpressionSyntax initializer;
internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (commas != null)
{
this.AdjustFlagsAndWidth(commas);
this.commas = commas;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (commas != null)
{
this.AdjustFlagsAndWidth(commas);
this.commas = commas;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (commas != null)
{
this.AdjustFlagsAndWidth(commas);
this.commas = commas;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
/// <summary>SyntaxToken representing the new keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>SyntaxToken representing the open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SyntaxList of SyntaxToken representing the commas in the implicit array creation expression.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Commas => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.commas);
/// <summary>SyntaxToken representing the close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
/// <summary>InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression.</summary>
public InitializerExpressionSyntax Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.openBracketToken,
2 => this.commas,
3 => this.closeBracketToken,
4 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitArrayCreationExpression(this);
public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations);
internal ImplicitArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var commas = (GreenNode?)reader.ReadValue();
if (commas != null)
{
AdjustFlagsAndWidth(commas);
this.commas = commas;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
var initializer = (InitializerExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.commas);
writer.WriteValue(this.closeBracketToken);
writer.WriteValue(this.initializer);
}
static ImplicitArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitArrayCreationExpressionSyntax), r => new ImplicitArrayCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for stackalloc array creation expression.</summary>
internal sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken stackAllocKeyword;
internal readonly TypeSyntax type;
internal readonly InitializerExpressionSyntax? initializer;
internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>SyntaxToken representing the stackalloc keyword.</summary>
public SyntaxToken StackAllocKeyword => this.stackAllocKeyword;
/// <summary>TypeSyntax node representing the type of the stackalloc array.</summary>
public TypeSyntax Type => this.type;
/// <summary>InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression.</summary>
public InitializerExpressionSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.stackAllocKeyword,
1 => this.type,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StackAllocArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitStackAllocArrayCreationExpression(this);
public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax initializer)
{
if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer)
{
var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, GetDiagnostics(), annotations);
internal StackAllocArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var stackAllocKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var initializer = (InitializerExpressionSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.stackAllocKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.initializer);
}
static StackAllocArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(StackAllocArrayCreationExpressionSyntax), r => new StackAllocArrayCreationExpressionSyntax(r));
}
}
/// <summary>Class which represents the syntax node for implicit stackalloc array creation expression.</summary>
internal sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken stackAllocKeyword;
internal readonly SyntaxToken openBracketToken;
internal readonly SyntaxToken closeBracketToken;
internal readonly InitializerExpressionSyntax initializer;
internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
/// <summary>SyntaxToken representing the stackalloc keyword.</summary>
public SyntaxToken StackAllocKeyword => this.stackAllocKeyword;
/// <summary>SyntaxToken representing the open bracket.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>SyntaxToken representing the close bracket.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
/// <summary>InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression.</summary>
public InitializerExpressionSyntax Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.stackAllocKeyword,
1 => this.openBracketToken,
2 => this.closeBracketToken,
3 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this);
public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer)
{
var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations);
internal ImplicitStackAllocArrayCreationExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var stackAllocKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stackAllocKeyword);
this.stackAllocKeyword = stackAllocKeyword;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
var initializer = (InitializerExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.stackAllocKeyword);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.closeBracketToken);
writer.WriteValue(this.initializer);
}
static ImplicitStackAllocArrayCreationExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ImplicitStackAllocArrayCreationExpressionSyntax), r => new ImplicitStackAllocArrayCreationExpressionSyntax(r));
}
}
internal abstract partial class QueryClauseSyntax : CSharpSyntaxNode
{
internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal QueryClauseSyntax(SyntaxKind kind)
: base(kind)
{
}
protected QueryClauseSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode
{
internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal SelectOrGroupClauseSyntax(SyntaxKind kind)
: base(kind)
{
}
protected SelectOrGroupClauseSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class QueryExpressionSyntax : ExpressionSyntax
{
internal readonly FromClauseSyntax fromClause;
internal readonly QueryBodySyntax body;
internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
public FromClauseSyntax FromClause => this.fromClause;
public QueryBodySyntax Body => this.body;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.fromClause,
1 => this.body,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQueryExpression(this);
public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body)
{
if (fromClause != this.FromClause || body != this.Body)
{
var newNode = SyntaxFactory.QueryExpression(fromClause, body);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, GetDiagnostics(), annotations);
internal QueryExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var fromClause = (FromClauseSyntax)reader.ReadValue();
AdjustFlagsAndWidth(fromClause);
this.fromClause = fromClause;
var body = (QueryBodySyntax)reader.ReadValue();
AdjustFlagsAndWidth(body);
this.body = body;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.fromClause);
writer.WriteValue(this.body);
}
static QueryExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QueryExpressionSyntax), r => new QueryExpressionSyntax(r));
}
}
internal sealed partial class QueryBodySyntax : CSharpSyntaxNode
{
internal readonly GreenNode? clauses;
internal readonly SelectOrGroupClauseSyntax selectOrGroup;
internal readonly QueryContinuationSyntax? continuation;
internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (clauses != null)
{
this.AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
this.AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
if (continuation != null)
{
this.AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (clauses != null)
{
this.AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
this.AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
if (continuation != null)
{
this.AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
: base(kind)
{
this.SlotCount = 3;
if (clauses != null)
{
this.AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
this.AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
if (continuation != null)
{
this.AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> Clauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax>(this.clauses);
public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup;
public QueryContinuationSyntax? Continuation => this.continuation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.clauses,
1 => this.selectOrGroup,
2 => this.continuation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryBodySyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQueryBody(this);
public QueryBodySyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation)
{
if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation)
{
var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, GetDiagnostics(), annotations);
internal QueryBodySyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var clauses = (GreenNode?)reader.ReadValue();
if (clauses != null)
{
AdjustFlagsAndWidth(clauses);
this.clauses = clauses;
}
var selectOrGroup = (SelectOrGroupClauseSyntax)reader.ReadValue();
AdjustFlagsAndWidth(selectOrGroup);
this.selectOrGroup = selectOrGroup;
var continuation = (QueryContinuationSyntax?)reader.ReadValue();
if (continuation != null)
{
AdjustFlagsAndWidth(continuation);
this.continuation = continuation;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.clauses);
writer.WriteValue(this.selectOrGroup);
writer.WriteValue(this.continuation);
}
static QueryBodySyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QueryBodySyntax), r => new QueryBodySyntax(r));
}
}
internal sealed partial class FromClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken fromKeyword;
internal readonly TypeSyntax? type;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax expression;
internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken FromKeyword => this.fromKeyword;
public TypeSyntax? Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public SyntaxToken InKeyword => this.inKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.fromKeyword,
1 => this.type,
2 => this.identifier,
3 => this.inKeyword,
4 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FromClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFromClause(this);
public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
{
if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, GetDiagnostics(), annotations);
internal FromClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var fromKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(fromKeyword);
this.fromKeyword = fromKeyword;
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.fromKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.expression);
}
static FromClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FromClauseSyntax), r => new FromClauseSyntax(r));
}
}
internal sealed partial class LetClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken letKeyword;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken equalsToken;
internal readonly ExpressionSyntax expression;
internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken LetKeyword => this.letKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public SyntaxToken EqualsToken => this.equalsToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.letKeyword,
1 => this.identifier,
2 => this.equalsToken,
3 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LetClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLetClause(this);
public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
{
if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression)
{
var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, GetDiagnostics(), annotations);
internal LetClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var letKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(letKeyword);
this.letKeyword = letKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.letKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.expression);
}
static LetClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LetClauseSyntax), r => new LetClauseSyntax(r));
}
}
internal sealed partial class JoinClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken joinKeyword;
internal readonly TypeSyntax? type;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax inExpression;
internal readonly SyntaxToken onKeyword;
internal readonly ExpressionSyntax leftExpression;
internal readonly SyntaxToken equalsKeyword;
internal readonly ExpressionSyntax rightExpression;
internal readonly JoinIntoClauseSyntax? into;
internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
this.AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
this.AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
this.AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
this.AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
this.AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
if (into != null)
{
this.AdjustFlagsAndWidth(into);
this.into = into;
}
}
internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
this.AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
this.AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
this.AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
this.AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
this.AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
if (into != null)
{
this.AdjustFlagsAndWidth(into);
this.into = into;
}
}
internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into)
: base(kind)
{
this.SlotCount = 10;
this.AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
this.AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
this.AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
this.AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
this.AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
if (into != null)
{
this.AdjustFlagsAndWidth(into);
this.into = into;
}
}
public SyntaxToken JoinKeyword => this.joinKeyword;
public TypeSyntax? Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public SyntaxToken InKeyword => this.inKeyword;
public ExpressionSyntax InExpression => this.inExpression;
public SyntaxToken OnKeyword => this.onKeyword;
public ExpressionSyntax LeftExpression => this.leftExpression;
public SyntaxToken EqualsKeyword => this.equalsKeyword;
public ExpressionSyntax RightExpression => this.rightExpression;
public JoinIntoClauseSyntax? Into => this.into;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.joinKeyword,
1 => this.type,
2 => this.identifier,
3 => this.inKeyword,
4 => this.inExpression,
5 => this.onKeyword,
6 => this.leftExpression,
7 => this.equalsKeyword,
8 => this.rightExpression,
9 => this.into,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitJoinClause(this);
public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax into)
{
if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into)
{
var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, GetDiagnostics(), annotations);
internal JoinClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var joinKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(joinKeyword);
this.joinKeyword = joinKeyword;
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var inExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(inExpression);
this.inExpression = inExpression;
var onKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(onKeyword);
this.onKeyword = onKeyword;
var leftExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(leftExpression);
this.leftExpression = leftExpression;
var equalsKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsKeyword);
this.equalsKeyword = equalsKeyword;
var rightExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(rightExpression);
this.rightExpression = rightExpression;
var into = (JoinIntoClauseSyntax?)reader.ReadValue();
if (into != null)
{
AdjustFlagsAndWidth(into);
this.into = into;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.joinKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.inExpression);
writer.WriteValue(this.onKeyword);
writer.WriteValue(this.leftExpression);
writer.WriteValue(this.equalsKeyword);
writer.WriteValue(this.rightExpression);
writer.WriteValue(this.into);
}
static JoinClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(JoinClauseSyntax), r => new JoinClauseSyntax(r));
}
}
internal sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken intoKeyword;
internal readonly SyntaxToken identifier;
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
public SyntaxToken IntoKeyword => this.intoKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.intoKeyword,
1 => this.identifier,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitJoinIntoClause(this);
public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier)
{
if (intoKeyword != this.IntoKeyword || identifier != this.Identifier)
{
var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, GetDiagnostics(), annotations);
internal JoinIntoClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var intoKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.intoKeyword);
writer.WriteValue(this.identifier);
}
static JoinIntoClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(JoinIntoClauseSyntax), r => new JoinIntoClauseSyntax(r));
}
}
internal sealed partial class WhereClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken whereKeyword;
internal readonly ExpressionSyntax condition;
internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
public SyntaxToken WhereKeyword => this.whereKeyword;
public ExpressionSyntax Condition => this.condition;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whereKeyword,
1 => this.condition,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhereClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWhereClause(this);
public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition)
{
if (whereKeyword != this.WhereKeyword || condition != this.Condition)
{
var newNode = SyntaxFactory.WhereClause(whereKeyword, condition);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, GetDiagnostics(), annotations);
internal WhereClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var whereKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whereKeyword);
writer.WriteValue(this.condition);
}
static WhereClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WhereClauseSyntax), r => new WhereClauseSyntax(r));
}
}
internal sealed partial class OrderByClauseSyntax : QueryClauseSyntax
{
internal readonly SyntaxToken orderByKeyword;
internal readonly GreenNode? orderings;
internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
if (orderings != null)
{
this.AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
if (orderings != null)
{
this.AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
if (orderings != null)
{
this.AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
public SyntaxToken OrderByKeyword => this.orderByKeyword;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> Orderings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.orderings));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.orderByKeyword,
1 => this.orderings,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderByClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOrderByClause(this);
public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> orderings)
{
if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings)
{
var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, GetDiagnostics(), annotations);
internal OrderByClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var orderByKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(orderByKeyword);
this.orderByKeyword = orderByKeyword;
var orderings = (GreenNode?)reader.ReadValue();
if (orderings != null)
{
AdjustFlagsAndWidth(orderings);
this.orderings = orderings;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.orderByKeyword);
writer.WriteValue(this.orderings);
}
static OrderByClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OrderByClauseSyntax), r => new OrderByClauseSyntax(r));
}
}
internal sealed partial class OrderingSyntax : CSharpSyntaxNode
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken? ascendingOrDescendingKeyword;
internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (ascendingOrDescendingKeyword != null)
{
this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (ascendingOrDescendingKeyword != null)
{
this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (ascendingOrDescendingKeyword != null)
{
this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
public ExpressionSyntax Expression => this.expression;
public SyntaxToken? AscendingOrDescendingKeyword => this.ascendingOrDescendingKeyword;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.ascendingOrDescendingKeyword,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderingSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOrdering(this);
public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword)
{
if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword)
{
var newNode = SyntaxFactory.Ordering(this.Kind, expression, ascendingOrDescendingKeyword);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, GetDiagnostics(), annotations);
internal OrderingSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var ascendingOrDescendingKeyword = (SyntaxToken?)reader.ReadValue();
if (ascendingOrDescendingKeyword != null)
{
AdjustFlagsAndWidth(ascendingOrDescendingKeyword);
this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.ascendingOrDescendingKeyword);
}
static OrderingSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OrderingSyntax), r => new OrderingSyntax(r));
}
}
internal sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax
{
internal readonly SyntaxToken selectKeyword;
internal readonly ExpressionSyntax expression;
internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken SelectKeyword => this.selectKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.selectKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SelectClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSelectClause(this);
public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression)
{
if (selectKeyword != this.SelectKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.SelectClause(selectKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, GetDiagnostics(), annotations);
internal SelectClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var selectKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(selectKeyword);
this.selectKeyword = selectKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.selectKeyword);
writer.WriteValue(this.expression);
}
static SelectClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SelectClauseSyntax), r => new SelectClauseSyntax(r));
}
}
internal sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax
{
internal readonly SyntaxToken groupKeyword;
internal readonly ExpressionSyntax groupExpression;
internal readonly SyntaxToken byKeyword;
internal readonly ExpressionSyntax byExpression;
internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
this.AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
this.AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
this.AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
this.AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
this.AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
this.AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
this.AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
this.AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
this.AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
public SyntaxToken GroupKeyword => this.groupKeyword;
public ExpressionSyntax GroupExpression => this.groupExpression;
public SyntaxToken ByKeyword => this.byKeyword;
public ExpressionSyntax ByExpression => this.byExpression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.groupKeyword,
1 => this.groupExpression,
2 => this.byKeyword,
3 => this.byExpression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GroupClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGroupClause(this);
public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
{
if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression)
{
var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, GetDiagnostics(), annotations);
internal GroupClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var groupKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(groupKeyword);
this.groupKeyword = groupKeyword;
var groupExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(groupExpression);
this.groupExpression = groupExpression;
var byKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(byKeyword);
this.byKeyword = byKeyword;
var byExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(byExpression);
this.byExpression = byExpression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.groupKeyword);
writer.WriteValue(this.groupExpression);
writer.WriteValue(this.byKeyword);
writer.WriteValue(this.byExpression);
}
static GroupClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GroupClauseSyntax), r => new GroupClauseSyntax(r));
}
}
internal sealed partial class QueryContinuationSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken intoKeyword;
internal readonly SyntaxToken identifier;
internal readonly QueryBodySyntax body;
internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(body);
this.body = body;
}
public SyntaxToken IntoKeyword => this.intoKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public QueryBodySyntax Body => this.body;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.intoKeyword,
1 => this.identifier,
2 => this.body,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryContinuationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQueryContinuation(this);
public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
{
if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body)
{
var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, GetDiagnostics(), annotations);
internal QueryContinuationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var intoKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(intoKeyword);
this.intoKeyword = intoKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var body = (QueryBodySyntax)reader.ReadValue();
AdjustFlagsAndWidth(body);
this.body = body;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.intoKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.body);
}
static QueryContinuationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QueryContinuationSyntax), r => new QueryContinuationSyntax(r));
}
}
/// <summary>Class which represents a placeholder in an array size list.</summary>
internal sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken omittedArraySizeExpressionToken;
internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
/// <summary>SyntaxToken representing the omitted array size expression.</summary>
public SyntaxToken OmittedArraySizeExpressionToken => this.omittedArraySizeExpressionToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.omittedArraySizeExpressionToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedArraySizeExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOmittedArraySizeExpression(this);
public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken)
{
if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken)
{
var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, GetDiagnostics(), annotations);
internal OmittedArraySizeExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var omittedArraySizeExpressionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(omittedArraySizeExpressionToken);
this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.omittedArraySizeExpressionToken);
}
static OmittedArraySizeExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OmittedArraySizeExpressionSyntax), r => new OmittedArraySizeExpressionSyntax(r));
}
}
internal sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken stringStartToken;
internal readonly GreenNode? contents;
internal readonly SyntaxToken stringEndToken;
internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
if (contents != null)
{
this.AdjustFlagsAndWidth(contents);
this.contents = contents;
}
this.AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
if (contents != null)
{
this.AdjustFlagsAndWidth(contents);
this.contents = contents;
}
this.AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
if (contents != null)
{
this.AdjustFlagsAndWidth(contents);
this.contents = contents;
}
this.AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
/// <summary>The first part of an interpolated string, $" or $@"</summary>
public SyntaxToken StringStartToken => this.stringStartToken;
/// <summary>List of parts of the interpolated string, each one is either a literal part or an interpolation.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> Contents => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax>(this.contents);
/// <summary>The closing quote of the interpolated string.</summary>
public SyntaxToken StringEndToken => this.stringEndToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.stringStartToken,
1 => this.contents,
2 => this.stringEndToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolatedStringExpression(this);
public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken)
{
if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken)
{
var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, GetDiagnostics(), annotations);
internal InterpolatedStringExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var stringStartToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stringStartToken);
this.stringStartToken = stringStartToken;
var contents = (GreenNode?)reader.ReadValue();
if (contents != null)
{
AdjustFlagsAndWidth(contents);
this.contents = contents;
}
var stringEndToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(stringEndToken);
this.stringEndToken = stringEndToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.stringStartToken);
writer.WriteValue(this.contents);
writer.WriteValue(this.stringEndToken);
}
static InterpolatedStringExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringExpressionSyntax), r => new InterpolatedStringExpressionSyntax(r));
}
}
/// <summary>Class which represents a simple pattern-matching expression using the "is" keyword.</summary>
internal sealed partial class IsPatternExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken isKeyword;
internal readonly PatternSyntax pattern;
internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
/// <summary>ExpressionSyntax node representing the expression on the left of the "is" operator.</summary>
public ExpressionSyntax Expression => this.expression;
public SyntaxToken IsKeyword => this.isKeyword;
/// <summary>PatternSyntax node representing the pattern on the right of the "is" operator.</summary>
public PatternSyntax Pattern => this.pattern;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expression,
1 => this.isKeyword,
2 => this.pattern,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IsPatternExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIsPatternExpression(this);
public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
{
if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern)
{
var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, GetDiagnostics(), annotations);
internal IsPatternExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var isKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(isKeyword);
this.isKeyword = isKeyword;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
writer.WriteValue(this.isKeyword);
writer.WriteValue(this.pattern);
}
static IsPatternExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IsPatternExpressionSyntax), r => new IsPatternExpressionSyntax(r));
}
}
internal sealed partial class ThrowExpressionSyntax : ExpressionSyntax
{
internal readonly SyntaxToken throwKeyword;
internal readonly ExpressionSyntax expression;
internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken ThrowKeyword => this.throwKeyword;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.throwKeyword,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitThrowExpression(this);
public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression)
{
if (throwKeyword != this.ThrowKeyword || expression != this.Expression)
{
var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, GetDiagnostics(), annotations);
internal ThrowExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var throwKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.throwKeyword);
writer.WriteValue(this.expression);
}
static ThrowExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ThrowExpressionSyntax), r => new ThrowExpressionSyntax(r));
}
}
internal sealed partial class WhenClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken whenKeyword;
internal readonly ExpressionSyntax condition;
internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
public SyntaxToken WhenKeyword => this.whenKeyword;
public ExpressionSyntax Condition => this.condition;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whenKeyword,
1 => this.condition,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhenClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWhenClause(this);
public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition)
{
if (whenKeyword != this.WhenKeyword || condition != this.Condition)
{
var newNode = SyntaxFactory.WhenClause(whenKeyword, condition);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, GetDiagnostics(), annotations);
internal WhenClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var whenKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whenKeyword);
writer.WriteValue(this.condition);
}
static WhenClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WhenClauseSyntax), r => new WhenClauseSyntax(r));
}
}
internal abstract partial class PatternSyntax : ExpressionOrPatternSyntax
{
internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal PatternSyntax(SyntaxKind kind)
: base(kind)
{
}
protected PatternSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class DiscardPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken underscoreToken;
internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
public SyntaxToken UnderscoreToken => this.underscoreToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.underscoreToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDiscardPattern(this);
public DiscardPatternSyntax Update(SyntaxToken underscoreToken)
{
if (underscoreToken != this.UnderscoreToken)
{
var newNode = SyntaxFactory.DiscardPattern(underscoreToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DiscardPatternSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DiscardPatternSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations);
internal DiscardPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var underscoreToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.underscoreToken);
}
static DiscardPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DiscardPatternSyntax), r => new DiscardPatternSyntax(r));
}
}
internal sealed partial class DeclarationPatternSyntax : PatternSyntax
{
internal readonly TypeSyntax type;
internal readonly VariableDesignationSyntax designation;
internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
public TypeSyntax Type => this.type;
public VariableDesignationSyntax Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDeclarationPattern(this);
public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation)
{
if (type != this.Type || designation != this.Designation)
{
var newNode = SyntaxFactory.DeclarationPattern(type, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DeclarationPatternSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DeclarationPatternSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations);
internal DeclarationPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var designation = (VariableDesignationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.designation);
}
static DeclarationPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DeclarationPatternSyntax), r => new DeclarationPatternSyntax(r));
}
}
internal sealed partial class VarPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken varKeyword;
internal readonly VariableDesignationSyntax designation;
internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
public SyntaxToken VarKeyword => this.varKeyword;
public VariableDesignationSyntax Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.varKeyword,
1 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VarPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitVarPattern(this);
public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation)
{
if (varKeyword != this.VarKeyword || designation != this.Designation)
{
var newNode = SyntaxFactory.VarPattern(varKeyword, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, GetDiagnostics(), annotations);
internal VarPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var varKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(varKeyword);
this.varKeyword = varKeyword;
var designation = (VariableDesignationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.varKeyword);
writer.WriteValue(this.designation);
}
static VarPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(VarPatternSyntax), r => new VarPatternSyntax(r));
}
}
internal sealed partial class RecursivePatternSyntax : PatternSyntax
{
internal readonly TypeSyntax? type;
internal readonly PositionalPatternClauseSyntax? positionalPatternClause;
internal readonly PropertyPatternClauseSyntax? propertyPatternClause;
internal readonly VariableDesignationSyntax? designation;
internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
if (positionalPatternClause != null)
{
this.AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
if (propertyPatternClause != null)
{
this.AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
if (designation != null)
{
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
if (positionalPatternClause != null)
{
this.AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
if (propertyPatternClause != null)
{
this.AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
if (designation != null)
{
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation)
: base(kind)
{
this.SlotCount = 4;
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
if (positionalPatternClause != null)
{
this.AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
if (propertyPatternClause != null)
{
this.AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
if (designation != null)
{
this.AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
public TypeSyntax? Type => this.type;
public PositionalPatternClauseSyntax? PositionalPatternClause => this.positionalPatternClause;
public PropertyPatternClauseSyntax? PropertyPatternClause => this.propertyPatternClause;
public VariableDesignationSyntax? Designation => this.designation;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.positionalPatternClause,
2 => this.propertyPatternClause,
3 => this.designation,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecursivePatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRecursivePattern(this);
public RecursivePatternSyntax Update(TypeSyntax type, PositionalPatternClauseSyntax positionalPatternClause, PropertyPatternClauseSyntax propertyPatternClause, VariableDesignationSyntax designation)
{
if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation)
{
var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, GetDiagnostics(), annotations);
internal RecursivePatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var positionalPatternClause = (PositionalPatternClauseSyntax?)reader.ReadValue();
if (positionalPatternClause != null)
{
AdjustFlagsAndWidth(positionalPatternClause);
this.positionalPatternClause = positionalPatternClause;
}
var propertyPatternClause = (PropertyPatternClauseSyntax?)reader.ReadValue();
if (propertyPatternClause != null)
{
AdjustFlagsAndWidth(propertyPatternClause);
this.propertyPatternClause = propertyPatternClause;
}
var designation = (VariableDesignationSyntax?)reader.ReadValue();
if (designation != null)
{
AdjustFlagsAndWidth(designation);
this.designation = designation;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.positionalPatternClause);
writer.WriteValue(this.propertyPatternClause);
writer.WriteValue(this.designation);
}
static RecursivePatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RecursivePatternSyntax), r => new RecursivePatternSyntax(r));
}
}
internal sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? subpatterns;
internal readonly SyntaxToken closeParenToken;
internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.subpatterns));
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.subpatterns,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PositionalPatternClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPositionalPatternClause(this);
public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, GetDiagnostics(), annotations);
internal PositionalPatternClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var subpatterns = (GreenNode?)reader.ReadValue();
if (subpatterns != null)
{
AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.subpatterns);
writer.WriteValue(this.closeParenToken);
}
static PositionalPatternClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PositionalPatternClauseSyntax), r => new PositionalPatternClauseSyntax(r));
}
}
internal sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? subpatterns;
internal readonly SyntaxToken closeBraceToken;
internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (subpatterns != null)
{
this.AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.subpatterns));
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.subpatterns,
2 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyPatternClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPropertyPatternClause(this);
public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, GetDiagnostics(), annotations);
internal PropertyPatternClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var subpatterns = (GreenNode?)reader.ReadValue();
if (subpatterns != null)
{
AdjustFlagsAndWidth(subpatterns);
this.subpatterns = subpatterns;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.subpatterns);
writer.WriteValue(this.closeBraceToken);
}
static PropertyPatternClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PropertyPatternClauseSyntax), r => new PropertyPatternClauseSyntax(r));
}
}
internal sealed partial class SubpatternSyntax : CSharpSyntaxNode
{
internal readonly BaseExpressionColonSyntax? expressionColon;
internal readonly PatternSyntax pattern;
internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (expressionColon != null)
{
this.AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (expressionColon != null)
{
this.AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern)
: base(kind)
{
this.SlotCount = 2;
if (expressionColon != null)
{
this.AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
public BaseExpressionColonSyntax? ExpressionColon => this.expressionColon;
public PatternSyntax Pattern => this.pattern;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.expressionColon,
1 => this.pattern,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SubpatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSubpattern(this);
public SubpatternSyntax Update(BaseExpressionColonSyntax expressionColon, PatternSyntax pattern)
{
if (expressionColon != this.ExpressionColon || pattern != this.Pattern)
{
var newNode = SyntaxFactory.Subpattern(expressionColon, pattern);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, GetDiagnostics(), annotations);
internal SubpatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var expressionColon = (BaseExpressionColonSyntax?)reader.ReadValue();
if (expressionColon != null)
{
AdjustFlagsAndWidth(expressionColon);
this.expressionColon = expressionColon;
}
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expressionColon);
writer.WriteValue(this.pattern);
}
static SubpatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SubpatternSyntax), r => new SubpatternSyntax(r));
}
}
internal sealed partial class ConstantPatternSyntax : PatternSyntax
{
internal readonly ExpressionSyntax expression;
internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>ExpressionSyntax node representing the constant expression.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.expression : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstantPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstantPattern(this);
public ConstantPatternSyntax Update(ExpressionSyntax expression)
{
if (expression != this.Expression)
{
var newNode = SyntaxFactory.ConstantPattern(expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstantPatternSyntax(this.Kind, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstantPatternSyntax(this.Kind, this.expression, GetDiagnostics(), annotations);
internal ConstantPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.expression);
}
static ConstantPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstantPatternSyntax), r => new ConstantPatternSyntax(r));
}
}
internal sealed partial class ParenthesizedPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly PatternSyntax pattern;
internal readonly SyntaxToken closeParenToken;
internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public PatternSyntax Pattern => this.pattern;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.pattern,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedPattern(this);
public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, GetDiagnostics(), annotations);
internal ParenthesizedPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.pattern);
writer.WriteValue(this.closeParenToken);
}
static ParenthesizedPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedPatternSyntax), r => new ParenthesizedPatternSyntax(r));
}
}
internal sealed partial class RelationalPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly ExpressionSyntax expression;
internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
/// <summary>SyntaxToken representing the operator of the relational pattern.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RelationalPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRelationalPattern(this);
public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression)
{
if (operatorToken != this.OperatorToken || expression != this.Expression)
{
var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations);
internal RelationalPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.expression);
}
static RelationalPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RelationalPatternSyntax), r => new RelationalPatternSyntax(r));
}
}
internal sealed partial class TypePatternSyntax : PatternSyntax
{
internal readonly TypeSyntax type;
internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
/// <summary>The type for the type pattern.</summary>
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypePatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypePattern(this);
public TypePatternSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.TypePattern(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypePatternSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypePatternSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal TypePatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static TypePatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypePatternSyntax), r => new TypePatternSyntax(r));
}
}
internal sealed partial class BinaryPatternSyntax : PatternSyntax
{
internal readonly PatternSyntax left;
internal readonly SyntaxToken operatorToken;
internal readonly PatternSyntax right;
internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(left);
this.left = left;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(right);
this.right = right;
}
public PatternSyntax Left => this.left;
public SyntaxToken OperatorToken => this.operatorToken;
public PatternSyntax Right => this.right;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.left,
1 => this.operatorToken,
2 => this.right,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBinaryPattern(this);
public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
{
if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right)
{
var newNode = SyntaxFactory.BinaryPattern(this.Kind, left, operatorToken, right);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations);
internal BinaryPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var left = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(left);
this.left = left;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var right = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(right);
this.right = right;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.left);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.right);
}
static BinaryPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BinaryPatternSyntax), r => new BinaryPatternSyntax(r));
}
}
internal sealed partial class UnaryPatternSyntax : PatternSyntax
{
internal readonly SyntaxToken operatorToken;
internal readonly PatternSyntax pattern;
internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
public SyntaxToken OperatorToken => this.operatorToken;
public PatternSyntax Pattern => this.pattern;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorToken,
1 => this.pattern,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnaryPatternSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUnaryPattern(this);
public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern)
{
if (operatorToken != this.OperatorToken || pattern != this.Pattern)
{
var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, GetDiagnostics(), annotations);
internal UnaryPatternSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.pattern);
}
static UnaryPatternSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UnaryPatternSyntax), r => new UnaryPatternSyntax(r));
}
}
internal abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode
{
internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal InterpolatedStringContentSyntax(SyntaxKind kind)
: base(kind)
{
}
protected InterpolatedStringContentSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax
{
internal readonly SyntaxToken textToken;
internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
/// <summary>The text contents of a part of the interpolated string.</summary>
public SyntaxToken TextToken => this.textToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.textToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringTextSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolatedStringText(this);
public InterpolatedStringTextSyntax Update(SyntaxToken textToken)
{
if (textToken != this.TextToken)
{
var newNode = SyntaxFactory.InterpolatedStringText(textToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolatedStringTextSyntax(this.Kind, this.textToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolatedStringTextSyntax(this.Kind, this.textToken, GetDiagnostics(), annotations);
internal InterpolatedStringTextSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var textToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(textToken);
this.textToken = textToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.textToken);
}
static InterpolatedStringTextSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringTextSyntax), r => new InterpolatedStringTextSyntax(r));
}
}
internal sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax
{
internal readonly SyntaxToken openBraceToken;
internal readonly ExpressionSyntax expression;
internal readonly InterpolationAlignmentClauseSyntax? alignmentClause;
internal readonly InterpolationFormatClauseSyntax? formatClause;
internal readonly SyntaxToken closeBraceToken;
internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (alignmentClause != null)
{
this.AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
if (formatClause != null)
{
this.AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (alignmentClause != null)
{
this.AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
if (formatClause != null)
{
this.AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (alignmentClause != null)
{
this.AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
if (formatClause != null)
{
this.AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public SyntaxToken OpenBraceToken => this.openBraceToken;
public ExpressionSyntax Expression => this.expression;
public InterpolationAlignmentClauseSyntax? AlignmentClause => this.alignmentClause;
public InterpolationFormatClauseSyntax? FormatClause => this.formatClause;
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.expression,
2 => this.alignmentClause,
3 => this.formatClause,
4 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolation(this);
public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, GetDiagnostics(), annotations);
internal InterpolationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var alignmentClause = (InterpolationAlignmentClauseSyntax?)reader.ReadValue();
if (alignmentClause != null)
{
AdjustFlagsAndWidth(alignmentClause);
this.alignmentClause = alignmentClause;
}
var formatClause = (InterpolationFormatClauseSyntax?)reader.ReadValue();
if (formatClause != null)
{
AdjustFlagsAndWidth(formatClause);
this.formatClause = formatClause;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.alignmentClause);
writer.WriteValue(this.formatClause);
writer.WriteValue(this.closeBraceToken);
}
static InterpolationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolationSyntax), r => new InterpolationSyntax(r));
}
}
internal sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken commaToken;
internal readonly ExpressionSyntax value;
internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
public SyntaxToken CommaToken => this.commaToken;
public ExpressionSyntax Value => this.value;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.commaToken,
1 => this.value,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationAlignmentClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolationAlignmentClause(this);
public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value)
{
if (commaToken != this.CommaToken || value != this.Value)
{
var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, GetDiagnostics(), annotations);
internal InterpolationAlignmentClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var commaToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
var value = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(value);
this.value = value;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.commaToken);
writer.WriteValue(this.value);
}
static InterpolationAlignmentClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolationAlignmentClauseSyntax), r => new InterpolationAlignmentClauseSyntax(r));
}
}
internal sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken colonToken;
internal readonly SyntaxToken formatStringToken;
internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
public SyntaxToken ColonToken => this.colonToken;
/// <summary>The text contents of the format specifier for an interpolation.</summary>
public SyntaxToken FormatStringToken => this.formatStringToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.colonToken,
1 => this.formatStringToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationFormatClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterpolationFormatClause(this);
public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken)
{
if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken)
{
var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations);
internal InterpolationFormatClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var formatStringToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(formatStringToken);
this.formatStringToken = formatStringToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.formatStringToken);
}
static InterpolationFormatClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterpolationFormatClauseSyntax), r => new InterpolationFormatClauseSyntax(r));
}
}
internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly StatementSyntax statement;
internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GlobalStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGlobalStatement(this);
public GlobalStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement)
{
var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, GetDiagnostics(), annotations);
internal GlobalStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.statement);
}
static GlobalStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GlobalStatementSyntax), r => new GlobalStatementSyntax(r));
}
}
/// <summary>Represents the base class for all statements syntax classes.</summary>
internal abstract partial class StatementSyntax : CSharpSyntaxNode
{
internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal StatementSyntax(SyntaxKind kind)
: base(kind)
{
}
protected StatementSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
}
internal sealed partial class BlockSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? statements;
internal readonly SyntaxToken closeBraceToken;
internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax>(this.statements);
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.openBraceToken,
2 => this.statements,
3 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BlockSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBlock(this);
public BlockSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
{
if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, GetDiagnostics(), annotations);
internal BlockSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var statements = (GreenNode?)reader.ReadValue();
if (statements != null)
{
AdjustFlagsAndWidth(statements);
this.statements = statements;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.statements);
writer.WriteValue(this.closeBraceToken);
}
static BlockSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BlockSyntax), r => new BlockSyntax(r));
}
}
internal sealed partial class LocalFunctionStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax returnType;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax parameterList;
internal readonly GreenNode? constraintClauses;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public TypeSyntax ReturnType => this.returnType;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public ParameterListSyntax ParameterList => this.parameterList;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public BlockSyntax? Body => this.body;
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.parameterList,
6 => this.constraintClauses,
7 => this.body,
8 => this.expressionBody,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalFunctionStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLocalFunctionStatement(this);
public LocalFunctionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal LocalFunctionStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static LocalFunctionStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LocalFunctionStatementSyntax), r => new LocalFunctionStatementSyntax(r));
}
}
internal sealed partial class LocalDeclarationStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken? usingKeyword;
internal readonly GreenNode? modifiers;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken semicolonToken;
internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
if (usingKeyword != null)
{
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
if (usingKeyword != null)
{
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
if (usingKeyword != null)
{
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken? AwaitKeyword => this.awaitKeyword;
public SyntaxToken? UsingKeyword => this.usingKeyword;
/// <summary>Gets the modifier list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public VariableDeclarationSyntax Declaration => this.declaration;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.usingKeyword,
3 => this.modifiers,
4 => this.declaration,
5 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalDeclarationStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLocalDeclarationStatement(this);
public LocalDeclarationStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations);
internal LocalDeclarationStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var usingKeyword = (SyntaxToken?)reader.ReadValue();
if (usingKeyword != null)
{
AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.usingKeyword);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.declaration);
writer.WriteValue(this.semicolonToken);
}
static LocalDeclarationStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LocalDeclarationStatementSyntax), r => new LocalDeclarationStatementSyntax(r));
}
}
internal sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode
{
internal readonly TypeSyntax type;
internal readonly GreenNode? variables;
internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
public TypeSyntax Type => this.type;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.variables));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.variables,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitVariableDeclaration(this);
public VariableDeclarationSyntax Update(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> variables)
{
if (type != this.Type || variables != this.Variables)
{
var newNode = SyntaxFactory.VariableDeclaration(type, variables);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new VariableDeclarationSyntax(this.Kind, this.type, this.variables, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new VariableDeclarationSyntax(this.Kind, this.type, this.variables, GetDiagnostics(), annotations);
internal VariableDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var variables = (GreenNode?)reader.ReadValue();
if (variables != null)
{
AdjustFlagsAndWidth(variables);
this.variables = variables;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.variables);
}
static VariableDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(VariableDeclarationSyntax), r => new VariableDeclarationSyntax(r));
}
}
internal sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken identifier;
internal readonly BracketedArgumentListSyntax? argumentList;
internal readonly EqualsValueClauseSyntax? initializer;
internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public BracketedArgumentListSyntax? ArgumentList => this.argumentList;
public EqualsValueClauseSyntax? Initializer => this.initializer;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.identifier,
1 => this.argumentList,
2 => this.initializer,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclaratorSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitVariableDeclarator(this);
public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax argumentList, EqualsValueClauseSyntax initializer)
{
if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer)
{
var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, GetDiagnostics(), annotations);
internal VariableDeclaratorSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var argumentList = (BracketedArgumentListSyntax?)reader.ReadValue();
if (argumentList != null)
{
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
var initializer = (EqualsValueClauseSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
writer.WriteValue(this.argumentList);
writer.WriteValue(this.initializer);
}
static VariableDeclaratorSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(VariableDeclaratorSyntax), r => new VariableDeclaratorSyntax(r));
}
}
internal sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken equalsToken;
internal readonly ExpressionSyntax value;
internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(value);
this.value = value;
}
public SyntaxToken EqualsToken => this.equalsToken;
public ExpressionSyntax Value => this.value;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.equalsToken,
1 => this.value,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EqualsValueClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEqualsValueClause(this);
public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value)
{
if (equalsToken != this.EqualsToken || value != this.Value)
{
var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, GetDiagnostics(), annotations);
internal EqualsValueClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var value = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(value);
this.value = value;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.value);
}
static EqualsValueClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EqualsValueClauseSyntax), r => new EqualsValueClauseSyntax(r));
}
}
internal abstract partial class VariableDesignationSyntax : CSharpSyntaxNode
{
internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal VariableDesignationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected VariableDesignationSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax
{
internal readonly SyntaxToken identifier;
internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
public SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.identifier : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SingleVariableDesignationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSingleVariableDesignation(this);
public SingleVariableDesignationSyntax Update(SyntaxToken identifier)
{
if (identifier != this.Identifier)
{
var newNode = SyntaxFactory.SingleVariableDesignation(identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SingleVariableDesignationSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SingleVariableDesignationSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations);
internal SingleVariableDesignationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
}
static SingleVariableDesignationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SingleVariableDesignationSyntax), r => new SingleVariableDesignationSyntax(r));
}
}
internal sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax
{
internal readonly SyntaxToken underscoreToken;
internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
public SyntaxToken UnderscoreToken => this.underscoreToken;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.underscoreToken : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardDesignationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDiscardDesignation(this);
public DiscardDesignationSyntax Update(SyntaxToken underscoreToken)
{
if (underscoreToken != this.UnderscoreToken)
{
var newNode = SyntaxFactory.DiscardDesignation(underscoreToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DiscardDesignationSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DiscardDesignationSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations);
internal DiscardDesignationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var underscoreToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(underscoreToken);
this.underscoreToken = underscoreToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.underscoreToken);
}
static DiscardDesignationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DiscardDesignationSyntax), r => new DiscardDesignationSyntax(r));
}
}
internal sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? variables;
internal readonly SyntaxToken closeParenToken;
internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (variables != null)
{
this.AdjustFlagsAndWidth(variables);
this.variables = variables;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.variables));
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.variables,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedVariableDesignationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParenthesizedVariableDesignation(this);
public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> variables, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, GetDiagnostics(), annotations);
internal ParenthesizedVariableDesignationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var variables = (GreenNode?)reader.ReadValue();
if (variables != null)
{
AdjustFlagsAndWidth(variables);
this.variables = variables;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.variables);
writer.WriteValue(this.closeParenToken);
}
static ParenthesizedVariableDesignationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParenthesizedVariableDesignationSyntax), r => new ParenthesizedVariableDesignationSyntax(r));
}
}
internal sealed partial class ExpressionStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken semicolonToken;
internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public ExpressionSyntax Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.expression,
2 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExpressionStatement(this);
public ExpressionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal ExpressionStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static ExpressionStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExpressionStatementSyntax), r => new ExpressionStatementSyntax(r));
}
}
internal sealed partial class EmptyStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken semicolonToken;
internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 2;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EmptyStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEmptyStatement(this);
public EmptyStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, GetDiagnostics(), annotations);
internal EmptyStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.semicolonToken);
}
static EmptyStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EmptyStatementSyntax), r => new EmptyStatementSyntax(r));
}
}
/// <summary>Represents a labeled statement syntax.</summary>
internal sealed partial class LabeledStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken colonToken;
internal readonly StatementSyntax statement;
internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
/// <summary>Gets a SyntaxToken that represents the colon following the statement's label.</summary>
public SyntaxToken ColonToken => this.colonToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.identifier,
2 => this.colonToken,
3 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LabeledStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLabeledStatement(this);
public LabeledStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement)
{
var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, GetDiagnostics(), annotations);
internal LabeledStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.identifier);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.statement);
}
static LabeledStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LabeledStatementSyntax), r => new LabeledStatementSyntax(r));
}
}
/// <summary>
/// Represents a goto statement syntax
/// </summary>
internal sealed partial class GotoStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken gotoKeyword;
internal readonly SyntaxToken? caseOrDefaultKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
if (caseOrDefaultKeyword != null)
{
this.AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
if (caseOrDefaultKeyword != null)
{
this.AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
if (caseOrDefaultKeyword != null)
{
this.AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>
/// Gets a SyntaxToken that represents the goto keyword.
/// </summary>
public SyntaxToken GotoKeyword => this.gotoKeyword;
/// <summary>
/// Gets a SyntaxToken that represents the case or default keywords if any exists.
/// </summary>
public SyntaxToken? CaseOrDefaultKeyword => this.caseOrDefaultKeyword;
/// <summary>
/// Gets a constant expression for a goto case statement.
/// </summary>
public ExpressionSyntax? Expression => this.expression;
/// <summary>
/// Gets a SyntaxToken that represents the semi-colon at the end of the statement.
/// </summary>
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.gotoKeyword,
2 => this.caseOrDefaultKeyword,
3 => this.expression,
4 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GotoStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitGotoStatement(this);
public GotoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.GotoStatement(this.Kind, attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal GotoStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var gotoKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(gotoKeyword);
this.gotoKeyword = gotoKeyword;
var caseOrDefaultKeyword = (SyntaxToken?)reader.ReadValue();
if (caseOrDefaultKeyword != null)
{
AdjustFlagsAndWidth(caseOrDefaultKeyword);
this.caseOrDefaultKeyword = caseOrDefaultKeyword;
}
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.gotoKeyword);
writer.WriteValue(this.caseOrDefaultKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static GotoStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(GotoStatementSyntax), r => new GotoStatementSyntax(r));
}
}
internal sealed partial class BreakStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken breakKeyword;
internal readonly SyntaxToken semicolonToken;
internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken BreakKeyword => this.breakKeyword;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.breakKeyword,
2 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BreakStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBreakStatement(this);
public BreakStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, GetDiagnostics(), annotations);
internal BreakStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var breakKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(breakKeyword);
this.breakKeyword = breakKeyword;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.breakKeyword);
writer.WriteValue(this.semicolonToken);
}
static BreakStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BreakStatementSyntax), r => new BreakStatementSyntax(r));
}
}
internal sealed partial class ContinueStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken continueKeyword;
internal readonly SyntaxToken semicolonToken;
internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ContinueKeyword => this.continueKeyword;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.continueKeyword,
2 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ContinueStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitContinueStatement(this);
public ContinueStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, GetDiagnostics(), annotations);
internal ContinueStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var continueKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(continueKeyword);
this.continueKeyword = continueKeyword;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.continueKeyword);
writer.WriteValue(this.semicolonToken);
}
static ContinueStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ContinueStatementSyntax), r => new ContinueStatementSyntax(r));
}
}
internal sealed partial class ReturnStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken returnKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ReturnKeyword => this.returnKeyword;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.returnKeyword,
2 => this.expression,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReturnStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitReturnStatement(this);
public ReturnStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal ReturnStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var returnKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(returnKeyword);
this.returnKeyword = returnKeyword;
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.returnKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static ReturnStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ReturnStatementSyntax), r => new ReturnStatementSyntax(r));
}
}
internal sealed partial class ThrowStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken throwKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ThrowKeyword => this.throwKeyword;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.throwKeyword,
2 => this.expression,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitThrowStatement(this);
public ThrowStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal ThrowStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var throwKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(throwKeyword);
this.throwKeyword = throwKeyword;
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.throwKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static ThrowStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ThrowStatementSyntax), r => new ThrowStatementSyntax(r));
}
}
internal sealed partial class YieldStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken yieldKeyword;
internal readonly SyntaxToken returnOrBreakKeyword;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken semicolonToken;
internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
this.AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
this.AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
this.AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken YieldKeyword => this.yieldKeyword;
public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.yieldKeyword,
2 => this.returnOrBreakKeyword,
3 => this.expression,
4 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.YieldStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitYieldStatement(this);
public YieldStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.YieldStatement(this.Kind, attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations);
internal YieldStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var yieldKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(yieldKeyword);
this.yieldKeyword = yieldKeyword;
var returnOrBreakKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(returnOrBreakKeyword);
this.returnOrBreakKeyword = returnOrBreakKeyword;
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.yieldKeyword);
writer.WriteValue(this.returnOrBreakKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.semicolonToken);
}
static YieldStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(YieldStatementSyntax), r => new YieldStatementSyntax(r));
}
}
internal sealed partial class WhileStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken whileKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken WhileKeyword => this.whileKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax Condition => this.condition;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.whileKeyword,
2 => this.openParenToken,
3 => this.condition,
4 => this.closeParenToken,
5 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhileStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWhileStatement(this);
public WhileStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal WhileStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var whileKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.whileKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static WhileStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WhileStatementSyntax), r => new WhileStatementSyntax(r));
}
}
internal sealed partial class DoStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken doKeyword;
internal readonly StatementSyntax statement;
internal readonly SyntaxToken whileKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken closeParenToken;
internal readonly SyntaxToken semicolonToken;
internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
this.AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken DoKeyword => this.doKeyword;
public StatementSyntax Statement => this.statement;
public SyntaxToken WhileKeyword => this.whileKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax Condition => this.condition;
public SyntaxToken CloseParenToken => this.closeParenToken;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.doKeyword,
2 => this.statement,
3 => this.whileKeyword,
4 => this.openParenToken,
5 => this.condition,
6 => this.closeParenToken,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DoStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDoStatement(this);
public DoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, GetDiagnostics(), annotations);
internal DoStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var doKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(doKeyword);
this.doKeyword = doKeyword;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
var whileKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whileKeyword);
this.whileKeyword = whileKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.doKeyword);
writer.WriteValue(this.statement);
writer.WriteValue(this.whileKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.semicolonToken);
}
static DoStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DoStatementSyntax), r => new DoStatementSyntax(r));
}
}
internal sealed partial class ForStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken forKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly VariableDeclarationSyntax? declaration;
internal readonly GreenNode? initializers;
internal readonly SyntaxToken firstSemicolonToken;
internal readonly ExpressionSyntax? condition;
internal readonly SyntaxToken secondSemicolonToken;
internal readonly GreenNode? incrementors;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
if (condition != null)
{
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
this.AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
if (incrementors != null)
{
this.AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
if (condition != null)
{
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
this.AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
if (incrementors != null)
{
this.AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (initializers != null)
{
this.AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
this.AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
if (condition != null)
{
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
}
this.AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
if (incrementors != null)
{
this.AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken ForKeyword => this.forKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public VariableDeclarationSyntax? Declaration => this.declaration;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.initializers));
public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken;
public ExpressionSyntax? Condition => this.condition;
public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> Incrementors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.incrementors));
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.forKeyword,
2 => this.openParenToken,
3 => this.declaration,
4 => this.initializers,
5 => this.firstSemicolonToken,
6 => this.condition,
7 => this.secondSemicolonToken,
8 => this.incrementors,
9 => this.closeParenToken,
10 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitForStatement(this);
public ForStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal ForStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var forKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(forKeyword);
this.forKeyword = forKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var declaration = (VariableDeclarationSyntax?)reader.ReadValue();
if (declaration != null)
{
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
var initializers = (GreenNode?)reader.ReadValue();
if (initializers != null)
{
AdjustFlagsAndWidth(initializers);
this.initializers = initializers;
}
var firstSemicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(firstSemicolonToken);
this.firstSemicolonToken = firstSemicolonToken;
var condition = (ExpressionSyntax?)reader.ReadValue();
if (condition != null)
{
AdjustFlagsAndWidth(condition);
this.condition = condition;
}
var secondSemicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(secondSemicolonToken);
this.secondSemicolonToken = secondSemicolonToken;
var incrementors = (GreenNode?)reader.ReadValue();
if (incrementors != null)
{
AdjustFlagsAndWidth(incrementors);
this.incrementors = incrementors;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.forKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.declaration);
writer.WriteValue(this.initializers);
writer.WriteValue(this.firstSemicolonToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.secondSemicolonToken);
writer.WriteValue(this.incrementors);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static ForStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ForStatementSyntax), r => new ForStatementSyntax(r));
}
}
internal abstract partial class CommonForEachStatementSyntax : StatementSyntax
{
internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal CommonForEachStatementSyntax(SyntaxKind kind)
: base(kind)
{
}
protected CommonForEachStatementSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract SyntaxToken? AwaitKeyword { get; }
public abstract SyntaxToken ForEachKeyword { get; }
public abstract SyntaxToken OpenParenToken { get; }
public abstract SyntaxToken InKeyword { get; }
public abstract ExpressionSyntax Expression { get; }
public abstract SyntaxToken CloseParenToken { get; }
public abstract StatementSyntax Statement { get; }
}
internal sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken forEachKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override SyntaxToken? AwaitKeyword => this.awaitKeyword;
public override SyntaxToken ForEachKeyword => this.forEachKeyword;
public override SyntaxToken OpenParenToken => this.openParenToken;
public TypeSyntax Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override SyntaxToken InKeyword => this.inKeyword;
public override ExpressionSyntax Expression => this.expression;
public override SyntaxToken CloseParenToken => this.closeParenToken;
public override StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.forEachKeyword,
3 => this.openParenToken,
4 => this.type,
5 => this.identifier,
6 => this.inKeyword,
7 => this.expression,
8 => this.closeParenToken,
9 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitForEachStatement(this);
public ForEachStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal ForEachStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var forEachKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.forEachKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static ForEachStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ForEachStatementSyntax), r => new ForEachStatementSyntax(r));
}
}
internal sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken forEachKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax variable;
internal readonly SyntaxToken inKeyword;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(variable);
this.variable = variable;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(variable);
this.variable = variable;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(variable);
this.variable = variable;
this.AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override SyntaxToken? AwaitKeyword => this.awaitKeyword;
public override SyntaxToken ForEachKeyword => this.forEachKeyword;
public override SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>
/// The variable(s) of the loop. In correct code this is a tuple
/// literal, declaration expression with a tuple designator, or
/// a discard syntax in the form of a simple identifier. In broken
/// code it could be something else.
/// </summary>
public ExpressionSyntax Variable => this.variable;
public override SyntaxToken InKeyword => this.inKeyword;
public override ExpressionSyntax Expression => this.expression;
public override SyntaxToken CloseParenToken => this.closeParenToken;
public override StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.forEachKeyword,
3 => this.openParenToken,
4 => this.variable,
5 => this.inKeyword,
6 => this.expression,
7 => this.closeParenToken,
8 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachVariableStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitForEachVariableStatement(this);
public ForEachVariableStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal ForEachVariableStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var forEachKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(forEachKeyword);
this.forEachKeyword = forEachKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var variable = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(variable);
this.variable = variable;
var inKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(inKeyword);
this.inKeyword = inKeyword;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.forEachKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.variable);
writer.WriteValue(this.inKeyword);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static ForEachVariableStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ForEachVariableStatementSyntax), r => new ForEachVariableStatementSyntax(r));
}
}
internal sealed partial class UsingStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? awaitKeyword;
internal readonly SyntaxToken usingKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly VariableDeclarationSyntax? declaration;
internal readonly ExpressionSyntax? expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (awaitKeyword != null)
{
this.AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (expression != null)
{
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken? AwaitKeyword => this.awaitKeyword;
public SyntaxToken UsingKeyword => this.usingKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public VariableDeclarationSyntax? Declaration => this.declaration;
public ExpressionSyntax? Expression => this.expression;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.awaitKeyword,
2 => this.usingKeyword,
3 => this.openParenToken,
4 => this.declaration,
5 => this.expression,
6 => this.closeParenToken,
7 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUsingStatement(this);
public UsingStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal UsingStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var awaitKeyword = (SyntaxToken?)reader.ReadValue();
if (awaitKeyword != null)
{
AdjustFlagsAndWidth(awaitKeyword);
this.awaitKeyword = awaitKeyword;
}
var usingKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var declaration = (VariableDeclarationSyntax?)reader.ReadValue();
if (declaration != null)
{
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
var expression = (ExpressionSyntax?)reader.ReadValue();
if (expression != null)
{
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.awaitKeyword);
writer.WriteValue(this.usingKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.declaration);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static UsingStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UsingStatementSyntax), r => new UsingStatementSyntax(r));
}
}
internal sealed partial class FixedStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken fixedKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken FixedKeyword => this.fixedKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public VariableDeclarationSyntax Declaration => this.declaration;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.fixedKeyword,
2 => this.openParenToken,
3 => this.declaration,
4 => this.closeParenToken,
5 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FixedStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFixedStatement(this);
public FixedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal FixedStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var fixedKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(fixedKeyword);
this.fixedKeyword = fixedKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.fixedKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.declaration);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static FixedStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FixedStatementSyntax), r => new FixedStatementSyntax(r));
}
}
internal sealed partial class CheckedStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken keyword;
internal readonly BlockSyntax block;
internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken Keyword => this.keyword;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.keyword,
2 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCheckedStatement(this);
public CheckedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block)
{
if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block)
{
var newNode = SyntaxFactory.CheckedStatement(this.Kind, attributeLists, keyword, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, GetDiagnostics(), annotations);
internal CheckedStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.keyword);
writer.WriteValue(this.block);
}
static CheckedStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CheckedStatementSyntax), r => new CheckedStatementSyntax(r));
}
}
internal sealed partial class UnsafeStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken unsafeKeyword;
internal readonly BlockSyntax block;
internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken UnsafeKeyword => this.unsafeKeyword;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.unsafeKeyword,
2 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnsafeStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUnsafeStatement(this);
public UnsafeStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
{
if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block)
{
var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, GetDiagnostics(), annotations);
internal UnsafeStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var unsafeKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(unsafeKeyword);
this.unsafeKeyword = unsafeKeyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.unsafeKeyword);
writer.WriteValue(this.block);
}
static UnsafeStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UnsafeStatementSyntax), r => new UnsafeStatementSyntax(r));
}
}
internal sealed partial class LockStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken lockKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken LockKeyword => this.lockKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax Expression => this.expression;
public SyntaxToken CloseParenToken => this.closeParenToken;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.lockKeyword,
2 => this.openParenToken,
3 => this.expression,
4 => this.closeParenToken,
5 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LockStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLockStatement(this);
public LockStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement)
{
var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations);
internal LockStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var lockKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lockKeyword);
this.lockKeyword = lockKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.lockKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
}
static LockStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LockStatementSyntax), r => new LockStatementSyntax(r));
}
}
/// <summary>
/// Represents an if statement syntax.
/// </summary>
internal sealed partial class IfStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken ifKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken closeParenToken;
internal readonly StatementSyntax statement;
internal readonly ElseClauseSyntax? @else;
internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
if (@else != null)
{
this.AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
if (@else != null)
{
this.AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else)
: base(kind)
{
this.SlotCount = 7;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
if (@else != null)
{
this.AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>
/// Gets a SyntaxToken that represents the if keyword.
/// </summary>
public SyntaxToken IfKeyword => this.ifKeyword;
/// <summary>
/// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression.
/// </summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>
/// Gets an ExpressionSyntax that represents the condition of the if statement.
/// </summary>
public ExpressionSyntax Condition => this.condition;
/// <summary>
/// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression.
/// </summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
/// <summary>
/// Gets a StatementSyntax the represents the statement to be executed when the condition is true.
/// </summary>
public StatementSyntax Statement => this.statement;
/// <summary>
/// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists.
/// </summary>
public ElseClauseSyntax? Else => this.@else;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.ifKeyword,
2 => this.openParenToken,
3 => this.condition,
4 => this.closeParenToken,
5 => this.statement,
6 => this.@else,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIfStatement(this);
public IfStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else)
{
if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else)
{
var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, GetDiagnostics(), annotations);
internal IfStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 7;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var ifKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
var @else = (ElseClauseSyntax?)reader.ReadValue();
if (@else != null)
{
AdjustFlagsAndWidth(@else);
this.@else = @else;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.ifKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.condition);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.statement);
writer.WriteValue(this.@else);
}
static IfStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IfStatementSyntax), r => new IfStatementSyntax(r));
}
}
/// <summary>Represents an else statement syntax.</summary>
internal sealed partial class ElseClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken elseKeyword;
internal readonly StatementSyntax statement;
internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(statement);
this.statement = statement;
}
/// <summary>
/// Gets a syntax token
/// </summary>
public SyntaxToken ElseKeyword => this.elseKeyword;
public StatementSyntax Statement => this.statement;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.elseKeyword,
1 => this.statement,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElseClause(this);
public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement)
{
if (elseKeyword != this.ElseKeyword || statement != this.Statement)
{
var newNode = SyntaxFactory.ElseClause(elseKeyword, statement);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, GetDiagnostics(), annotations);
internal ElseClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var elseKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
var statement = (StatementSyntax)reader.ReadValue();
AdjustFlagsAndWidth(statement);
this.statement = statement;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.elseKeyword);
writer.WriteValue(this.statement);
}
static ElseClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElseClauseSyntax), r => new ElseClauseSyntax(r));
}
}
/// <summary>Represents a switch statement syntax.</summary>
internal sealed partial class SwitchStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken switchKeyword;
internal readonly SyntaxToken? openParenToken;
internal readonly ExpressionSyntax expression;
internal readonly SyntaxToken? closeParenToken;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? sections;
internal readonly SyntaxToken closeBraceToken;
internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
if (openParenToken != null)
{
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (closeParenToken != null)
{
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (sections != null)
{
this.AdjustFlagsAndWidth(sections);
this.sections = sections;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
if (openParenToken != null)
{
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (closeParenToken != null)
{
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (sections != null)
{
this.AdjustFlagsAndWidth(sections);
this.sections = sections;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
if (openParenToken != null)
{
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
if (closeParenToken != null)
{
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (sections != null)
{
this.AdjustFlagsAndWidth(sections);
this.sections = sections;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>
/// Gets a SyntaxToken that represents the switch keyword.
/// </summary>
public SyntaxToken SwitchKeyword => this.switchKeyword;
/// <summary>
/// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression.
/// </summary>
public SyntaxToken? OpenParenToken => this.openParenToken;
/// <summary>
/// Gets an ExpressionSyntax representing the expression of the switch statement.
/// </summary>
public ExpressionSyntax Expression => this.expression;
/// <summary>
/// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression.
/// </summary>
public SyntaxToken? CloseParenToken => this.closeParenToken;
/// <summary>
/// Gets a SyntaxToken that represents the open braces preceding the switch sections.
/// </summary>
public SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>
/// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement.
/// </summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> Sections => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax>(this.sections);
/// <summary>
/// Gets a SyntaxToken that represents the open braces following the switch sections.
/// </summary>
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.switchKeyword,
2 => this.openParenToken,
3 => this.expression,
4 => this.closeParenToken,
5 => this.openBraceToken,
6 => this.sections,
7 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchStatement(this);
public SwitchStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> sections, SyntaxToken closeBraceToken)
{
if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, GetDiagnostics(), annotations);
internal SwitchStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var switchKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
var openParenToken = (SyntaxToken?)reader.ReadValue();
if (openParenToken != null)
{
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
var closeParenToken = (SyntaxToken?)reader.ReadValue();
if (closeParenToken != null)
{
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var sections = (GreenNode?)reader.ReadValue();
if (sections != null)
{
AdjustFlagsAndWidth(sections);
this.sections = sections;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.switchKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.expression);
writer.WriteValue(this.closeParenToken);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.sections);
writer.WriteValue(this.closeBraceToken);
}
static SwitchStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchStatementSyntax), r => new SwitchStatementSyntax(r));
}
}
/// <summary>Represents a switch section syntax of a switch statement.</summary>
internal sealed partial class SwitchSectionSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? labels;
internal readonly GreenNode? statements;
internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (labels != null)
{
this.AdjustFlagsAndWidth(labels);
this.labels = labels;
}
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (labels != null)
{
this.AdjustFlagsAndWidth(labels);
this.labels = labels;
}
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements)
: base(kind)
{
this.SlotCount = 2;
if (labels != null)
{
this.AdjustFlagsAndWidth(labels);
this.labels = labels;
}
if (statements != null)
{
this.AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
/// <summary>
/// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section.
/// </summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> Labels => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax>(this.labels);
/// <summary>
/// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section.
/// </summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax>(this.statements);
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.labels,
1 => this.statements,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchSectionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchSection(this);
public SwitchSectionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements)
{
if (labels != this.Labels || statements != this.Statements)
{
var newNode = SyntaxFactory.SwitchSection(labels, statements);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchSectionSyntax(this.Kind, this.labels, this.statements, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchSectionSyntax(this.Kind, this.labels, this.statements, GetDiagnostics(), annotations);
internal SwitchSectionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var labels = (GreenNode?)reader.ReadValue();
if (labels != null)
{
AdjustFlagsAndWidth(labels);
this.labels = labels;
}
var statements = (GreenNode?)reader.ReadValue();
if (statements != null)
{
AdjustFlagsAndWidth(statements);
this.statements = statements;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.labels);
writer.WriteValue(this.statements);
}
static SwitchSectionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchSectionSyntax), r => new SwitchSectionSyntax(r));
}
}
/// <summary>Represents a switch label within a switch statement.</summary>
internal abstract partial class SwitchLabelSyntax : CSharpSyntaxNode
{
internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal SwitchLabelSyntax(SyntaxKind kind)
: base(kind)
{
}
protected SwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>
/// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label.
/// </summary>
public abstract SyntaxToken Keyword { get; }
/// <summary>
/// Gets a SyntaxToken that represents the colon that terminates the switch label.
/// </summary>
public abstract SyntaxToken ColonToken { get; }
}
/// <summary>Represents a case label within a switch statement.</summary>
internal sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax
{
internal readonly SyntaxToken keyword;
internal readonly PatternSyntax pattern;
internal readonly WhenClauseSyntax? whenClause;
internal readonly SyntaxToken colonToken;
internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the case keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
/// <summary>
/// Gets a PatternSyntax that represents the pattern that gets matched for the case label.
/// </summary>
public PatternSyntax Pattern => this.pattern;
public WhenClauseSyntax? WhenClause => this.whenClause;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.pattern,
2 => this.whenClause,
3 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CasePatternSwitchLabelSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCasePatternSwitchLabel(this);
public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken colonToken)
{
if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, GetDiagnostics(), annotations);
internal CasePatternSwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
var whenClause = (WhenClauseSyntax?)reader.ReadValue();
if (whenClause != null)
{
AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.pattern);
writer.WriteValue(this.whenClause);
writer.WriteValue(this.colonToken);
}
static CasePatternSwitchLabelSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CasePatternSwitchLabelSyntax), r => new CasePatternSwitchLabelSyntax(r));
}
}
/// <summary>Represents a case label within a switch statement.</summary>
internal sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax
{
internal readonly SyntaxToken keyword;
internal readonly ExpressionSyntax value;
internal readonly SyntaxToken colonToken;
internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(value);
this.value = value;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(value);
this.value = value;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(value);
this.value = value;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the case keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
/// <summary>
/// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label.
/// </summary>
public ExpressionSyntax Value => this.value;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.value,
2 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CaseSwitchLabelSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCaseSwitchLabel(this);
public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
{
if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, GetDiagnostics(), annotations);
internal CaseSwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var value = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(value);
this.value = value;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.value);
writer.WriteValue(this.colonToken);
}
static CaseSwitchLabelSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CaseSwitchLabelSyntax), r => new CaseSwitchLabelSyntax(r));
}
}
/// <summary>Represents a default label within a switch statement.</summary>
internal sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax
{
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken colonToken;
internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the default keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.keyword,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultSwitchLabelSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefaultSwitchLabel(this);
public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken)
{
if (keyword != this.Keyword || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, GetDiagnostics(), annotations);
internal DefaultSwitchLabelSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.keyword);
writer.WriteValue(this.colonToken);
}
static DefaultSwitchLabelSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefaultSwitchLabelSyntax), r => new DefaultSwitchLabelSyntax(r));
}
}
internal sealed partial class SwitchExpressionSyntax : ExpressionSyntax
{
internal readonly ExpressionSyntax governingExpression;
internal readonly SyntaxToken switchKeyword;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? arms;
internal readonly SyntaxToken closeBraceToken;
internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (arms != null)
{
this.AdjustFlagsAndWidth(arms);
this.arms = arms;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (arms != null)
{
this.AdjustFlagsAndWidth(arms);
this.arms = arms;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
this.AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (arms != null)
{
this.AdjustFlagsAndWidth(arms);
this.arms = arms;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public ExpressionSyntax GoverningExpression => this.governingExpression;
public SyntaxToken SwitchKeyword => this.switchKeyword;
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> Arms => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arms));
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.governingExpression,
1 => this.switchKeyword,
2 => this.openBraceToken,
3 => this.arms,
4 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchExpression(this);
public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, GetDiagnostics(), annotations);
internal SwitchExpressionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var governingExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(governingExpression);
this.governingExpression = governingExpression;
var switchKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(switchKeyword);
this.switchKeyword = switchKeyword;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var arms = (GreenNode?)reader.ReadValue();
if (arms != null)
{
AdjustFlagsAndWidth(arms);
this.arms = arms;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.governingExpression);
writer.WriteValue(this.switchKeyword);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.arms);
writer.WriteValue(this.closeBraceToken);
}
static SwitchExpressionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionSyntax), r => new SwitchExpressionSyntax(r));
}
}
internal sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode
{
internal readonly PatternSyntax pattern;
internal readonly WhenClauseSyntax? whenClause;
internal readonly SyntaxToken equalsGreaterThanToken;
internal readonly ExpressionSyntax expression;
internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
if (whenClause != null)
{
this.AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
this.AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public PatternSyntax Pattern => this.pattern;
public WhenClauseSyntax? WhenClause => this.whenClause;
public SyntaxToken EqualsGreaterThanToken => this.equalsGreaterThanToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.pattern,
1 => this.whenClause,
2 => this.equalsGreaterThanToken,
3 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionArmSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSwitchExpressionArm(this);
public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
{
if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression)
{
var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, GetDiagnostics(), annotations);
internal SwitchExpressionArmSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var pattern = (PatternSyntax)reader.ReadValue();
AdjustFlagsAndWidth(pattern);
this.pattern = pattern;
var whenClause = (WhenClauseSyntax?)reader.ReadValue();
if (whenClause != null)
{
AdjustFlagsAndWidth(whenClause);
this.whenClause = whenClause;
}
var equalsGreaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsGreaterThanToken);
this.equalsGreaterThanToken = equalsGreaterThanToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.pattern);
writer.WriteValue(this.whenClause);
writer.WriteValue(this.equalsGreaterThanToken);
writer.WriteValue(this.expression);
}
static SwitchExpressionArmSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionArmSyntax), r => new SwitchExpressionArmSyntax(r));
}
}
internal sealed partial class TryStatementSyntax : StatementSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken tryKeyword;
internal readonly BlockSyntax block;
internal readonly GreenNode? catches;
internal readonly FinallyClauseSyntax? @finally;
internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
if (catches != null)
{
this.AdjustFlagsAndWidth(catches);
this.catches = catches;
}
if (@finally != null)
{
this.AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
if (catches != null)
{
this.AdjustFlagsAndWidth(catches);
this.catches = catches;
}
if (@finally != null)
{
this.AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
this.AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
if (catches != null)
{
this.AdjustFlagsAndWidth(catches);
this.catches = catches;
}
if (@finally != null)
{
this.AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken TryKeyword => this.tryKeyword;
public BlockSyntax Block => this.block;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> Catches => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax>(this.catches);
public FinallyClauseSyntax? Finally => this.@finally;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.tryKeyword,
2 => this.block,
3 => this.catches,
4 => this.@finally,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TryStatementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTryStatement(this);
public TryStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> catches, FinallyClauseSyntax @finally)
{
if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally)
{
var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, GetDiagnostics(), annotations);
internal TryStatementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var tryKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(tryKeyword);
this.tryKeyword = tryKeyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
var catches = (GreenNode?)reader.ReadValue();
if (catches != null)
{
AdjustFlagsAndWidth(catches);
this.catches = catches;
}
var @finally = (FinallyClauseSyntax?)reader.ReadValue();
if (@finally != null)
{
AdjustFlagsAndWidth(@finally);
this.@finally = @finally;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.tryKeyword);
writer.WriteValue(this.block);
writer.WriteValue(this.catches);
writer.WriteValue(this.@finally);
}
static TryStatementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TryStatementSyntax), r => new TryStatementSyntax(r));
}
}
internal sealed partial class CatchClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken catchKeyword;
internal readonly CatchDeclarationSyntax? declaration;
internal readonly CatchFilterClauseSyntax? filter;
internal readonly BlockSyntax block;
internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (filter != null)
{
this.AdjustFlagsAndWidth(filter);
this.filter = filter;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (filter != null)
{
this.AdjustFlagsAndWidth(filter);
this.filter = filter;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
if (declaration != null)
{
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
if (filter != null)
{
this.AdjustFlagsAndWidth(filter);
this.filter = filter;
}
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public SyntaxToken CatchKeyword => this.catchKeyword;
public CatchDeclarationSyntax? Declaration => this.declaration;
public CatchFilterClauseSyntax? Filter => this.filter;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.catchKeyword,
1 => this.declaration,
2 => this.filter,
3 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCatchClause(this);
public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax declaration, CatchFilterClauseSyntax filter, BlockSyntax block)
{
if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block)
{
var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, GetDiagnostics(), annotations);
internal CatchClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var catchKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(catchKeyword);
this.catchKeyword = catchKeyword;
var declaration = (CatchDeclarationSyntax?)reader.ReadValue();
if (declaration != null)
{
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
}
var filter = (CatchFilterClauseSyntax?)reader.ReadValue();
if (filter != null)
{
AdjustFlagsAndWidth(filter);
this.filter = filter;
}
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.catchKeyword);
writer.WriteValue(this.declaration);
writer.WriteValue(this.filter);
writer.WriteValue(this.block);
}
static CatchClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CatchClauseSyntax), r => new CatchClauseSyntax(r));
}
}
internal sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly TypeSyntax type;
internal readonly SyntaxToken? identifier;
internal readonly SyntaxToken closeParenToken;
internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (identifier != null)
{
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public TypeSyntax Type => this.type;
public SyntaxToken? Identifier => this.identifier;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.type,
2 => this.identifier,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCatchDeclaration(this);
public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, GetDiagnostics(), annotations);
internal CatchDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var identifier = (SyntaxToken?)reader.ReadValue();
if (identifier != null)
{
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.closeParenToken);
}
static CatchDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CatchDeclarationSyntax), r => new CatchDeclarationSyntax(r));
}
}
internal sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken whenKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly ExpressionSyntax filterExpression;
internal readonly SyntaxToken closeParenToken;
internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken WhenKeyword => this.whenKeyword;
public SyntaxToken OpenParenToken => this.openParenToken;
public ExpressionSyntax FilterExpression => this.filterExpression;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whenKeyword,
1 => this.openParenToken,
2 => this.filterExpression,
3 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchFilterClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCatchFilterClause(this);
public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
{
if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, GetDiagnostics(), annotations);
internal CatchFilterClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var whenKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whenKeyword);
this.whenKeyword = whenKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var filterExpression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(filterExpression);
this.filterExpression = filterExpression;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whenKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.filterExpression);
writer.WriteValue(this.closeParenToken);
}
static CatchFilterClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CatchFilterClauseSyntax), r => new CatchFilterClauseSyntax(r));
}
}
internal sealed partial class FinallyClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken finallyKeyword;
internal readonly BlockSyntax block;
internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
this.AdjustFlagsAndWidth(block);
this.block = block;
}
public SyntaxToken FinallyKeyword => this.finallyKeyword;
public BlockSyntax Block => this.block;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.finallyKeyword,
1 => this.block,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FinallyClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFinallyClause(this);
public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block)
{
if (finallyKeyword != this.FinallyKeyword || block != this.Block)
{
var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, GetDiagnostics(), annotations);
internal FinallyClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var finallyKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(finallyKeyword);
this.finallyKeyword = finallyKeyword;
var block = (BlockSyntax)reader.ReadValue();
AdjustFlagsAndWidth(block);
this.block = block;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.finallyKeyword);
writer.WriteValue(this.block);
}
static FinallyClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FinallyClauseSyntax), r => new FinallyClauseSyntax(r));
}
}
internal sealed partial class CompilationUnitSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? externs;
internal readonly GreenNode? usings;
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? members;
internal readonly SyntaxToken endOfFileToken;
internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken)
: base(kind)
{
this.SlotCount = 5;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax>(this.externs);
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax>(this.usings);
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public SyntaxToken EndOfFileToken => this.endOfFileToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.externs,
1 => this.usings,
2 => this.attributeLists,
3 => this.members,
4 => this.endOfFileToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CompilationUnitSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCompilationUnit(this);
public CompilationUnitSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken endOfFileToken)
{
if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken)
{
var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, GetDiagnostics(), annotations);
internal CompilationUnitSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var externs = (GreenNode?)reader.ReadValue();
if (externs != null)
{
AdjustFlagsAndWidth(externs);
this.externs = externs;
}
var usings = (GreenNode?)reader.ReadValue();
if (usings != null)
{
AdjustFlagsAndWidth(usings);
this.usings = usings;
}
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var endOfFileToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfFileToken);
this.endOfFileToken = endOfFileToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.externs);
writer.WriteValue(this.usings);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.members);
writer.WriteValue(this.endOfFileToken);
}
static CompilationUnitSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CompilationUnitSyntax), r => new CompilationUnitSyntax(r));
}
}
/// <summary>
/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line.
/// </summary>
internal sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken externKeyword;
internal readonly SyntaxToken aliasKeyword;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken semicolonToken;
internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
this.AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
this.AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
this.AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
/// <summary>SyntaxToken representing the extern keyword.</summary>
public SyntaxToken ExternKeyword => this.externKeyword;
/// <summary>SyntaxToken representing the alias keyword.</summary>
public SyntaxToken AliasKeyword => this.aliasKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
/// <summary>SyntaxToken representing the semicolon token.</summary>
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.externKeyword,
1 => this.aliasKeyword,
2 => this.identifier,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExternAliasDirectiveSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExternAliasDirective(this);
public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
{
if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, GetDiagnostics(), annotations);
internal ExternAliasDirectiveSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var externKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(externKeyword);
this.externKeyword = externKeyword;
var aliasKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(aliasKeyword);
this.aliasKeyword = aliasKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.externKeyword);
writer.WriteValue(this.aliasKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.semicolonToken);
}
static ExternAliasDirectiveSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExternAliasDirectiveSyntax), r => new ExternAliasDirectiveSyntax(r));
}
}
internal sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken? globalKeyword;
internal readonly SyntaxToken usingKeyword;
internal readonly SyntaxToken? staticKeyword;
internal readonly NameEqualsSyntax? alias;
internal readonly NameSyntax name;
internal readonly SyntaxToken semicolonToken;
internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (globalKeyword != null)
{
this.AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
if (staticKeyword != null)
{
this.AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
if (alias != null)
{
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
}
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (globalKeyword != null)
{
this.AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
if (staticKeyword != null)
{
this.AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
if (alias != null)
{
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
}
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 6;
if (globalKeyword != null)
{
this.AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
this.AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
if (staticKeyword != null)
{
this.AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
if (alias != null)
{
this.AdjustFlagsAndWidth(alias);
this.alias = alias;
}
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public SyntaxToken? GlobalKeyword => this.globalKeyword;
public SyntaxToken UsingKeyword => this.usingKeyword;
public SyntaxToken? StaticKeyword => this.staticKeyword;
public NameEqualsSyntax? Alias => this.alias;
public NameSyntax Name => this.name;
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.globalKeyword,
1 => this.usingKeyword,
2 => this.staticKeyword,
3 => this.alias,
4 => this.name,
5 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingDirectiveSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUsingDirective(this);
public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, NameEqualsSyntax alias, NameSyntax name, SyntaxToken semicolonToken)
{
if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || alias != this.Alias || name != this.Name || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, alias, name, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.alias, this.name, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.alias, this.name, this.semicolonToken, GetDiagnostics(), annotations);
internal UsingDirectiveSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var globalKeyword = (SyntaxToken?)reader.ReadValue();
if (globalKeyword != null)
{
AdjustFlagsAndWidth(globalKeyword);
this.globalKeyword = globalKeyword;
}
var usingKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(usingKeyword);
this.usingKeyword = usingKeyword;
var staticKeyword = (SyntaxToken?)reader.ReadValue();
if (staticKeyword != null)
{
AdjustFlagsAndWidth(staticKeyword);
this.staticKeyword = staticKeyword;
}
var alias = (NameEqualsSyntax?)reader.ReadValue();
if (alias != null)
{
AdjustFlagsAndWidth(alias);
this.alias = alias;
}
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.globalKeyword);
writer.WriteValue(this.usingKeyword);
writer.WriteValue(this.staticKeyword);
writer.WriteValue(this.alias);
writer.WriteValue(this.name);
writer.WriteValue(this.semicolonToken);
}
static UsingDirectiveSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UsingDirectiveSyntax), r => new UsingDirectiveSyntax(r));
}
}
/// <summary>Member declaration syntax.</summary>
internal abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode
{
internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal MemberDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected MemberDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the attribute declaration list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
/// <summary>Gets the modifier list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers { get; }
}
internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseNamespaceDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseNamespaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract SyntaxToken NamespaceKeyword { get; }
public abstract NameSyntax Name { get; }
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs { get; }
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings { get; }
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members { get; }
}
internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken namespaceKeyword;
internal readonly NameSyntax name;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? externs;
internal readonly GreenNode? usings;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override SyntaxToken NamespaceKeyword => this.namespaceKeyword;
public override NameSyntax Name => this.name;
public SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax>(this.externs);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax>(this.usings);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public SyntaxToken CloseBraceToken => this.closeBraceToken;
/// <summary>Gets the optional semicolon token.</summary>
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.namespaceKeyword,
3 => this.name,
4 => this.openBraceToken,
5 => this.externs,
6 => this.usings,
7 => this.members,
8 => this.closeBraceToken,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NamespaceDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNamespaceDeclaration(this);
public NamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal NamespaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var namespaceKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var externs = (GreenNode?)reader.ReadValue();
if (externs != null)
{
AdjustFlagsAndWidth(externs);
this.externs = externs;
}
var usings = (GreenNode?)reader.ReadValue();
if (usings != null)
{
AdjustFlagsAndWidth(usings);
this.usings = usings;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.namespaceKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.externs);
writer.WriteValue(this.usings);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static NamespaceDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NamespaceDeclarationSyntax), r => new NamespaceDeclarationSyntax(r));
}
}
internal sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken namespaceKeyword;
internal readonly NameSyntax name;
internal readonly SyntaxToken semicolonToken;
internal readonly GreenNode? externs;
internal readonly GreenNode? usings;
internal readonly GreenNode? members;
internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
}
internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
}
internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
if (externs != null)
{
this.AdjustFlagsAndWidth(externs);
this.externs = externs;
}
if (usings != null)
{
this.AdjustFlagsAndWidth(usings);
this.usings = usings;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override SyntaxToken NamespaceKeyword => this.namespaceKeyword;
public override NameSyntax Name => this.name;
public SyntaxToken SemicolonToken => this.semicolonToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax>(this.externs);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax>(this.usings);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.namespaceKeyword,
3 => this.name,
4 => this.semicolonToken,
5 => this.externs,
6 => this.usings,
7 => this.members,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FileScopedNamespaceDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFileScopedNamespaceDeclaration(this);
public FileScopedNamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members)
{
var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, GetDiagnostics(), annotations);
internal FileScopedNamespaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var namespaceKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(namespaceKeyword);
this.namespaceKeyword = namespaceKeyword;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
var externs = (GreenNode?)reader.ReadValue();
if (externs != null)
{
AdjustFlagsAndWidth(externs);
this.externs = externs;
}
var usings = (GreenNode?)reader.ReadValue();
if (usings != null)
{
AdjustFlagsAndWidth(usings);
this.usings = usings;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.namespaceKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.semicolonToken);
writer.WriteValue(this.externs);
writer.WriteValue(this.usings);
writer.WriteValue(this.members);
}
static FileScopedNamespaceDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FileScopedNamespaceDeclarationSyntax), r => new FileScopedNamespaceDeclarationSyntax(r));
}
}
/// <summary>Class representing one or more attributes applied to a language construct.</summary>
internal sealed partial class AttributeListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBracketToken;
internal readonly AttributeTargetSpecifierSyntax? target;
internal readonly GreenNode? attributes;
internal readonly SyntaxToken closeBracketToken;
internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (target != null)
{
this.AdjustFlagsAndWidth(target);
this.target = target;
}
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (target != null)
{
this.AdjustFlagsAndWidth(target);
this.target = target;
}
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (target != null)
{
this.AdjustFlagsAndWidth(target);
this.target = target;
}
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>Gets the open bracket token.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
/// <summary>Gets the optional construct targeted by the attribute.</summary>
public AttributeTargetSpecifierSyntax? Target => this.target;
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.attributes));
/// <summary>Gets the close bracket token.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.target,
2 => this.attributes,
3 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeList(this);
public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, GetDiagnostics(), annotations);
internal AttributeListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var target = (AttributeTargetSpecifierSyntax?)reader.ReadValue();
if (target != null)
{
AdjustFlagsAndWidth(target);
this.target = target;
}
var attributes = (GreenNode?)reader.ReadValue();
if (attributes != null)
{
AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.target);
writer.WriteValue(this.attributes);
writer.WriteValue(this.closeBracketToken);
}
static AttributeListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeListSyntax), r => new AttributeListSyntax(r));
}
}
/// <summary>Class representing what language construct an attribute targets.</summary>
internal sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken colonToken;
internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.identifier,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeTargetSpecifierSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeTargetSpecifier(this);
public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken)
{
if (identifier != this.Identifier || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, GetDiagnostics(), annotations);
internal AttributeTargetSpecifierSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.identifier);
writer.WriteValue(this.colonToken);
}
static AttributeTargetSpecifierSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeTargetSpecifierSyntax), r => new AttributeTargetSpecifierSyntax(r));
}
}
/// <summary>Attribute syntax.</summary>
internal sealed partial class AttributeSyntax : CSharpSyntaxNode
{
internal readonly NameSyntax name;
internal readonly AttributeArgumentListSyntax? argumentList;
internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (argumentList != null)
{
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
/// <summary>Gets the name.</summary>
public NameSyntax Name => this.name;
public AttributeArgumentListSyntax? ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttribute(this);
public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax argumentList)
{
if (name != this.Name || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.Attribute(name, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeSyntax(this.Kind, this.name, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeSyntax(this.Kind, this.name, this.argumentList, GetDiagnostics(), annotations);
internal AttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var argumentList = (AttributeArgumentListSyntax?)reader.ReadValue();
if (argumentList != null)
{
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.argumentList);
}
static AttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeSyntax), r => new AttributeSyntax(r));
}
}
/// <summary>Attribute argument list syntax.</summary>
internal sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? arguments;
internal readonly SyntaxToken closeParenToken;
internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (arguments != null)
{
this.AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the open paren token.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Gets the arguments syntax list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.arguments));
/// <summary>Gets the close paren token.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.arguments,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeArgumentList(this);
public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations);
internal AttributeArgumentListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var arguments = (GreenNode?)reader.ReadValue();
if (arguments != null)
{
AdjustFlagsAndWidth(arguments);
this.arguments = arguments;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.arguments);
writer.WriteValue(this.closeParenToken);
}
static AttributeArgumentListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentListSyntax), r => new AttributeArgumentListSyntax(r));
}
}
/// <summary>Attribute argument syntax.</summary>
internal sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode
{
internal readonly NameEqualsSyntax? nameEquals;
internal readonly NameColonSyntax? nameColon;
internal readonly ExpressionSyntax expression;
internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 3;
if (nameEquals != null)
{
this.AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
if (nameColon != null)
{
this.AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public NameEqualsSyntax? NameEquals => this.nameEquals;
public NameColonSyntax? NameColon => this.nameColon;
/// <summary>Gets the expression.</summary>
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.nameEquals,
1 => this.nameColon,
2 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAttributeArgument(this);
public AttributeArgumentSyntax Update(NameEqualsSyntax nameEquals, NameColonSyntax nameColon, ExpressionSyntax expression)
{
if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression)
{
var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, GetDiagnostics(), annotations);
internal AttributeArgumentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var nameEquals = (NameEqualsSyntax?)reader.ReadValue();
if (nameEquals != null)
{
AdjustFlagsAndWidth(nameEquals);
this.nameEquals = nameEquals;
}
var nameColon = (NameColonSyntax?)reader.ReadValue();
if (nameColon != null)
{
AdjustFlagsAndWidth(nameColon);
this.nameColon = nameColon;
}
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.nameEquals);
writer.WriteValue(this.nameColon);
writer.WriteValue(this.expression);
}
static AttributeArgumentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentSyntax), r => new AttributeArgumentSyntax(r));
}
}
/// <summary>Class representing an identifier name followed by an equals token.</summary>
internal sealed partial class NameEqualsSyntax : CSharpSyntaxNode
{
internal readonly IdentifierNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
/// <summary>Gets the identifier name.</summary>
public IdentifierNameSyntax Name => this.name;
public SyntaxToken EqualsToken => this.equalsToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameEqualsSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNameEquals(this);
public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken)
{
if (name != this.Name || equalsToken != this.EqualsToken)
{
var newNode = SyntaxFactory.NameEquals(name, equalsToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, GetDiagnostics(), annotations);
internal NameEqualsSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
}
static NameEqualsSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NameEqualsSyntax), r => new NameEqualsSyntax(r));
}
}
/// <summary>Type parameter list syntax.</summary>
internal sealed partial class TypeParameterListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken greaterThanToken;
internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
/// <summary>Gets the < token.</summary>
public SyntaxToken LessThanToken => this.lessThanToken;
/// <summary>Gets the parameter list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the > token.</summary>
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.parameters,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeParameterList(this);
public TypeParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations);
internal TypeParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.greaterThanToken);
}
static TypeParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeParameterListSyntax), r => new TypeParameterListSyntax(r));
}
}
/// <summary>Type parameter syntax.</summary>
internal sealed partial class TypeParameterSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? attributeLists;
internal readonly SyntaxToken? varianceKeyword;
internal readonly SyntaxToken identifier;
internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (varianceKeyword != null)
{
this.AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (varianceKeyword != null)
{
this.AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (varianceKeyword != null)
{
this.AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public SyntaxToken? VarianceKeyword => this.varianceKeyword;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.varianceKeyword,
2 => this.identifier,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeParameter(this);
public TypeParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier)
{
if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier)
{
var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, GetDiagnostics(), annotations);
internal TypeParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var varianceKeyword = (SyntaxToken?)reader.ReadValue();
if (varianceKeyword != null)
{
AdjustFlagsAndWidth(varianceKeyword);
this.varianceKeyword = varianceKeyword;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.varianceKeyword);
writer.WriteValue(this.identifier);
}
static TypeParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeParameterSyntax), r => new TypeParameterSyntax(r));
}
}
/// <summary>Base class for type declaration syntax.</summary>
internal abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseTypeDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseTypeDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the identifier.</summary>
public abstract SyntaxToken Identifier { get; }
/// <summary>Gets the base type list.</summary>
public abstract BaseListSyntax? BaseList { get; }
/// <summary>Gets the open brace token.</summary>
public abstract SyntaxToken? OpenBraceToken { get; }
/// <summary>Gets the close brace token.</summary>
public abstract SyntaxToken? CloseBraceToken { get; }
/// <summary>Gets the optional semicolon token.</summary>
public abstract SyntaxToken? SemicolonToken { get; }
}
/// <summary>Base class for type declaration syntax (class, struct, interface, record).</summary>
internal abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax
{
internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal TypeDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected TypeDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the type keyword token ("class", "struct", "interface", "record").</summary>
public abstract SyntaxToken Keyword { get; }
public abstract TypeParameterListSyntax? TypeParameterList { get; }
/// <summary>Gets the type constraint list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses { get; }
/// <summary>Gets the member declarations.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members { get; }
}
/// <summary>Class type declaration syntax.</summary>
internal sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the class keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.baseList,
6 => this.constraintClauses,
7 => this.openBraceToken,
8 => this.members,
9 => this.closeBraceToken,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitClassDeclaration(this);
public ClassDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal ClassDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static ClassDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ClassDeclarationSyntax), r => new ClassDeclarationSyntax(r));
}
}
/// <summary>Struct type declaration syntax.</summary>
internal sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the struct keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.baseList,
6 => this.constraintClauses,
7 => this.openBraceToken,
8 => this.members,
9 => this.closeBraceToken,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StructDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitStructDeclaration(this);
public StructDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal StructDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static StructDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(StructDeclarationSyntax), r => new StructDeclarationSyntax(r));
}
}
/// <summary>Interface type declaration syntax.</summary>
internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the interface keyword token.</summary>
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
5 => this.baseList,
6 => this.constraintClauses,
7 => this.openBraceToken,
8 => this.members,
9 => this.closeBraceToken,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterfaceDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitInterfaceDeclaration(this);
public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal InterfaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static InterfaceDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(InterfaceDeclarationSyntax), r => new InterfaceDeclarationSyntax(r));
}
}
internal sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken? classOrStructKeyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax? parameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken? openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken? closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 13;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (classOrStructKeyword != null)
{
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (openBraceToken != null)
{
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
if (closeBraceToken != null)
{
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 13;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (classOrStructKeyword != null)
{
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (openBraceToken != null)
{
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
if (closeBraceToken != null)
{
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 13;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (classOrStructKeyword != null)
{
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
if (parameterList != null)
{
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (openBraceToken != null)
{
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
if (closeBraceToken != null)
{
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override SyntaxToken Keyword => this.keyword;
public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public ParameterListSyntax? ParameterList => this.parameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override SyntaxToken? OpenBraceToken => this.openBraceToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax>(this.members);
public override SyntaxToken? CloseBraceToken => this.closeBraceToken;
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.classOrStructKeyword,
4 => this.identifier,
5 => this.typeParameterList,
6 => this.parameterList,
7 => this.baseList,
8 => this.constraintClauses,
9 => this.openBraceToken,
10 => this.members,
11 => this.closeBraceToken,
12 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecordDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRecordDeclaration(this);
public RecordDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.RecordDeclaration(this.Kind, attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal RecordDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 13;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var classOrStructKeyword = (SyntaxToken?)reader.ReadValue();
if (classOrStructKeyword != null)
{
AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax?)reader.ReadValue();
if (parameterList != null)
{
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
}
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var openBraceToken = (SyntaxToken?)reader.ReadValue();
if (openBraceToken != null)
{
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
}
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken?)reader.ReadValue();
if (closeBraceToken != null)
{
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.classOrStructKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static RecordDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RecordDeclarationSyntax), r => new RecordDeclarationSyntax(r));
}
}
/// <summary>Enum type declaration syntax.</summary>
internal sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken enumKeyword;
internal readonly SyntaxToken identifier;
internal readonly BaseListSyntax? baseList;
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? members;
internal readonly SyntaxToken closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (members != null)
{
this.AdjustFlagsAndWidth(members);
this.members = members;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the enum keyword token.</summary>
public SyntaxToken EnumKeyword => this.enumKeyword;
public override SyntaxToken Identifier => this.identifier;
public override BaseListSyntax? BaseList => this.baseList;
public override SyntaxToken OpenBraceToken => this.openBraceToken;
/// <summary>Gets the members declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.members));
public override SyntaxToken CloseBraceToken => this.closeBraceToken;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.enumKeyword,
3 => this.identifier,
4 => this.baseList,
5 => this.openBraceToken,
6 => this.members,
7 => this.closeBraceToken,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEnumDeclaration(this);
public EnumDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal EnumDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var enumKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(enumKeyword);
this.enumKeyword = enumKeyword;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
AdjustFlagsAndWidth(baseList);
this.baseList = baseList;
}
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var members = (GreenNode?)reader.ReadValue();
if (members != null)
{
AdjustFlagsAndWidth(members);
this.members = members;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.enumKeyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.baseList);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.members);
writer.WriteValue(this.closeBraceToken);
writer.WriteValue(this.semicolonToken);
}
static EnumDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EnumDeclarationSyntax), r => new EnumDeclarationSyntax(r));
}
}
/// <summary>Delegate declaration syntax.</summary>
internal sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken delegateKeyword;
internal readonly TypeSyntax returnType;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax parameterList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken semicolonToken;
internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the "delegate" keyword.</summary>
public SyntaxToken DelegateKeyword => this.delegateKeyword;
/// <summary>Gets the return type.</summary>
public TypeSyntax ReturnType => this.returnType;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
/// <summary>Gets the parameter list.</summary>
public ParameterListSyntax ParameterList => this.parameterList;
/// <summary>Gets the constraint clause list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
/// <summary>Gets the semicolon token.</summary>
public SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.delegateKeyword,
3 => this.returnType,
4 => this.identifier,
5 => this.typeParameterList,
6 => this.parameterList,
7 => this.constraintClauses,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DelegateDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDelegateDeclaration(this);
public DelegateDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, GetDiagnostics(), annotations);
internal DelegateDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var delegateKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(delegateKeyword);
this.delegateKeyword = delegateKeyword;
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.delegateKeyword);
writer.WriteValue(this.returnType);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.semicolonToken);
}
static DelegateDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DelegateDeclarationSyntax), r => new DelegateDeclarationSyntax(r));
}
}
internal sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken identifier;
internal readonly EqualsValueClauseSyntax? equalsValue;
internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (equalsValue != null)
{
this.AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (equalsValue != null)
{
this.AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (equalsValue != null)
{
this.AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public EqualsValueClauseSyntax? EqualsValue => this.equalsValue;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.identifier,
3 => this.equalsValue,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumMemberDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEnumMemberDeclaration(this);
public EnumMemberDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue)
{
var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, GetDiagnostics(), annotations);
internal EnumMemberDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var equalsValue = (EqualsValueClauseSyntax?)reader.ReadValue();
if (equalsValue != null)
{
AdjustFlagsAndWidth(equalsValue);
this.equalsValue = equalsValue;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.identifier);
writer.WriteValue(this.equalsValue);
}
static EnumMemberDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EnumMemberDeclarationSyntax), r => new EnumMemberDeclarationSyntax(r));
}
}
/// <summary>Base list syntax.</summary>
internal sealed partial class BaseListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken colonToken;
internal readonly GreenNode? types;
internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (types != null)
{
this.AdjustFlagsAndWidth(types);
this.types = types;
}
}
internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (types != null)
{
this.AdjustFlagsAndWidth(types);
this.types = types;
}
}
internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (types != null)
{
this.AdjustFlagsAndWidth(types);
this.types = types;
}
}
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>Gets the base type references.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> Types => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.types));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.colonToken,
1 => this.types,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBaseList(this);
public BaseListSyntax Update(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> types)
{
if (colonToken != this.ColonToken || types != this.Types)
{
var newNode = SyntaxFactory.BaseList(colonToken, types);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BaseListSyntax(this.Kind, this.colonToken, this.types, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BaseListSyntax(this.Kind, this.colonToken, this.types, GetDiagnostics(), annotations);
internal BaseListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var types = (GreenNode?)reader.ReadValue();
if (types != null)
{
AdjustFlagsAndWidth(types);
this.types = types;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.types);
}
static BaseListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BaseListSyntax), r => new BaseListSyntax(r));
}
}
/// <summary>Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class.</summary>
internal abstract partial class BaseTypeSyntax : CSharpSyntaxNode
{
internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseTypeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseTypeSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract TypeSyntax Type { get; }
}
internal sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax
{
internal readonly TypeSyntax type;
internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public override TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleBaseTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSimpleBaseType(this);
public SimpleBaseTypeSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.SimpleBaseType(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SimpleBaseTypeSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SimpleBaseTypeSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal SimpleBaseTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static SimpleBaseTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SimpleBaseTypeSyntax), r => new SimpleBaseTypeSyntax(r));
}
}
internal sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax
{
internal readonly TypeSyntax type;
internal readonly ArgumentListSyntax argumentList;
internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
public override TypeSyntax Type => this.type;
public ArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.type,
1 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrimaryConstructorBaseTypeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPrimaryConstructorBaseType(this);
public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList)
{
if (type != this.Type || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, GetDiagnostics(), annotations);
internal PrimaryConstructorBaseTypeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
writer.WriteValue(this.argumentList);
}
static PrimaryConstructorBaseTypeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PrimaryConstructorBaseTypeSyntax), r => new PrimaryConstructorBaseTypeSyntax(r));
}
}
/// <summary>Type parameter constraint clause.</summary>
internal sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken whereKeyword;
internal readonly IdentifierNameSyntax name;
internal readonly SyntaxToken colonToken;
internal readonly GreenNode? constraints;
internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (constraints != null)
{
this.AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (constraints != null)
{
this.AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (constraints != null)
{
this.AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
public SyntaxToken WhereKeyword => this.whereKeyword;
/// <summary>Gets the identifier.</summary>
public IdentifierNameSyntax Name => this.name;
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>Gets the constraints list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> Constraints => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.constraints));
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.whereKeyword,
1 => this.name,
2 => this.colonToken,
3 => this.constraints,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterConstraintClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeParameterConstraintClause(this);
public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> constraints)
{
if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints)
{
var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, GetDiagnostics(), annotations);
internal TypeParameterConstraintClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var whereKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(whereKeyword);
this.whereKeyword = whereKeyword;
var name = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var constraints = (GreenNode?)reader.ReadValue();
if (constraints != null)
{
AdjustFlagsAndWidth(constraints);
this.constraints = constraints;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.whereKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.constraints);
}
static TypeParameterConstraintClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeParameterConstraintClauseSyntax), r => new TypeParameterConstraintClauseSyntax(r));
}
}
/// <summary>Base type for type parameter constraint syntax.</summary>
internal abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode
{
internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal TypeParameterConstraintSyntax(SyntaxKind kind)
: base(kind)
{
}
protected TypeParameterConstraintSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>Constructor constraint syntax.</summary>
internal sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly SyntaxToken newKeyword;
internal readonly SyntaxToken openParenToken;
internal readonly SyntaxToken closeParenToken;
internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the "new" keyword.</summary>
public SyntaxToken NewKeyword => this.newKeyword;
/// <summary>Gets the open paren keyword.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
/// <summary>Gets the close paren keyword.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.newKeyword,
1 => this.openParenToken,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstructorConstraint(this);
public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
{
if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, GetDiagnostics(), annotations);
internal ConstructorConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var newKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(newKeyword);
this.newKeyword = newKeyword;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.newKeyword);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.closeParenToken);
}
static ConstructorConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstructorConstraintSyntax), r => new ConstructorConstraintSyntax(r));
}
}
/// <summary>Class or struct constraint syntax.</summary>
internal sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly SyntaxToken classOrStructKeyword;
internal readonly SyntaxToken? questionToken;
internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
if (questionToken != null)
{
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
if (questionToken != null)
{
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
if (questionToken != null)
{
this.AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
/// <summary>Gets the constraint keyword ("class" or "struct").</summary>
public SyntaxToken ClassOrStructKeyword => this.classOrStructKeyword;
/// <summary>SyntaxToken representing the question mark.</summary>
public SyntaxToken? QuestionToken => this.questionToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.classOrStructKeyword,
1 => this.questionToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassOrStructConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitClassOrStructConstraint(this);
public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken)
{
if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken)
{
var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind, classOrStructKeyword, questionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, GetDiagnostics(), annotations);
internal ClassOrStructConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var classOrStructKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(classOrStructKeyword);
this.classOrStructKeyword = classOrStructKeyword;
var questionToken = (SyntaxToken?)reader.ReadValue();
if (questionToken != null)
{
AdjustFlagsAndWidth(questionToken);
this.questionToken = questionToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.classOrStructKeyword);
writer.WriteValue(this.questionToken);
}
static ClassOrStructConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ClassOrStructConstraintSyntax), r => new ClassOrStructConstraintSyntax(r));
}
}
/// <summary>Type constraint syntax.</summary>
internal sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly TypeSyntax type;
internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
/// <summary>Gets the type syntax.</summary>
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeConstraint(this);
public TypeConstraintSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.TypeConstraint(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeConstraintSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeConstraintSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal TypeConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static TypeConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeConstraintSyntax), r => new TypeConstraintSyntax(r));
}
}
/// <summary>Default constraint syntax.</summary>
internal sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax
{
internal readonly SyntaxToken defaultKeyword;
internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
/// <summary>Gets the "default" keyword.</summary>
public SyntaxToken DefaultKeyword => this.defaultKeyword;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.defaultKeyword : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultConstraintSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefaultConstraint(this);
public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword)
{
if (defaultKeyword != this.DefaultKeyword)
{
var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, GetDiagnostics(), annotations);
internal DefaultConstraintSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var defaultKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(defaultKeyword);
this.defaultKeyword = defaultKeyword;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.defaultKeyword);
}
static DefaultConstraintSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefaultConstraintSyntax), r => new DefaultConstraintSyntax(r));
}
}
internal abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseFieldDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseFieldDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract VariableDeclarationSyntax Declaration { get; }
public abstract SyntaxToken SemicolonToken { get; }
}
internal sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken semicolonToken;
internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 4;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override VariableDeclarationSyntax Declaration => this.declaration;
public override SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.declaration,
3 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FieldDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFieldDeclaration(this);
public FieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations);
internal FieldDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.declaration);
writer.WriteValue(this.semicolonToken);
}
static FieldDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FieldDeclarationSyntax), r => new FieldDeclarationSyntax(r));
}
}
internal sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken eventKeyword;
internal readonly VariableDeclarationSyntax declaration;
internal readonly SyntaxToken semicolonToken;
internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public SyntaxToken EventKeyword => this.eventKeyword;
public override VariableDeclarationSyntax Declaration => this.declaration;
public override SyntaxToken SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.eventKeyword,
3 => this.declaration,
4 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventFieldDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEventFieldDeclaration(this);
public EventFieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, GetDiagnostics(), annotations);
internal EventFieldDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var eventKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
var declaration = (VariableDeclarationSyntax)reader.ReadValue();
AdjustFlagsAndWidth(declaration);
this.declaration = declaration;
var semicolonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.eventKeyword);
writer.WriteValue(this.declaration);
writer.WriteValue(this.semicolonToken);
}
static EventFieldDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EventFieldDeclarationSyntax), r => new EventFieldDeclarationSyntax(r));
}
}
internal sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode
{
internal readonly NameSyntax name;
internal readonly SyntaxToken dotToken;
internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
public NameSyntax Name => this.name;
public SyntaxToken DotToken => this.dotToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.dotToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExplicitInterfaceSpecifierSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitExplicitInterfaceSpecifier(this);
public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken)
{
if (name != this.Name || dotToken != this.DotToken)
{
var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, GetDiagnostics(), annotations);
internal ExplicitInterfaceSpecifierSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (NameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var dotToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.dotToken);
}
static ExplicitInterfaceSpecifierSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ExplicitInterfaceSpecifierSyntax), r => new ExplicitInterfaceSpecifierSyntax(r));
}
}
/// <summary>Base type for method declaration syntax.</summary>
internal abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax
{
internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseMethodDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseMethodDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the parameter list.</summary>
public abstract ParameterListSyntax ParameterList { get; }
public abstract BlockSyntax? Body { get; }
public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; }
/// <summary>Gets the optional semicolon token.</summary>
public abstract SyntaxToken? SemicolonToken { get; }
}
/// <summary>Method declaration syntax.</summary>
internal sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax returnType;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
internal readonly ParameterListSyntax parameterList;
internal readonly GreenNode? constraintClauses;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 11;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (typeParameterList != null)
{
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (constraintClauses != null)
{
this.AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the return type syntax.</summary>
public TypeSyntax ReturnType => this.returnType;
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
public override ParameterListSyntax ParameterList => this.parameterList;
/// <summary>Gets the constraint clause list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax>(this.constraintClauses);
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.explicitInterfaceSpecifier,
4 => this.identifier,
5 => this.typeParameterList,
6 => this.parameterList,
7 => this.constraintClauses,
8 => this.body,
9 => this.expressionBody,
10 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MethodDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitMethodDeclaration(this);
public MethodDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal MethodDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 11;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue();
if (typeParameterList != null)
{
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var constraintClauses = (GreenNode?)reader.ReadValue();
if (constraintClauses != null)
{
AdjustFlagsAndWidth(constraintClauses);
this.constraintClauses = constraintClauses;
}
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static MethodDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(MethodDeclarationSyntax), r => new MethodDeclarationSyntax(r));
}
}
/// <summary>Operator declaration syntax.</summary>
internal sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax returnType;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken operatorKeyword;
internal readonly SyntaxToken operatorToken;
internal readonly ParameterListSyntax parameterList;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the return type.</summary>
public TypeSyntax ReturnType => this.returnType;
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the "operator" keyword.</summary>
public SyntaxToken OperatorKeyword => this.operatorKeyword;
/// <summary>Gets the operator token.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
public override ParameterListSyntax ParameterList => this.parameterList;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.returnType,
3 => this.explicitInterfaceSpecifier,
4 => this.operatorKeyword,
5 => this.operatorToken,
6 => this.parameterList,
7 => this.body,
8 => this.expressionBody,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOperatorDeclaration(this);
public OperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal OperatorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var returnType = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(returnType);
this.returnType = returnType;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.returnType);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static OperatorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OperatorDeclarationSyntax), r => new OperatorDeclarationSyntax(r));
}
}
/// <summary>Conversion operator declaration syntax.</summary>
internal sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken implicitOrExplicitKeyword;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken operatorKeyword;
internal readonly TypeSyntax type;
internal readonly ParameterListSyntax parameterList;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 10;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the "implicit" or "explicit" token.</summary>
public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword;
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the "operator" token.</summary>
public SyntaxToken OperatorKeyword => this.operatorKeyword;
/// <summary>Gets the type.</summary>
public TypeSyntax Type => this.type;
public override ParameterListSyntax ParameterList => this.parameterList;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.implicitOrExplicitKeyword,
3 => this.explicitInterfaceSpecifier,
4 => this.operatorKeyword,
5 => this.type,
6 => this.parameterList,
7 => this.body,
8 => this.expressionBody,
9 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConversionOperatorDeclaration(this);
public ConversionOperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, type, parameterList, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal ConversionOperatorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 10;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.implicitOrExplicitKeyword);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static ConversionOperatorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorDeclarationSyntax), r => new ConversionOperatorDeclarationSyntax(r));
}
}
/// <summary>Constructor declaration syntax.</summary>
internal sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken identifier;
internal readonly ParameterListSyntax parameterList;
internal readonly ConstructorInitializerSyntax? initializer;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override ParameterListSyntax ParameterList => this.parameterList;
public ConstructorInitializerSyntax? Initializer => this.initializer;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.identifier,
3 => this.parameterList,
4 => this.initializer,
5 => this.body,
6 => this.expressionBody,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstructorDeclaration(this);
public ConstructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal ConstructorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var initializer = (ConstructorInitializerSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.identifier);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.initializer);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static ConstructorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstructorDeclarationSyntax), r => new ConstructorDeclarationSyntax(r));
}
}
/// <summary>Constructor initializer syntax.</summary>
internal sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken colonToken;
internal readonly SyntaxToken thisOrBaseKeyword;
internal readonly ArgumentListSyntax argumentList;
internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
this.AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
this.AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
/// <summary>Gets the colon token.</summary>
public SyntaxToken ColonToken => this.colonToken;
/// <summary>Gets the "this" or "base" keyword.</summary>
public SyntaxToken ThisOrBaseKeyword => this.thisOrBaseKeyword;
public ArgumentListSyntax ArgumentList => this.argumentList;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.colonToken,
1 => this.thisOrBaseKeyword,
2 => this.argumentList,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorInitializerSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConstructorInitializer(this);
public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
{
if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList)
{
var newNode = SyntaxFactory.ConstructorInitializer(this.Kind, colonToken, thisOrBaseKeyword, argumentList);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, GetDiagnostics(), annotations);
internal ConstructorInitializerSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
var thisOrBaseKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(thisOrBaseKeyword);
this.thisOrBaseKeyword = thisOrBaseKeyword;
var argumentList = (ArgumentListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(argumentList);
this.argumentList = argumentList;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.colonToken);
writer.WriteValue(this.thisOrBaseKeyword);
writer.WriteValue(this.argumentList);
}
static ConstructorInitializerSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConstructorInitializerSyntax), r => new ConstructorInitializerSyntax(r));
}
}
/// <summary>Destructor declaration syntax.</summary>
internal sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken tildeToken;
internal readonly SyntaxToken identifier;
internal readonly ParameterListSyntax parameterList;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the tilde token.</summary>
public SyntaxToken TildeToken => this.tildeToken;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override ParameterListSyntax ParameterList => this.parameterList;
public override BlockSyntax? Body => this.body;
public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public override SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.tildeToken,
3 => this.identifier,
4 => this.parameterList,
5 => this.body,
6 => this.expressionBody,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DestructorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDestructorDeclaration(this);
public DestructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal DestructorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var tildeToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(tildeToken);
this.tildeToken = tildeToken;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var parameterList = (ParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.tildeToken);
writer.WriteValue(this.identifier);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static DestructorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DestructorDeclarationSyntax), r => new DestructorDeclarationSyntax(r));
}
}
/// <summary>Base type for property declaration syntax.</summary>
internal abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax
{
internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BasePropertyDeclarationSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BasePropertyDeclarationSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the type syntax.</summary>
public abstract TypeSyntax Type { get; }
/// <summary>Gets the optional explicit interface specifier.</summary>
public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; }
public abstract AccessorListSyntax? AccessorList { get; }
}
internal sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly AccessorListSyntax? accessorList;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly EqualsValueClauseSyntax? initializer;
internal readonly SyntaxToken? semicolonToken;
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
this.AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax Type => this.type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override AccessorListSyntax? AccessorList => this.accessorList;
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
public EqualsValueClauseSyntax? Initializer => this.initializer;
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
3 => this.explicitInterfaceSpecifier,
4 => this.identifier,
5 => this.accessorList,
6 => this.expressionBody,
7 => this.initializer,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPropertyDeclaration(this);
public PropertyDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, GetDiagnostics(), annotations);
internal PropertyDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var accessorList = (AccessorListSyntax?)reader.ReadValue();
if (accessorList != null)
{
AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var initializer = (EqualsValueClauseSyntax?)reader.ReadValue();
if (initializer != null)
{
AdjustFlagsAndWidth(initializer);
this.initializer = initializer;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.identifier);
writer.WriteValue(this.accessorList);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.initializer);
writer.WriteValue(this.semicolonToken);
}
static PropertyDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PropertyDeclarationSyntax), r => new PropertyDeclarationSyntax(r));
}
}
/// <summary>The syntax for the expression body of an expression-bodied member.</summary>
internal sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken arrowToken;
internal readonly ExpressionSyntax expression;
internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
this.AdjustFlagsAndWidth(expression);
this.expression = expression;
}
public SyntaxToken ArrowToken => this.arrowToken;
public ExpressionSyntax Expression => this.expression;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.arrowToken,
1 => this.expression,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrowExpressionClauseSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitArrowExpressionClause(this);
public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression)
{
if (arrowToken != this.ArrowToken || expression != this.Expression)
{
var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, GetDiagnostics(), annotations);
internal ArrowExpressionClauseSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var arrowToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(arrowToken);
this.arrowToken = arrowToken;
var expression = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(expression);
this.expression = expression;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.arrowToken);
writer.WriteValue(this.expression);
}
static ArrowExpressionClauseSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ArrowExpressionClauseSyntax), r => new ArrowExpressionClauseSyntax(r));
}
}
internal sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken eventKeyword;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly AccessorListSyntax? accessorList;
internal readonly SyntaxToken? semicolonToken;
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 8;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public SyntaxToken EventKeyword => this.eventKeyword;
public override TypeSyntax Type => this.type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public override AccessorListSyntax? AccessorList => this.accessorList;
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.eventKeyword,
3 => this.type,
4 => this.explicitInterfaceSpecifier,
5 => this.identifier,
6 => this.accessorList,
7 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEventDeclaration(this);
public EventDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, GetDiagnostics(), annotations);
internal EventDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var eventKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(eventKeyword);
this.eventKeyword = eventKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var accessorList = (AccessorListSyntax?)reader.ReadValue();
if (accessorList != null)
{
AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.eventKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.identifier);
writer.WriteValue(this.accessorList);
writer.WriteValue(this.semicolonToken);
}
static EventDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EventDeclarationSyntax), r => new EventDeclarationSyntax(r));
}
}
internal sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken thisKeyword;
internal readonly BracketedParameterListSyntax parameterList;
internal readonly AccessorListSyntax? accessorList;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 9;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
this.AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
this.AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
if (accessorList != null)
{
this.AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax Type => this.type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier;
public SyntaxToken ThisKeyword => this.thisKeyword;
/// <summary>Gets the parameter list.</summary>
public BracketedParameterListSyntax ParameterList => this.parameterList;
public override AccessorListSyntax? AccessorList => this.accessorList;
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
3 => this.explicitInterfaceSpecifier,
4 => this.thisKeyword,
5 => this.parameterList,
6 => this.accessorList,
7 => this.expressionBody,
8 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIndexerDeclaration(this);
public IndexerDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal IndexerDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 9;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue();
if (explicitInterfaceSpecifier != null)
{
AdjustFlagsAndWidth(explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
var thisKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
var parameterList = (BracketedParameterListSyntax)reader.ReadValue();
AdjustFlagsAndWidth(parameterList);
this.parameterList = parameterList;
var accessorList = (AccessorListSyntax?)reader.ReadValue();
if (accessorList != null)
{
AdjustFlagsAndWidth(accessorList);
this.accessorList = accessorList;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
writer.WriteValue(this.explicitInterfaceSpecifier);
writer.WriteValue(this.thisKeyword);
writer.WriteValue(this.parameterList);
writer.WriteValue(this.accessorList);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static IndexerDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IndexerDeclarationSyntax), r => new IndexerDeclarationSyntax(r));
}
}
internal sealed partial class AccessorListSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openBraceToken;
internal readonly GreenNode? accessors;
internal readonly SyntaxToken closeBraceToken;
internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (accessors != null)
{
this.AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (accessors != null)
{
this.AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
if (accessors != null)
{
this.AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
this.AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
public SyntaxToken OpenBraceToken => this.openBraceToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> Accessors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax>(this.accessors);
public SyntaxToken CloseBraceToken => this.closeBraceToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBraceToken,
1 => this.accessors,
2 => this.closeBraceToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAccessorList(this);
public AccessorListSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
{
if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken)
{
var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, GetDiagnostics(), annotations);
internal AccessorListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBraceToken);
this.openBraceToken = openBraceToken;
var accessors = (GreenNode?)reader.ReadValue();
if (accessors != null)
{
AdjustFlagsAndWidth(accessors);
this.accessors = accessors;
}
var closeBraceToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBraceToken);
this.closeBraceToken = closeBraceToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBraceToken);
writer.WriteValue(this.accessors);
writer.WriteValue(this.closeBraceToken);
}
static AccessorListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AccessorListSyntax), r => new AccessorListSyntax(r));
}
}
internal sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly SyntaxToken keyword;
internal readonly BlockSyntax? body;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly SyntaxToken? semicolonToken;
internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
: base(kind)
{
this.SlotCount = 6;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
if (body != null)
{
this.AdjustFlagsAndWidth(body);
this.body = body;
}
if (expressionBody != null)
{
this.AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
if (semicolonToken != null)
{
this.AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
/// <summary>Gets the attribute declaration list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the modifier list.</summary>
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
/// <summary>Gets the keyword token, or identifier if an erroneous accessor declaration.</summary>
public SyntaxToken Keyword => this.keyword;
/// <summary>Gets the optional body block which may be empty, but it is null if there are no braces.</summary>
public BlockSyntax? Body => this.body;
/// <summary>Gets the optional expression body.</summary>
public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody;
/// <summary>Gets the optional semicolon token.</summary>
public SyntaxToken? SemicolonToken => this.semicolonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.keyword,
3 => this.body,
4 => this.expressionBody,
5 => this.semicolonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorDeclarationSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitAccessorDeclaration(this);
public AccessorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
{
var newNode = SyntaxFactory.AccessorDeclaration(this.Kind, attributeLists, modifiers, keyword, body, expressionBody, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations);
internal AccessorDeclarationSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var keyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(keyword);
this.keyword = keyword;
var body = (BlockSyntax?)reader.ReadValue();
if (body != null)
{
AdjustFlagsAndWidth(body);
this.body = body;
}
var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue();
if (expressionBody != null)
{
AdjustFlagsAndWidth(expressionBody);
this.expressionBody = expressionBody;
}
var semicolonToken = (SyntaxToken?)reader.ReadValue();
if (semicolonToken != null)
{
AdjustFlagsAndWidth(semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.keyword);
writer.WriteValue(this.body);
writer.WriteValue(this.expressionBody);
writer.WriteValue(this.semicolonToken);
}
static AccessorDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(AccessorDeclarationSyntax), r => new AccessorDeclarationSyntax(r));
}
}
/// <summary>Base type for parameter list syntax.</summary>
internal abstract partial class BaseParameterListSyntax : CSharpSyntaxNode
{
internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseParameterListSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseParameterListSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the parameter list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> Parameters { get; }
}
/// <summary>Parameter list syntax.</summary>
internal sealed partial class ParameterListSyntax : BaseParameterListSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeParenToken;
internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the open paren token.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close paren token.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.parameters,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParameterList(this);
public ParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations);
internal ParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeParenToken);
}
static ParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParameterListSyntax), r => new ParameterListSyntax(r));
}
}
/// <summary>Parameter list syntax with surrounding brackets.</summary>
internal sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeBracketToken;
internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>Gets the open bracket token.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close bracket token.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.parameters,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBracketedParameterList(this);
public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations);
internal BracketedParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeBracketToken);
}
static BracketedParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BracketedParameterListSyntax), r => new BracketedParameterListSyntax(r));
}
}
/// <summary>Base parameter syntax.</summary>
internal abstract partial class BaseParameterSyntax : CSharpSyntaxNode
{
internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseParameterSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseParameterSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the attribute declaration list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists { get; }
/// <summary>Gets the modifier list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers { get; }
public abstract TypeSyntax? Type { get; }
}
/// <summary>Parameter syntax.</summary>
internal sealed partial class ParameterSyntax : BaseParameterSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax? type;
internal readonly SyntaxToken identifier;
internal readonly EqualsValueClauseSyntax? @default;
internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (@default != null)
{
this.AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (@default != null)
{
this.AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default)
: base(kind)
{
this.SlotCount = 5;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
if (@default != null)
{
this.AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
/// <summary>Gets the attribute declaration list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the modifier list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax? Type => this.type;
/// <summary>Gets the identifier.</summary>
public SyntaxToken Identifier => this.identifier;
public EqualsValueClauseSyntax? Default => this.@default;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
3 => this.identifier,
4 => this.@default,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitParameter(this);
public ParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default)
{
var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, GetDiagnostics(), annotations);
internal ParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var @default = (EqualsValueClauseSyntax?)reader.ReadValue();
if (@default != null)
{
AdjustFlagsAndWidth(@default);
this.@default = @default;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
writer.WriteValue(this.identifier);
writer.WriteValue(this.@default);
}
static ParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ParameterSyntax), r => new ParameterSyntax(r));
}
}
/// <summary>Parameter syntax.</summary>
internal sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
/// <summary>Gets the attribute declaration list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
/// <summary>Gets the modifier list.</summary>
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public override TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitFunctionPointerParameter(this);
public FunctionPointerParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type)
{
var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations);
internal FunctionPointerParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
}
static FunctionPointerParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterSyntax), r => new FunctionPointerParameterSyntax(r));
}
}
internal sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax? type;
internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
}
internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
}
internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type)
: base(kind)
{
this.SlotCount = 3;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
this.AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
if (type != null)
{
this.AdjustFlagsAndWidth(type);
this.type = type;
}
}
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax>(this.attributeLists);
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.modifiers);
public TypeSyntax? Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.attributeLists,
1 => this.modifiers,
2 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IncompleteMemberSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIncompleteMember(this);
public IncompleteMemberSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type)
{
var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations);
internal IncompleteMemberSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
var modifiers = (GreenNode?)reader.ReadValue();
if (modifiers != null)
{
AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
var type = (TypeSyntax?)reader.ReadValue();
if (type != null)
{
AdjustFlagsAndWidth(type);
this.type = type;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.attributeLists);
writer.WriteValue(this.modifiers);
writer.WriteValue(this.type);
}
static IncompleteMemberSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IncompleteMemberSyntax), r => new IncompleteMemberSyntax(r));
}
}
internal sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax
{
internal readonly GreenNode? tokens;
internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
if (tokens != null)
{
this.AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
if (tokens != null)
{
this.AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens)
: base(kind)
{
this.SlotCount = 1;
if (tokens != null)
{
this.AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> Tokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.tokens);
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.tokens : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SkippedTokensTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitSkippedTokensTrivia(this);
public SkippedTokensTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> tokens)
{
if (tokens != this.Tokens)
{
var newNode = SyntaxFactory.SkippedTokensTrivia(tokens);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new SkippedTokensTriviaSyntax(this.Kind, this.tokens, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new SkippedTokensTriviaSyntax(this.Kind, this.tokens, GetDiagnostics(), annotations);
internal SkippedTokensTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var tokens = (GreenNode?)reader.ReadValue();
if (tokens != null)
{
AdjustFlagsAndWidth(tokens);
this.tokens = tokens;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.tokens);
}
static SkippedTokensTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(SkippedTokensTriviaSyntax), r => new SkippedTokensTriviaSyntax(r));
}
}
internal sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax
{
internal readonly GreenNode? content;
internal readonly SyntaxToken endOfComment;
internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment)
: base(kind)
{
this.SlotCount = 2;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax>(this.content);
public SyntaxToken EndOfComment => this.endOfComment;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.content,
1 => this.endOfComment,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DocumentationCommentTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDocumentationCommentTrivia(this);
public DocumentationCommentTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment)
{
if (content != this.Content || endOfComment != this.EndOfComment)
{
var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind, content, endOfComment);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, GetDiagnostics(), annotations);
internal DocumentationCommentTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var content = (GreenNode?)reader.ReadValue();
if (content != null)
{
AdjustFlagsAndWidth(content);
this.content = content;
}
var endOfComment = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfComment);
this.endOfComment = endOfComment;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.content);
writer.WriteValue(this.endOfComment);
}
static DocumentationCommentTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DocumentationCommentTriviaSyntax), r => new DocumentationCommentTriviaSyntax(r));
}
}
/// <summary>
/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag).
/// For example, the M in <see cref="M" />.
/// </summary>
internal abstract partial class CrefSyntax : CSharpSyntaxNode
{
internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal CrefSyntax(SyntaxKind kind)
: base(kind)
{
}
protected CrefSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>
/// A symbol reference that definitely refers to a type.
/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer).
/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax
/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol
/// might be a non-type member.
/// </summary>
internal sealed partial class TypeCrefSyntax : CrefSyntax
{
internal readonly TypeSyntax type;
internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type)
: base(kind)
{
this.SlotCount = 1;
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.type : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitTypeCref(this);
public TypeCrefSyntax Update(TypeSyntax type)
{
if (type != this.Type)
{
var newNode = SyntaxFactory.TypeCref(type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new TypeCrefSyntax(this.Kind, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new TypeCrefSyntax(this.Kind, this.type, GetDiagnostics(), annotations);
internal TypeCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.type);
}
static TypeCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(TypeCrefSyntax), r => new TypeCrefSyntax(r));
}
}
/// <summary>
/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace.
/// For example, cref="System.String.ToString()".
/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax
/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol
/// might be a non-type member.
/// </summary>
internal sealed partial class QualifiedCrefSyntax : CrefSyntax
{
internal readonly TypeSyntax container;
internal readonly SyntaxToken dotToken;
internal readonly MemberCrefSyntax member;
internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(container);
this.container = container;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(member);
this.member = member;
}
internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(container);
this.container = container;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(member);
this.member = member;
}
internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(container);
this.container = container;
this.AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
this.AdjustFlagsAndWidth(member);
this.member = member;
}
public TypeSyntax Container => this.container;
public SyntaxToken DotToken => this.dotToken;
public MemberCrefSyntax Member => this.member;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.container,
1 => this.dotToken,
2 => this.member,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitQualifiedCref(this);
public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
{
if (container != this.Container || dotToken != this.DotToken || member != this.Member)
{
var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, GetDiagnostics(), annotations);
internal QualifiedCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var container = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(container);
this.container = container;
var dotToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(dotToken);
this.dotToken = dotToken;
var member = (MemberCrefSyntax)reader.ReadValue();
AdjustFlagsAndWidth(member);
this.member = member;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.container);
writer.WriteValue(this.dotToken);
writer.WriteValue(this.member);
}
static QualifiedCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(QualifiedCrefSyntax), r => new QualifiedCrefSyntax(r));
}
}
/// <summary>
/// The unqualified part of a CrefSyntax.
/// For example, "ToString()" in "object.ToString()".
/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax
/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol
/// might be a non-type member.
/// </summary>
internal abstract partial class MemberCrefSyntax : CrefSyntax
{
internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal MemberCrefSyntax(SyntaxKind kind)
: base(kind)
{
}
protected MemberCrefSyntax(ObjectReader reader)
: base(reader)
{
}
}
/// <summary>
/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name,
/// with an optional type parameter list) and an optional parameter list.
/// For example, "M", "M<T>" or "M(int)".
/// Also, "A::B()" or "string()".
/// </summary>
internal sealed partial class NameMemberCrefSyntax : MemberCrefSyntax
{
internal readonly TypeSyntax name;
internal readonly CrefParameterListSyntax? parameters;
internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public TypeSyntax Name => this.name;
public CrefParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNameMemberCref(this);
public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax parameters)
{
if (name != this.Name || parameters != this.Parameters)
{
var newNode = SyntaxFactory.NameMemberCref(name, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, GetDiagnostics(), annotations);
internal NameMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var name = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var parameters = (CrefParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.parameters);
}
static NameMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NameMemberCrefSyntax), r => new NameMemberCrefSyntax(r));
}
}
/// <summary>
/// A MemberCrefSyntax specified by a this keyword and an optional parameter list.
/// For example, "this" or "this[int]".
/// </summary>
internal sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax
{
internal readonly SyntaxToken thisKeyword;
internal readonly CrefBracketedParameterListSyntax? parameters;
internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public SyntaxToken ThisKeyword => this.thisKeyword;
public CrefBracketedParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.thisKeyword,
1 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIndexerMemberCref(this);
public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax parameters)
{
if (thisKeyword != this.ThisKeyword || parameters != this.Parameters)
{
var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, GetDiagnostics(), annotations);
internal IndexerMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var thisKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(thisKeyword);
this.thisKeyword = thisKeyword;
var parameters = (CrefBracketedParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.thisKeyword);
writer.WriteValue(this.parameters);
}
static IndexerMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IndexerMemberCrefSyntax), r => new IndexerMemberCrefSyntax(r));
}
}
/// <summary>
/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list.
/// For example, "operator +" or "operator -[int]".
/// NOTE: the operator must be overloadable.
/// </summary>
internal sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax
{
internal readonly SyntaxToken operatorKeyword;
internal readonly SyntaxToken operatorToken;
internal readonly CrefParameterListSyntax? parameters;
internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public SyntaxToken OperatorKeyword => this.operatorKeyword;
/// <summary>Gets the operator token.</summary>
public SyntaxToken OperatorToken => this.operatorToken;
public CrefParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.operatorKeyword,
1 => this.operatorToken,
2 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitOperatorMemberCref(this);
public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax parameters)
{
if (operatorKeyword != this.OperatorKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters)
{
var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, operatorToken, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.operatorToken, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.operatorToken, this.parameters, GetDiagnostics(), annotations);
internal OperatorMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var operatorToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorToken);
this.operatorToken = operatorToken;
var parameters = (CrefParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.operatorToken);
writer.WriteValue(this.parameters);
}
static OperatorMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(OperatorMemberCrefSyntax), r => new OperatorMemberCrefSyntax(r));
}
}
/// <summary>
/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list.
/// For example, "implicit operator int" or "explicit operator MyType(int)".
/// </summary>
internal sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax
{
internal readonly SyntaxToken implicitOrExplicitKeyword;
internal readonly SyntaxToken operatorKeyword;
internal readonly TypeSyntax type;
internal readonly CrefParameterListSyntax? parameters;
internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
this.AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
this.AdjustFlagsAndWidth(type);
this.type = type;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword;
public SyntaxToken OperatorKeyword => this.operatorKeyword;
public TypeSyntax Type => this.type;
public CrefParameterListSyntax? Parameters => this.parameters;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.implicitOrExplicitKeyword,
1 => this.operatorKeyword,
2 => this.type,
3 => this.parameters,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorMemberCrefSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitConversionOperatorMemberCref(this);
public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax parameters)
{
if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || type != this.Type || parameters != this.Parameters)
{
var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, type, parameters);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.type, this.parameters, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.type, this.parameters, GetDiagnostics(), annotations);
internal ConversionOperatorMemberCrefSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(implicitOrExplicitKeyword);
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
var operatorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(operatorKeyword);
this.operatorKeyword = operatorKeyword;
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
var parameters = (CrefParameterListSyntax?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.implicitOrExplicitKeyword);
writer.WriteValue(this.operatorKeyword);
writer.WriteValue(this.type);
writer.WriteValue(this.parameters);
}
static ConversionOperatorMemberCrefSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorMemberCrefSyntax), r => new ConversionOperatorMemberCrefSyntax(r));
}
}
/// <summary>
/// A list of cref parameters with surrounding punctuation.
/// Unlike regular parameters, cref parameters do not have names.
/// </summary>
internal abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode
{
internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BaseCrefParameterListSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BaseCrefParameterListSyntax(ObjectReader reader)
: base(reader)
{
}
/// <summary>Gets the parameter list.</summary>
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> Parameters { get; }
}
/// <summary>
/// A parenthesized list of cref parameters.
/// </summary>
internal sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax
{
internal readonly SyntaxToken openParenToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeParenToken;
internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
/// <summary>Gets the open paren token.</summary>
public SyntaxToken OpenParenToken => this.openParenToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close paren token.</summary>
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.parameters,
2 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCrefParameterList(this);
public CrefParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations);
internal CrefParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeParenToken);
}
static CrefParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CrefParameterListSyntax), r => new CrefParameterListSyntax(r));
}
}
/// <summary>
/// A bracketed list of cref parameters.
/// </summary>
internal sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax
{
internal readonly SyntaxToken openBracketToken;
internal readonly GreenNode? parameters;
internal readonly SyntaxToken closeBracketToken;
internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
if (parameters != null)
{
this.AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
this.AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
/// <summary>Gets the open bracket token.</summary>
public SyntaxToken OpenBracketToken => this.openBracketToken;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.parameters));
/// <summary>Gets the close bracket token.</summary>
public SyntaxToken CloseBracketToken => this.closeBracketToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openBracketToken,
1 => this.parameters,
2 => this.closeBracketToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefBracketedParameterListSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCrefBracketedParameterList(this);
public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken)
{
var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations);
internal CrefBracketedParameterListSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var openBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openBracketToken);
this.openBracketToken = openBracketToken;
var parameters = (GreenNode?)reader.ReadValue();
if (parameters != null)
{
AdjustFlagsAndWidth(parameters);
this.parameters = parameters;
}
var closeBracketToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeBracketToken);
this.closeBracketToken = closeBracketToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openBracketToken);
writer.WriteValue(this.parameters);
writer.WriteValue(this.closeBracketToken);
}
static CrefBracketedParameterListSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CrefBracketedParameterListSyntax), r => new CrefBracketedParameterListSyntax(r));
}
}
/// <summary>
/// An element of a BaseCrefParameterListSyntax.
/// Unlike a regular parameter, a cref parameter has only an optional ref or out keyword and a type -
/// there is no name and there are no attributes or other modifiers.
/// </summary>
internal sealed partial class CrefParameterSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken? refKindKeyword;
internal readonly TypeSyntax type;
internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, TypeSyntax type, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, TypeSyntax type)
: base(kind)
{
this.SlotCount = 2;
if (refKindKeyword != null)
{
this.AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
this.AdjustFlagsAndWidth(type);
this.type = type;
}
public SyntaxToken? RefKindKeyword => this.refKindKeyword;
public TypeSyntax Type => this.type;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.refKindKeyword,
1 => this.type,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitCrefParameter(this);
public CrefParameterSyntax Update(SyntaxToken refKindKeyword, TypeSyntax type)
{
if (refKindKeyword != this.RefKindKeyword || type != this.Type)
{
var newNode = SyntaxFactory.CrefParameter(refKindKeyword, type);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.type, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.type, GetDiagnostics(), annotations);
internal CrefParameterSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var refKindKeyword = (SyntaxToken?)reader.ReadValue();
if (refKindKeyword != null)
{
AdjustFlagsAndWidth(refKindKeyword);
this.refKindKeyword = refKindKeyword;
}
var type = (TypeSyntax)reader.ReadValue();
AdjustFlagsAndWidth(type);
this.type = type;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.refKindKeyword);
writer.WriteValue(this.type);
}
static CrefParameterSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(CrefParameterSyntax), r => new CrefParameterSyntax(r));
}
}
internal abstract partial class XmlNodeSyntax : CSharpSyntaxNode
{
internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal XmlNodeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected XmlNodeSyntax(ObjectReader reader)
: base(reader)
{
}
}
internal sealed partial class XmlElementSyntax : XmlNodeSyntax
{
internal readonly XmlElementStartTagSyntax startTag;
internal readonly GreenNode? content;
internal readonly XmlElementEndTagSyntax endTag;
internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
public XmlElementStartTagSyntax StartTag => this.startTag;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax>(this.content);
public XmlElementEndTagSyntax EndTag => this.endTag;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.startTag,
1 => this.content,
2 => this.endTag,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlElement(this);
public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, XmlElementEndTagSyntax endTag)
{
if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag)
{
var newNode = SyntaxFactory.XmlElement(startTag, content, endTag);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, GetDiagnostics(), annotations);
internal XmlElementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var startTag = (XmlElementStartTagSyntax)reader.ReadValue();
AdjustFlagsAndWidth(startTag);
this.startTag = startTag;
var content = (GreenNode?)reader.ReadValue();
if (content != null)
{
AdjustFlagsAndWidth(content);
this.content = content;
}
var endTag = (XmlElementEndTagSyntax)reader.ReadValue();
AdjustFlagsAndWidth(endTag);
this.endTag = endTag;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.startTag);
writer.WriteValue(this.content);
writer.WriteValue(this.endTag);
}
static XmlElementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlElementSyntax), r => new XmlElementSyntax(r));
}
}
internal sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanToken;
internal readonly XmlNameSyntax name;
internal readonly GreenNode? attributes;
internal readonly SyntaxToken greaterThanToken;
internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
public SyntaxToken LessThanToken => this.lessThanToken;
public XmlNameSyntax Name => this.name;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax>(this.attributes);
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.name,
2 => this.attributes,
3 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementStartTagSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlElementStartTag(this);
public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken greaterThanToken)
{
if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, GetDiagnostics(), annotations);
internal XmlElementStartTagSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var attributes = (GreenNode?)reader.ReadValue();
if (attributes != null)
{
AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.name);
writer.WriteValue(this.attributes);
writer.WriteValue(this.greaterThanToken);
}
static XmlElementStartTagSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlElementStartTagSyntax), r => new XmlElementStartTagSyntax(r));
}
}
internal sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken lessThanSlashToken;
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken greaterThanToken;
internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
public SyntaxToken LessThanSlashToken => this.lessThanSlashToken;
public XmlNameSyntax Name => this.name;
public SyntaxToken GreaterThanToken => this.greaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanSlashToken,
1 => this.name,
2 => this.greaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementEndTagSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlElementEndTag(this);
public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
{
if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken)
{
var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, GetDiagnostics(), annotations);
internal XmlElementEndTagSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanSlashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanSlashToken);
this.lessThanSlashToken = lessThanSlashToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var greaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(greaterThanToken);
this.greaterThanToken = greaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanSlashToken);
writer.WriteValue(this.name);
writer.WriteValue(this.greaterThanToken);
}
static XmlElementEndTagSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlElementEndTagSyntax), r => new XmlElementEndTagSyntax(r));
}
}
internal sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken lessThanToken;
internal readonly XmlNameSyntax name;
internal readonly GreenNode? attributes;
internal readonly SyntaxToken slashGreaterThanToken;
internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (attributes != null)
{
this.AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
this.AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
public SyntaxToken LessThanToken => this.lessThanToken;
public XmlNameSyntax Name => this.name;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax>(this.attributes);
public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanToken,
1 => this.name,
2 => this.attributes,
3 => this.slashGreaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlEmptyElementSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlEmptyElement(this);
public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken slashGreaterThanToken)
{
if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken)
{
var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, GetDiagnostics(), annotations);
internal XmlEmptyElementSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var lessThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanToken);
this.lessThanToken = lessThanToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var attributes = (GreenNode?)reader.ReadValue();
if (attributes != null)
{
AdjustFlagsAndWidth(attributes);
this.attributes = attributes;
}
var slashGreaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(slashGreaterThanToken);
this.slashGreaterThanToken = slashGreaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanToken);
writer.WriteValue(this.name);
writer.WriteValue(this.attributes);
writer.WriteValue(this.slashGreaterThanToken);
}
static XmlEmptyElementSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlEmptyElementSyntax), r => new XmlEmptyElementSyntax(r));
}
}
internal sealed partial class XmlNameSyntax : CSharpSyntaxNode
{
internal readonly XmlPrefixSyntax? prefix;
internal readonly SyntaxToken localName;
internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
if (prefix != null)
{
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
this.AdjustFlagsAndWidth(localName);
this.localName = localName;
}
internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
if (prefix != null)
{
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
this.AdjustFlagsAndWidth(localName);
this.localName = localName;
}
internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName)
: base(kind)
{
this.SlotCount = 2;
if (prefix != null)
{
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
this.AdjustFlagsAndWidth(localName);
this.localName = localName;
}
public XmlPrefixSyntax? Prefix => this.prefix;
public SyntaxToken LocalName => this.localName;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.prefix,
1 => this.localName,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlName(this);
public XmlNameSyntax Update(XmlPrefixSyntax prefix, SyntaxToken localName)
{
if (prefix != this.Prefix || localName != this.LocalName)
{
var newNode = SyntaxFactory.XmlName(prefix, localName);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlNameSyntax(this.Kind, this.prefix, this.localName, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlNameSyntax(this.Kind, this.prefix, this.localName, GetDiagnostics(), annotations);
internal XmlNameSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var prefix = (XmlPrefixSyntax?)reader.ReadValue();
if (prefix != null)
{
AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
}
var localName = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(localName);
this.localName = localName;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.prefix);
writer.WriteValue(this.localName);
}
static XmlNameSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlNameSyntax), r => new XmlNameSyntax(r));
}
}
internal sealed partial class XmlPrefixSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken prefix;
internal readonly SyntaxToken colonToken;
internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 2;
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken)
: base(kind)
{
this.SlotCount = 2;
this.AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
public SyntaxToken Prefix => this.prefix;
public SyntaxToken ColonToken => this.colonToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.prefix,
1 => this.colonToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlPrefixSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlPrefix(this);
public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken)
{
if (prefix != this.Prefix || colonToken != this.ColonToken)
{
var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, GetDiagnostics(), annotations);
internal XmlPrefixSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 2;
var prefix = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(prefix);
this.prefix = prefix;
var colonToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.prefix);
writer.WriteValue(this.colonToken);
}
static XmlPrefixSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlPrefixSyntax), r => new XmlPrefixSyntax(r));
}
}
internal abstract partial class XmlAttributeSyntax : CSharpSyntaxNode
{
internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal XmlAttributeSyntax(SyntaxKind kind)
: base(kind)
{
}
protected XmlAttributeSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract XmlNameSyntax Name { get; }
public abstract SyntaxToken EqualsToken { get; }
public abstract SyntaxToken StartQuoteToken { get; }
public abstract SyntaxToken EndQuoteToken { get; }
}
internal sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax
{
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal readonly SyntaxToken startQuoteToken;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken endQuoteToken;
internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
public override XmlNameSyntax Name => this.name;
public override SyntaxToken EqualsToken => this.equalsToken;
public override SyntaxToken StartQuoteToken => this.startQuoteToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public override SyntaxToken EndQuoteToken => this.endQuoteToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
2 => this.startQuoteToken,
3 => this.textTokens,
4 => this.endQuoteToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextAttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlTextAttribute(this);
public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endQuoteToken)
{
if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken)
{
var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, GetDiagnostics(), annotations);
internal XmlTextAttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var startQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var endQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.startQuoteToken);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.endQuoteToken);
}
static XmlTextAttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlTextAttributeSyntax), r => new XmlTextAttributeSyntax(r));
}
}
internal sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax
{
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal readonly SyntaxToken startQuoteToken;
internal readonly CrefSyntax cref;
internal readonly SyntaxToken endQuoteToken;
internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(cref);
this.cref = cref;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(cref);
this.cref = cref;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(cref);
this.cref = cref;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
public override XmlNameSyntax Name => this.name;
public override SyntaxToken EqualsToken => this.equalsToken;
public override SyntaxToken StartQuoteToken => this.startQuoteToken;
public CrefSyntax Cref => this.cref;
public override SyntaxToken EndQuoteToken => this.endQuoteToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
2 => this.startQuoteToken,
3 => this.cref,
4 => this.endQuoteToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCrefAttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlCrefAttribute(this);
public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
{
if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken)
{
var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, GetDiagnostics(), annotations);
internal XmlCrefAttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var startQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
var cref = (CrefSyntax)reader.ReadValue();
AdjustFlagsAndWidth(cref);
this.cref = cref;
var endQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.startQuoteToken);
writer.WriteValue(this.cref);
writer.WriteValue(this.endQuoteToken);
}
static XmlCrefAttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlCrefAttributeSyntax), r => new XmlCrefAttributeSyntax(r));
}
}
internal sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax
{
internal readonly XmlNameSyntax name;
internal readonly SyntaxToken equalsToken;
internal readonly SyntaxToken startQuoteToken;
internal readonly IdentifierNameSyntax identifier;
internal readonly SyntaxToken endQuoteToken;
internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
this.AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
public override XmlNameSyntax Name => this.name;
public override SyntaxToken EqualsToken => this.equalsToken;
public override SyntaxToken StartQuoteToken => this.startQuoteToken;
public IdentifierNameSyntax Identifier => this.identifier;
public override SyntaxToken EndQuoteToken => this.endQuoteToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.name,
1 => this.equalsToken,
2 => this.startQuoteToken,
3 => this.identifier,
4 => this.endQuoteToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameAttributeSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlNameAttribute(this);
public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
{
if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken)
{
var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, GetDiagnostics(), annotations);
internal XmlNameAttributeSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var equalsToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(equalsToken);
this.equalsToken = equalsToken;
var startQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startQuoteToken);
this.startQuoteToken = startQuoteToken;
var identifier = (IdentifierNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var endQuoteToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endQuoteToken);
this.endQuoteToken = endQuoteToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.name);
writer.WriteValue(this.equalsToken);
writer.WriteValue(this.startQuoteToken);
writer.WriteValue(this.identifier);
writer.WriteValue(this.endQuoteToken);
}
static XmlNameAttributeSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlNameAttributeSyntax), r => new XmlNameAttributeSyntax(r));
}
}
internal sealed partial class XmlTextSyntax : XmlNodeSyntax
{
internal readonly GreenNode? textTokens;
internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 1;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 1;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens)
: base(kind)
{
this.SlotCount = 1;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
internal override GreenNode? GetSlot(int index)
=> index == 0 ? this.textTokens : null;
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlText(this);
public XmlTextSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens)
{
if (textTokens != this.TextTokens)
{
var newNode = SyntaxFactory.XmlText(textTokens);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlTextSyntax(this.Kind, this.textTokens, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlTextSyntax(this.Kind, this.textTokens, GetDiagnostics(), annotations);
internal XmlTextSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 1;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.textTokens);
}
static XmlTextSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlTextSyntax), r => new XmlTextSyntax(r));
}
}
internal sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken startCDataToken;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken endCDataToken;
internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
public SyntaxToken StartCDataToken => this.startCDataToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public SyntaxToken EndCDataToken => this.endCDataToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.startCDataToken,
1 => this.textTokens,
2 => this.endCDataToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCDataSectionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlCDataSection(this);
public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endCDataToken)
{
if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken)
{
var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, GetDiagnostics(), annotations);
internal XmlCDataSectionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var startCDataToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startCDataToken);
this.startCDataToken = startCDataToken;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var endCDataToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endCDataToken);
this.endCDataToken = endCDataToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.startCDataToken);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.endCDataToken);
}
static XmlCDataSectionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlCDataSectionSyntax), r => new XmlCDataSectionSyntax(r));
}
}
internal sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken startProcessingInstructionToken;
internal readonly XmlNameSyntax name;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken endProcessingInstructionToken;
internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
this.AdjustFlagsAndWidth(name);
this.name = name;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken;
public XmlNameSyntax Name => this.name;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.startProcessingInstructionToken,
1 => this.name,
2 => this.textTokens,
3 => this.endProcessingInstructionToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlProcessingInstructionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlProcessingInstruction(this);
public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endProcessingInstructionToken)
{
if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken)
{
var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, GetDiagnostics(), annotations);
internal XmlProcessingInstructionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var startProcessingInstructionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(startProcessingInstructionToken);
this.startProcessingInstructionToken = startProcessingInstructionToken;
var name = (XmlNameSyntax)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var endProcessingInstructionToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endProcessingInstructionToken);
this.endProcessingInstructionToken = endProcessingInstructionToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.startProcessingInstructionToken);
writer.WriteValue(this.name);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.endProcessingInstructionToken);
}
static XmlProcessingInstructionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlProcessingInstructionSyntax), r => new XmlProcessingInstructionSyntax(r));
}
}
internal sealed partial class XmlCommentSyntax : XmlNodeSyntax
{
internal readonly SyntaxToken lessThanExclamationMinusMinusToken;
internal readonly GreenNode? textTokens;
internal readonly SyntaxToken minusMinusGreaterThanToken;
internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
if (textTokens != null)
{
this.AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
this.AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken>(this.textTokens);
public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.lessThanExclamationMinusMinusToken,
1 => this.textTokens,
2 => this.minusMinusGreaterThanToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCommentSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitXmlComment(this);
public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken minusMinusGreaterThanToken)
{
if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken)
{
var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, GetDiagnostics(), annotations);
internal XmlCommentSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var lessThanExclamationMinusMinusToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken);
this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken;
var textTokens = (GreenNode?)reader.ReadValue();
if (textTokens != null)
{
AdjustFlagsAndWidth(textTokens);
this.textTokens = textTokens;
}
var minusMinusGreaterThanToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(minusMinusGreaterThanToken);
this.minusMinusGreaterThanToken = minusMinusGreaterThanToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.lessThanExclamationMinusMinusToken);
writer.WriteValue(this.textTokens);
writer.WriteValue(this.minusMinusGreaterThanToken);
}
static XmlCommentSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(XmlCommentSyntax), r => new XmlCommentSyntax(r));
}
}
internal abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax
{
internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.flags |= NodeFlags.ContainsDirectives;
}
internal DirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
this.flags |= NodeFlags.ContainsDirectives;
}
protected DirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.flags |= NodeFlags.ContainsDirectives;
}
public abstract SyntaxToken HashToken { get; }
public abstract SyntaxToken EndOfDirectiveToken { get; }
public abstract bool IsActive { get; }
}
internal abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal BranchingDirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
}
protected BranchingDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract bool BranchTaken { get; }
}
internal abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax
{
internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
}
protected ConditionalDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract ExpressionSyntax Condition { get; }
public abstract bool ConditionValue { get; }
}
internal sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken ifKeyword;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal readonly bool branchTaken;
internal readonly bool conditionValue;
internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken IfKeyword => this.ifKeyword;
public override ExpressionSyntax Condition => this.condition;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
public override bool BranchTaken => this.branchTaken;
public override bool ConditionValue => this.conditionValue;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.ifKeyword,
2 => this.condition,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIfDirectiveTrivia(this);
public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations);
internal IfDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var ifKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(ifKeyword);
this.ifKeyword = ifKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
this.branchTaken = (bool)reader.ReadBoolean();
this.conditionValue = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.ifKeyword);
writer.WriteValue(this.condition);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
writer.WriteBoolean(this.branchTaken);
writer.WriteBoolean(this.conditionValue);
}
static IfDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(IfDirectiveTriviaSyntax), r => new IfDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken elifKeyword;
internal readonly ExpressionSyntax condition;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal readonly bool branchTaken;
internal readonly bool conditionValue;
internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
this.AdjustFlagsAndWidth(condition);
this.condition = condition;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
this.conditionValue = conditionValue;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ElifKeyword => this.elifKeyword;
public override ExpressionSyntax Condition => this.condition;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
public override bool BranchTaken => this.branchTaken;
public override bool ConditionValue => this.conditionValue;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.elifKeyword,
2 => this.condition,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElifDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElifDirectiveTrivia(this);
public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations);
internal ElifDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var elifKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(elifKeyword);
this.elifKeyword = elifKeyword;
var condition = (ExpressionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(condition);
this.condition = condition;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
this.branchTaken = (bool)reader.ReadBoolean();
this.conditionValue = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.elifKeyword);
writer.WriteValue(this.condition);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
writer.WriteBoolean(this.branchTaken);
writer.WriteBoolean(this.conditionValue);
}
static ElifDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElifDirectiveTriviaSyntax), r => new ElifDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken elseKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal readonly bool branchTaken;
internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
}
internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
}
internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
this.branchTaken = branchTaken;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ElseKeyword => this.elseKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
public override bool BranchTaken => this.branchTaken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.elseKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitElseDirectiveTrivia(this);
public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
{
if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, GetDiagnostics(), annotations);
internal ElseDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var elseKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(elseKeyword);
this.elseKeyword = elseKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
this.branchTaken = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.elseKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
writer.WriteBoolean(this.branchTaken);
}
static ElseDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ElseDirectiveTriviaSyntax), r => new ElseDirectiveTriviaSyntax(r));
}
}
internal sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken endIfKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken EndIfKeyword => this.endIfKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.endIfKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndIfDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEndIfDirectiveTrivia(this);
public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal EndIfDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var endIfKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endIfKeyword);
this.endIfKeyword = endIfKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.endIfKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static EndIfDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EndIfDirectiveTriviaSyntax), r => new EndIfDirectiveTriviaSyntax(r));
}
}
internal sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken regionKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken RegionKeyword => this.regionKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.regionKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RegionDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitRegionDirectiveTrivia(this);
public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal RegionDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var regionKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(regionKeyword);
this.regionKeyword = regionKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.regionKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static RegionDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(RegionDirectiveTriviaSyntax), r => new RegionDirectiveTriviaSyntax(r));
}
}
internal sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken endRegionKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken EndRegionKeyword => this.endRegionKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.endRegionKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndRegionDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitEndRegionDirectiveTrivia(this);
public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal EndRegionDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var endRegionKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endRegionKeyword);
this.endRegionKeyword = endRegionKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.endRegionKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static EndRegionDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(EndRegionDirectiveTriviaSyntax), r => new EndRegionDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken errorKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ErrorKeyword => this.errorKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.errorKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ErrorDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitErrorDirectiveTrivia(this);
public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal ErrorDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var errorKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(errorKeyword);
this.errorKeyword = errorKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.errorKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static ErrorDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ErrorDirectiveTriviaSyntax), r => new ErrorDirectiveTriviaSyntax(r));
}
}
internal sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken warningKeyword;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken WarningKeyword => this.warningKeyword;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.warningKeyword,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WarningDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitWarningDirectiveTrivia(this);
public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal WarningDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var warningKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.warningKeyword);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static WarningDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(WarningDirectiveTriviaSyntax), r => new WarningDirectiveTriviaSyntax(r));
}
}
internal sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken identifier;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken Identifier => this.identifier;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.identifier,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BadDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitBadDirectiveTrivia(this);
public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal BadDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var identifier = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(identifier);
this.identifier = identifier;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.identifier);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static BadDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(BadDirectiveTriviaSyntax), r => new BadDirectiveTriviaSyntax(r));
}
}
internal sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken defineKeyword;
internal readonly SyntaxToken name;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken DefineKeyword => this.defineKeyword;
public SyntaxToken Name => this.name;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.defineKeyword,
2 => this.name,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefineDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitDefineDirectiveTrivia(this);
public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal DefineDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var defineKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(defineKeyword);
this.defineKeyword = defineKeyword;
var name = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.defineKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static DefineDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(DefineDirectiveTriviaSyntax), r => new DefineDirectiveTriviaSyntax(r));
}
}
internal sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken undefKeyword;
internal readonly SyntaxToken name;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
this.AdjustFlagsAndWidth(name);
this.name = name;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken UndefKeyword => this.undefKeyword;
public SyntaxToken Name => this.name;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.undefKeyword,
2 => this.name,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UndefDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitUndefDirectiveTrivia(this);
public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal UndefDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var undefKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(undefKeyword);
this.undefKeyword = undefKeyword;
var name = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(name);
this.name = name;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.undefKeyword);
writer.WriteValue(this.name);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static UndefDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(UndefDirectiveTriviaSyntax), r => new UndefDirectiveTriviaSyntax(r));
}
}
internal abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
}
internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind)
: base(kind)
{
}
protected LineOrSpanDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
}
public abstract SyntaxToken LineKeyword { get; }
public abstract SyntaxToken? File { get; }
}
internal sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken lineKeyword;
internal readonly SyntaxToken line;
internal readonly SyntaxToken? file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(line);
this.line = line;
if (file != null)
{
this.AdjustFlagsAndWidth(file);
this.file = file;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(line);
this.line = line;
if (file != null)
{
this.AdjustFlagsAndWidth(file);
this.file = file;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(line);
this.line = line;
if (file != null)
{
this.AdjustFlagsAndWidth(file);
this.file = file;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public override SyntaxToken LineKeyword => this.lineKeyword;
public SyntaxToken Line => this.line;
public override SyntaxToken? File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.lineKeyword,
2 => this.line,
3 => this.file,
4 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLineDirectiveTrivia(this);
public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal LineDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var lineKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
var line = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(line);
this.line = line;
var file = (SyntaxToken?)reader.ReadValue();
if (file != null)
{
AdjustFlagsAndWidth(file);
this.file = file;
}
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.lineKeyword);
writer.WriteValue(this.line);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static LineDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LineDirectiveTriviaSyntax), r => new LineDirectiveTriviaSyntax(r));
}
}
internal sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode
{
internal readonly SyntaxToken openParenToken;
internal readonly SyntaxToken line;
internal readonly SyntaxToken commaToken;
internal readonly SyntaxToken character;
internal readonly SyntaxToken closeParenToken;
internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(line);
this.line = line;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(character);
this.character = character;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(line);
this.line = line;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(character);
this.character = character;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
this.AdjustFlagsAndWidth(line);
this.line = line;
this.AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
this.AdjustFlagsAndWidth(character);
this.character = character;
this.AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
public SyntaxToken OpenParenToken => this.openParenToken;
public SyntaxToken Line => this.line;
public SyntaxToken CommaToken => this.commaToken;
public SyntaxToken Character => this.character;
public SyntaxToken CloseParenToken => this.closeParenToken;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.openParenToken,
1 => this.line,
2 => this.commaToken,
3 => this.character,
4 => this.closeParenToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectivePositionSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLineDirectivePosition(this);
public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
{
if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken)
{
var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, GetDiagnostics(), annotations);
internal LineDirectivePositionSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var openParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(openParenToken);
this.openParenToken = openParenToken;
var line = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(line);
this.line = line;
var commaToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(commaToken);
this.commaToken = commaToken;
var character = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(character);
this.character = character;
var closeParenToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(closeParenToken);
this.closeParenToken = closeParenToken;
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.openParenToken);
writer.WriteValue(this.line);
writer.WriteValue(this.commaToken);
writer.WriteValue(this.character);
writer.WriteValue(this.closeParenToken);
}
static LineDirectivePositionSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LineDirectivePositionSyntax), r => new LineDirectivePositionSyntax(r));
}
}
internal sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken lineKeyword;
internal readonly LineDirectivePositionSyntax start;
internal readonly SyntaxToken minusToken;
internal readonly LineDirectivePositionSyntax end;
internal readonly SyntaxToken? characterOffset;
internal readonly SyntaxToken file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 8;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(start);
this.start = start;
this.AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
this.AdjustFlagsAndWidth(end);
this.end = end;
if (characterOffset != null)
{
this.AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 8;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(start);
this.start = start;
this.AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
this.AdjustFlagsAndWidth(end);
this.end = end;
if (characterOffset != null)
{
this.AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 8;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
this.AdjustFlagsAndWidth(start);
this.start = start;
this.AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
this.AdjustFlagsAndWidth(end);
this.end = end;
if (characterOffset != null)
{
this.AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public override SyntaxToken LineKeyword => this.lineKeyword;
public LineDirectivePositionSyntax Start => this.start;
public SyntaxToken MinusToken => this.minusToken;
public LineDirectivePositionSyntax End => this.end;
public SyntaxToken? CharacterOffset => this.characterOffset;
public override SyntaxToken File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.lineKeyword,
2 => this.start,
3 => this.minusToken,
4 => this.end,
5 => this.characterOffset,
6 => this.file,
7 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineSpanDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLineSpanDirectiveTrivia(this);
public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal LineSpanDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 8;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var lineKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(lineKeyword);
this.lineKeyword = lineKeyword;
var start = (LineDirectivePositionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(start);
this.start = start;
var minusToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(minusToken);
this.minusToken = minusToken;
var end = (LineDirectivePositionSyntax)reader.ReadValue();
AdjustFlagsAndWidth(end);
this.end = end;
var characterOffset = (SyntaxToken?)reader.ReadValue();
if (characterOffset != null)
{
AdjustFlagsAndWidth(characterOffset);
this.characterOffset = characterOffset;
}
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.lineKeyword);
writer.WriteValue(this.start);
writer.WriteValue(this.minusToken);
writer.WriteValue(this.end);
writer.WriteValue(this.characterOffset);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static LineSpanDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LineSpanDirectiveTriviaSyntax), r => new LineSpanDirectiveTriviaSyntax(r));
}
}
internal sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken pragmaKeyword;
internal readonly SyntaxToken warningKeyword;
internal readonly SyntaxToken disableOrRestoreKeyword;
internal readonly GreenNode? errorCodes;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
if (errorCodes != null)
{
this.AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 6;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
if (errorCodes != null)
{
this.AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 6;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
this.AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
if (errorCodes != null)
{
this.AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken PragmaKeyword => this.pragmaKeyword;
public SyntaxToken WarningKeyword => this.warningKeyword;
public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword;
public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> ErrorCodes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax>(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CSharpSyntaxNode>(this.errorCodes));
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.pragmaKeyword,
2 => this.warningKeyword,
3 => this.disableOrRestoreKeyword,
4 => this.errorCodes,
5 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this);
public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal PragmaWarningDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 6;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var pragmaKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
var warningKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(warningKeyword);
this.warningKeyword = warningKeyword;
var disableOrRestoreKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(disableOrRestoreKeyword);
this.disableOrRestoreKeyword = disableOrRestoreKeyword;
var errorCodes = (GreenNode?)reader.ReadValue();
if (errorCodes != null)
{
AdjustFlagsAndWidth(errorCodes);
this.errorCodes = errorCodes;
}
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.pragmaKeyword);
writer.WriteValue(this.warningKeyword);
writer.WriteValue(this.disableOrRestoreKeyword);
writer.WriteValue(this.errorCodes);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static PragmaWarningDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PragmaWarningDirectiveTriviaSyntax), r => new PragmaWarningDirectiveTriviaSyntax(r));
}
}
internal sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken pragmaKeyword;
internal readonly SyntaxToken checksumKeyword;
internal readonly SyntaxToken file;
internal readonly SyntaxToken guid;
internal readonly SyntaxToken bytes;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 7;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(guid);
this.guid = guid;
this.AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 7;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(guid);
this.guid = guid;
this.AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 7;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
this.AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(guid);
this.guid = guid;
this.AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken PragmaKeyword => this.pragmaKeyword;
public SyntaxToken ChecksumKeyword => this.checksumKeyword;
public SyntaxToken File => this.file;
public SyntaxToken Guid => this.guid;
public SyntaxToken Bytes => this.bytes;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.pragmaKeyword,
2 => this.checksumKeyword,
3 => this.file,
4 => this.guid,
5 => this.bytes,
6 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this);
public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal PragmaChecksumDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 7;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var pragmaKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(pragmaKeyword);
this.pragmaKeyword = pragmaKeyword;
var checksumKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(checksumKeyword);
this.checksumKeyword = checksumKeyword;
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var guid = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(guid);
this.guid = guid;
var bytes = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(bytes);
this.bytes = bytes;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.pragmaKeyword);
writer.WriteValue(this.checksumKeyword);
writer.WriteValue(this.file);
writer.WriteValue(this.guid);
writer.WriteValue(this.bytes);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static PragmaChecksumDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PragmaChecksumDirectiveTriviaSyntax), r => new PragmaChecksumDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken referenceKeyword;
internal readonly SyntaxToken file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ReferenceKeyword => this.referenceKeyword;
public SyntaxToken File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.referenceKeyword,
2 => this.file,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReferenceDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitReferenceDirectiveTrivia(this);
public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal ReferenceDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var referenceKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(referenceKeyword);
this.referenceKeyword = referenceKeyword;
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.referenceKeyword);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static ReferenceDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ReferenceDirectiveTriviaSyntax), r => new ReferenceDirectiveTriviaSyntax(r));
}
}
internal sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken loadKeyword;
internal readonly SyntaxToken file;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
this.AdjustFlagsAndWidth(file);
this.file = file;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken LoadKeyword => this.loadKeyword;
public SyntaxToken File => this.file;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.loadKeyword,
2 => this.file,
3 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LoadDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitLoadDirectiveTrivia(this);
public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal LoadDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 4;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var loadKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(loadKeyword);
this.loadKeyword = loadKeyword;
var file = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(file);
this.file = file;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.loadKeyword);
writer.WriteValue(this.file);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static LoadDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(LoadDirectiveTriviaSyntax), r => new LoadDirectiveTriviaSyntax(r));
}
}
internal sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken exclamationToken;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ExclamationToken => this.exclamationToken;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.exclamationToken,
2 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ShebangDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitShebangDirectiveTrivia(this);
public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal ShebangDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 3;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var exclamationToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(exclamationToken);
this.exclamationToken = exclamationToken;
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.exclamationToken);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static ShebangDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(ShebangDirectiveTriviaSyntax), r => new ShebangDirectiveTriviaSyntax(r));
}
}
internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken nullableKeyword;
internal readonly SyntaxToken settingToken;
internal readonly SyntaxToken? targetToken;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;
internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
this.AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
if (targetToken != null)
{
this.AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
this.AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
if (targetToken != null)
{
this.AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 5;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
this.AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
if (targetToken != null)
{
this.AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}
public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken NullableKeyword => this.nullableKeyword;
public SyntaxToken SettingToken => this.settingToken;
public SyntaxToken? TargetToken => this.targetToken;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;
internal override GreenNode? GetSlot(int index)
=> index switch
{
0 => this.hashToken,
1 => this.nullableKeyword,
2 => this.settingToken,
3 => this.targetToken,
4 => this.endOfDirectiveToken,
_ => null,
};
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableDirectiveTriviaSyntax(this, parent, position);
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitNullableDirectiveTrivia(this);
public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations?.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
internal NullableDirectiveTriviaSyntax(ObjectReader reader)
: base(reader)
{
this.SlotCount = 5;
var hashToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
var nullableKeyword = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(nullableKeyword);
this.nullableKeyword = nullableKeyword;
var settingToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(settingToken);
this.settingToken = settingToken;
var targetToken = (SyntaxToken?)reader.ReadValue();
if (targetToken != null)
{
AdjustFlagsAndWidth(targetToken);
this.targetToken = targetToken;
}
var endOfDirectiveToken = (SyntaxToken)reader.ReadValue();
AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = (bool)reader.ReadBoolean();
}
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.hashToken);
writer.WriteValue(this.nullableKeyword);
writer.WriteValue(this.settingToken);
writer.WriteValue(this.targetToken);
writer.WriteValue(this.endOfDirectiveToken);
writer.WriteBoolean(this.isActive);
}
static NullableDirectiveTriviaSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(NullableDirectiveTriviaSyntax), r => new NullableDirectiveTriviaSyntax(r));
}
}
internal partial class CSharpSyntaxVisitor<TResult>
{
public virtual TResult VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBlock(BlockSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitParameter(ParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
}
internal partial class CSharpSyntaxVisitor
{
public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node);
public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node);
public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node);
public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node);
public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node);
public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node);
public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node);
public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node);
public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node);
public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node);
public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node);
public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node);
public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node);
public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node);
public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node);
public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node);
public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node);
public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node);
public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node);
public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node);
public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node);
public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node);
public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node);
public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node);
public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node);
public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node);
public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node);
public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node);
public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node);
public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node);
public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node);
public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node);
public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node);
public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node);
public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node);
public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
}
internal partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor<CSharpSyntaxNode>
{
public override CSharpSyntaxNode VisitIdentifierName(IdentifierNameSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
=> node.Update((NameSyntax)Visit(node.Left), (SyntaxToken)Visit(node.DotToken), (SimpleNameSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitGenericName(GenericNameSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier), (TypeArgumentListSyntax)Visit(node.TypeArgumentList));
public override CSharpSyntaxNode VisitTypeArgumentList(TypeArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitAliasQualifiedName(AliasQualifiedNameSyntax node)
=> node.Update((IdentifierNameSyntax)Visit(node.Alias), (SyntaxToken)Visit(node.ColonColonToken), (SimpleNameSyntax)Visit(node.Name));
public override CSharpSyntaxNode VisitPredefinedType(PredefinedTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword));
public override CSharpSyntaxNode VisitArrayType(ArrayTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.ElementType), VisitList(node.RankSpecifiers));
public override CSharpSyntaxNode VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Sizes), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitPointerType(PointerTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.AsteriskToken));
public override CSharpSyntaxNode VisitFunctionPointerType(FunctionPointerTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.DelegateKeyword), (SyntaxToken)Visit(node.AsteriskToken), (FunctionPointerCallingConventionSyntax)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax)Visit(node.ParameterList));
public override CSharpSyntaxNode VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node)
=> node.Update((SyntaxToken)Visit(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax)Visit(node.UnmanagedCallingConventionList));
public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.CallingConventions), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Name));
public override CSharpSyntaxNode VisitNullableType(NullableTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.QuestionToken));
public override CSharpSyntaxNode VisitTupleType(TupleTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitTupleElement(TupleElementSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node)
=> node.Update((SyntaxToken)Visit(node.OmittedTypeArgumentToken));
public override CSharpSyntaxNode VisitRefType(RefTypeSyntax node)
=> node.Update((SyntaxToken)Visit(node.RefKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitParenthesizedExpression(ParenthesizedExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitTupleExpression(TupleExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Operand));
public override CSharpSyntaxNode VisitAwaitExpression(AwaitExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.AwaitKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Operand), (SyntaxToken)Visit(node.OperatorToken));
public override CSharpSyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name));
public override CSharpSyntaxNode VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.WhenNotNull));
public override CSharpSyntaxNode VisitMemberBindingExpression(MemberBindingExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name));
public override CSharpSyntaxNode VisitElementBindingExpression(ElementBindingExpressionSyntax node)
=> node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitRangeExpression(RangeExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.LeftOperand), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.RightOperand));
public override CSharpSyntaxNode VisitImplicitElementAccess(ImplicitElementAccessSyntax node)
=> node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitAssignmentExpression(AssignmentExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitConditionalExpression(ConditionalExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.QuestionToken), (ExpressionSyntax)Visit(node.WhenTrue), (SyntaxToken)Visit(node.ColonToken), (ExpressionSyntax)Visit(node.WhenFalse));
public override CSharpSyntaxNode VisitThisExpression(ThisExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Token));
public override CSharpSyntaxNode VisitBaseExpression(BaseExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Token));
public override CSharpSyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Token));
public override CSharpSyntaxNode VisitMakeRefExpression(MakeRefExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitRefTypeExpression(RefTypeExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitRefValueExpression(RefValueExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.Comma), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitCheckedExpression(CheckedExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitTypeOfExpression(TypeOfExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitSizeOfExpression(SizeOfExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (ArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (BracketedArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitArgumentList(ArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitBracketedArgumentList(BracketedArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitArgument(ArgumentSyntax node)
=> node.Update((NameColonSyntax)Visit(node.NameColon), (SyntaxToken)Visit(node.RefKindKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitExpressionColon(ExpressionColonSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitNameColon(NameColonSyntax node)
=> node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitDeclarationExpression(DeclarationExpressionSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitCastExpression(CastExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node)
=> node.Update(VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody));
public override CSharpSyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax)Visit(node.Parameter), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody));
public override CSharpSyntaxNode VisitRefExpression(RefExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.RefKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ParameterListSyntax)Visit(node.ParameterList), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody));
public override CSharpSyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Expressions), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitWithExpression(WithExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.WithKeyword), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node)
=> node.Update((NameEqualsSyntax)Visit(node.NameEquals), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Initializers), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitArrayCreationExpression(ArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (ArrayTypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Commas), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (TypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (SyntaxToken)Visit(node.OpenBracketToken), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitQueryExpression(QueryExpressionSyntax node)
=> node.Update((FromClauseSyntax)Visit(node.FromClause), (QueryBodySyntax)Visit(node.Body));
public override CSharpSyntaxNode VisitQueryBody(QueryBodySyntax node)
=> node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax)Visit(node.SelectOrGroup), (QueryContinuationSyntax)Visit(node.Continuation));
public override CSharpSyntaxNode VisitFromClause(FromClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.FromKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitLetClause(LetClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.LetKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitJoinClause(JoinClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.JoinKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.InExpression), (SyntaxToken)Visit(node.OnKeyword), (ExpressionSyntax)Visit(node.LeftExpression), (SyntaxToken)Visit(node.EqualsKeyword), (ExpressionSyntax)Visit(node.RightExpression), (JoinIntoClauseSyntax)Visit(node.Into));
public override CSharpSyntaxNode VisitJoinIntoClause(JoinIntoClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitWhereClause(WhereClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhereKeyword), (ExpressionSyntax)Visit(node.Condition));
public override CSharpSyntaxNode VisitOrderByClause(OrderByClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.OrderByKeyword), VisitList(node.Orderings));
public override CSharpSyntaxNode VisitOrdering(OrderingSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.AscendingOrDescendingKeyword));
public override CSharpSyntaxNode VisitSelectClause(SelectClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.SelectKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitGroupClause(GroupClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.GroupKeyword), (ExpressionSyntax)Visit(node.GroupExpression), (SyntaxToken)Visit(node.ByKeyword), (ExpressionSyntax)Visit(node.ByExpression));
public override CSharpSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node)
=> node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier), (QueryBodySyntax)Visit(node.Body));
public override CSharpSyntaxNode VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OmittedArraySizeExpressionToken));
public override CSharpSyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StringStartToken), VisitList(node.Contents), (SyntaxToken)Visit(node.StringEndToken));
public override CSharpSyntaxNode VisitIsPatternExpression(IsPatternExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.IsKeyword), (PatternSyntax)Visit(node.Pattern));
public override CSharpSyntaxNode VisitThrowExpression(ThrowExpressionSyntax node)
=> node.Update((SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitWhenClause(WhenClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhenKeyword), (ExpressionSyntax)Visit(node.Condition));
public override CSharpSyntaxNode VisitDiscardPattern(DiscardPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.UnderscoreToken));
public override CSharpSyntaxNode VisitDeclarationPattern(DeclarationPatternSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitVarPattern(VarPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.VarKeyword), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitRecursivePattern(RecursivePatternSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (PositionalPatternClauseSyntax)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax)Visit(node.PropertyPatternClause), (VariableDesignationSyntax)Visit(node.Designation));
public override CSharpSyntaxNode VisitPositionalPatternClause(PositionalPatternClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitPropertyPatternClause(PropertyPatternClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitSubpattern(SubpatternSyntax node)
=> node.Update((BaseExpressionColonSyntax)Visit(node.ExpressionColon), (PatternSyntax)Visit(node.Pattern));
public override CSharpSyntaxNode VisitConstantPattern(ConstantPatternSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (PatternSyntax)Visit(node.Pattern), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitRelationalPattern(RelationalPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitTypePattern(TypePatternSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitBinaryPattern(BinaryPatternSyntax node)
=> node.Update((PatternSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Right));
public override CSharpSyntaxNode VisitUnaryPattern(UnaryPatternSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Pattern));
public override CSharpSyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node)
=> node.Update((SyntaxToken)Visit(node.TextToken));
public override CSharpSyntaxNode VisitInterpolation(InterpolationSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), (ExpressionSyntax)Visit(node.Expression), (InterpolationAlignmentClauseSyntax)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax)Visit(node.FormatClause), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.CommaToken), (ExpressionSyntax)Visit(node.Value));
public override CSharpSyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.FormatStringToken));
public override CSharpSyntaxNode VisitGlobalStatement(GlobalStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitBlock(BlockSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Statements), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitLocalFunctionStatement(LocalFunctionStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), VisitList(node.Variables));
public override CSharpSyntaxNode VisitVariableDeclarator(VariableDeclaratorSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier), (BracketedArgumentListSyntax)Visit(node.ArgumentList), (EqualsValueClauseSyntax)Visit(node.Initializer));
public override CSharpSyntaxNode VisitEqualsValueClause(EqualsValueClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Value));
public override CSharpSyntaxNode VisitSingleVariableDesignation(SingleVariableDesignationSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitDiscardDesignation(DiscardDesignationSyntax node)
=> node.Update((SyntaxToken)Visit(node.UnderscoreToken));
public override CSharpSyntaxNode VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Variables), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitExpressionStatement(ExpressionStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEmptyStatement(EmptyStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitLabeledStatement(LabeledStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitGotoStatement(GotoStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.GotoKeyword), (SyntaxToken)Visit(node.CaseOrDefaultKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitBreakStatement(BreakStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.BreakKeyword), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitContinueStatement(ContinueStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ContinueKeyword), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitReturnStatement(ReturnStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ReturnKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitThrowStatement(ThrowStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitYieldStatement(YieldStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.YieldKeyword), (SyntaxToken)Visit(node.ReturnOrBreakKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitWhileStatement(WhileStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitDoStatement(DoStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.DoKeyword), (StatementSyntax)Visit(node.Statement), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitForStatement(ForStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ForKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), VisitList(node.Initializers), (SyntaxToken)Visit(node.FirstSemicolonToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.SecondSemicolonToken), VisitList(node.Incrementors), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitForEachStatement(ForEachStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitForEachVariableStatement(ForEachVariableStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Variable), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitUsingStatement(UsingStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitFixedStatement(FixedStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.FixedKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitCheckedStatement(CheckedStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitUnsafeStatement(UnsafeStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.UnsafeKeyword), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitLockStatement(LockStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.LockKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitIfStatement(IfStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.IfKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement), (ElseClauseSyntax)Visit(node.Else));
public override CSharpSyntaxNode VisitElseClause(ElseClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.ElseKeyword), (StatementSyntax)Visit(node.Statement));
public override CSharpSyntaxNode VisitSwitchStatement(SwitchStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Sections), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitSwitchSection(SwitchSectionSyntax node)
=> node.Update(VisitList(node.Labels), VisitList(node.Statements));
public override CSharpSyntaxNode VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitCaseSwitchLabel(CaseSwitchLabelSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (ExpressionSyntax)Visit(node.Value), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node)
=> node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitSwitchExpression(SwitchExpressionSyntax node)
=> node.Update((ExpressionSyntax)Visit(node.GoverningExpression), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Arms), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitSwitchExpressionArm(SwitchExpressionArmSyntax node)
=> node.Update((PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.EqualsGreaterThanToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitTryStatement(TryStatementSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.TryKeyword), (BlockSyntax)Visit(node.Block), VisitList(node.Catches), (FinallyClauseSyntax)Visit(node.Finally));
public override CSharpSyntaxNode VisitCatchClause(CatchClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.CatchKeyword), (CatchDeclarationSyntax)Visit(node.Declaration), (CatchFilterClauseSyntax)Visit(node.Filter), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitCatchDeclaration(CatchDeclarationSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitCatchFilterClause(CatchFilterClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhenKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.FilterExpression), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitFinallyClause(FinallyClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.FinallyKeyword), (BlockSyntax)Visit(node.Block));
public override CSharpSyntaxNode VisitCompilationUnit(CompilationUnitSyntax node)
=> node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), (SyntaxToken)Visit(node.EndOfFileToken));
public override CSharpSyntaxNode VisitExternAliasDirective(ExternAliasDirectiveSyntax node)
=> node.Update((SyntaxToken)Visit(node.ExternKeyword), (SyntaxToken)Visit(node.AliasKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
=> node.Update((SyntaxToken)Visit(node.GlobalKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.StaticKeyword), (NameEqualsSyntax)Visit(node.Alias), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members));
public override CSharpSyntaxNode VisitAttributeList(AttributeListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), (AttributeTargetSpecifierSyntax)Visit(node.Target), VisitList(node.Attributes), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node)
=> node.Update((SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitAttribute(AttributeSyntax node)
=> node.Update((NameSyntax)Visit(node.Name), (AttributeArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitAttributeArgumentList(AttributeArgumentListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitAttributeArgument(AttributeArgumentSyntax node)
=> node.Update((NameEqualsSyntax)Visit(node.NameEquals), (NameColonSyntax)Visit(node.NameColon), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitNameEquals(NameEqualsSyntax node)
=> node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken));
public override CSharpSyntaxNode VisitTypeParameterList(TypeParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitTypeParameter(TypeParameterSyntax node)
=> node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.VarianceKeyword), (SyntaxToken)Visit(node.Identifier));
public override CSharpSyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EnumKeyword), (SyntaxToken)Visit(node.Identifier), (BaseListSyntax)Visit(node.BaseList), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.EqualsValue));
public override CSharpSyntaxNode VisitBaseList(BaseListSyntax node)
=> node.Update((SyntaxToken)Visit(node.ColonToken), VisitList(node.Types));
public override CSharpSyntaxNode VisitSimpleBaseType(SimpleBaseTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.WhereKeyword), (IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken), VisitList(node.Constraints));
public override CSharpSyntaxNode VisitConstructorConstraint(ConstructorConstraintSyntax node)
=> node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node)
=> node.Update((SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.QuestionToken));
public override CSharpSyntaxNode VisitTypeConstraint(TypeConstraintSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitDefaultConstraint(DefaultConstraintSyntax node)
=> node.Update((SyntaxToken)Visit(node.DefaultKeyword));
public override CSharpSyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node)
=> node.Update((NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.DotToken));
public override CSharpSyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.OperatorToken), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (TypeSyntax)Visit(node.Type), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitConstructorDeclaration(ConstructorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (ConstructorInitializerSyntax)Visit(node.Initializer), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitConstructorInitializer(ConstructorInitializerSyntax node)
=> node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.ThisOrBaseKeyword), (ArgumentListSyntax)Visit(node.ArgumentList));
public override CSharpSyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.TildeToken), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (EqualsValueClauseSyntax)Visit(node.Initializer), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitArrowExpressionClause(ArrowExpressionClauseSyntax node)
=> node.Update((SyntaxToken)Visit(node.ArrowToken), (ExpressionSyntax)Visit(node.Expression));
public override CSharpSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.ThisKeyword), (BracketedParameterListSyntax)Visit(node.ParameterList), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitAccessorList(AccessorListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Accessors), (SyntaxToken)Visit(node.CloseBraceToken));
public override CSharpSyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitParameterList(ParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitBracketedParameterList(BracketedParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitParameter(ParameterSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.Default));
public override CSharpSyntaxNode VisitFunctionPointerParameter(FunctionPointerParameterSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitIncompleteMember(IncompleteMemberSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node)
=> node.Update(VisitList(node.Tokens));
public override CSharpSyntaxNode VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node)
=> node.Update(VisitList(node.Content), (SyntaxToken)Visit(node.EndOfComment));
public override CSharpSyntaxNode VisitTypeCref(TypeCrefSyntax node)
=> node.Update((TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitQualifiedCref(QualifiedCrefSyntax node)
=> node.Update((TypeSyntax)Visit(node.Container), (SyntaxToken)Visit(node.DotToken), (MemberCrefSyntax)Visit(node.Member));
public override CSharpSyntaxNode VisitNameMemberCref(NameMemberCrefSyntax node)
=> node.Update((TypeSyntax)Visit(node.Name), (CrefParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitIndexerMemberCref(IndexerMemberCrefSyntax node)
=> node.Update((SyntaxToken)Visit(node.ThisKeyword), (CrefBracketedParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitOperatorMemberCref(OperatorMemberCrefSyntax node)
=> node.Update((SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.OperatorToken), (CrefParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node)
=> node.Update((SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (SyntaxToken)Visit(node.OperatorKeyword), (TypeSyntax)Visit(node.Type), (CrefParameterListSyntax)Visit(node.Parameters));
public override CSharpSyntaxNode VisitCrefParameterList(CrefParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken));
public override CSharpSyntaxNode VisitCrefParameter(CrefParameterSyntax node)
=> node.Update((SyntaxToken)Visit(node.RefKindKeyword), (TypeSyntax)Visit(node.Type));
public override CSharpSyntaxNode VisitXmlElement(XmlElementSyntax node)
=> node.Update((XmlElementStartTagSyntax)Visit(node.StartTag), VisitList(node.Content), (XmlElementEndTagSyntax)Visit(node.EndTag));
public override CSharpSyntaxNode VisitXmlElementStartTag(XmlElementStartTagSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitXmlElementEndTag(XmlElementEndTagSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanSlashToken), (XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.GreaterThanToken));
public override CSharpSyntaxNode VisitXmlEmptyElement(XmlEmptyElementSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.SlashGreaterThanToken));
public override CSharpSyntaxNode VisitXmlName(XmlNameSyntax node)
=> node.Update((XmlPrefixSyntax)Visit(node.Prefix), (SyntaxToken)Visit(node.LocalName));
public override CSharpSyntaxNode VisitXmlPrefix(XmlPrefixSyntax node)
=> node.Update((SyntaxToken)Visit(node.Prefix), (SyntaxToken)Visit(node.ColonToken));
public override CSharpSyntaxNode VisitXmlTextAttribute(XmlTextAttributeSyntax node)
=> node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndQuoteToken));
public override CSharpSyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node)
=> node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (CrefSyntax)Visit(node.Cref), (SyntaxToken)Visit(node.EndQuoteToken));
public override CSharpSyntaxNode VisitXmlNameAttribute(XmlNameAttributeSyntax node)
=> node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (IdentifierNameSyntax)Visit(node.Identifier), (SyntaxToken)Visit(node.EndQuoteToken));
public override CSharpSyntaxNode VisitXmlText(XmlTextSyntax node)
=> node.Update(VisitList(node.TextTokens));
public override CSharpSyntaxNode VisitXmlCDataSection(XmlCDataSectionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StartCDataToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndCDataToken));
public override CSharpSyntaxNode VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node)
=> node.Update((SyntaxToken)Visit(node.StartProcessingInstructionToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndProcessingInstructionToken));
public override CSharpSyntaxNode VisitXmlComment(XmlCommentSyntax node)
=> node.Update((SyntaxToken)Visit(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.MinusMinusGreaterThanToken));
public override CSharpSyntaxNode VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.IfKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue);
public override CSharpSyntaxNode VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElifKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue);
public override CSharpSyntaxNode VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElseKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken);
public override CSharpSyntaxNode VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndIfKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.RegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndRegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ErrorKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.DefineKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.UndefKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitLineDirectivePosition(LineDirectivePositionSyntax node)
=> node.Update((SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.CommaToken), (SyntaxToken)Visit(node.Character), (SyntaxToken)Visit(node.CloseParenToken));
public override CSharpSyntaxNode VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (LineDirectivePositionSyntax)Visit(node.Start), (SyntaxToken)Visit(node.MinusToken), (LineDirectivePositionSyntax)Visit(node.End), (SyntaxToken)Visit(node.CharacterOffset), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.ChecksumKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.Guid), (SyntaxToken)Visit(node.Bytes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ReferenceKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LoadKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
}
internal partial class ContextAwareSyntax
{
private SyntaxFactoryContext context;
public ContextAwareSyntax(SyntaxFactoryContext context)
=> this.context = context;
public IdentifierNameSyntax IdentifierName(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.GlobalKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash);
if (cached != null) return (IdentifierNameSyntax)cached;
var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
{
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash);
if (cached != null) return (QualifiedNameSyntax)cached;
var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash);
if (cached != null) return (GenericNameSyntax)cached;
var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash);
if (cached != null) return (TypeArgumentListSyntax)cached;
var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
{
#if DEBUG
if (alias == null) throw new ArgumentNullException(nameof(alias));
if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken));
if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash);
if (cached != null) return (AliasQualifiedNameSyntax)cached;
var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.BoolKeyword:
case SyntaxKind.ByteKeyword:
case SyntaxKind.SByteKeyword:
case SyntaxKind.IntKeyword:
case SyntaxKind.UIntKeyword:
case SyntaxKind.ShortKeyword:
case SyntaxKind.UShortKeyword:
case SyntaxKind.LongKeyword:
case SyntaxKind.ULongKeyword:
case SyntaxKind.FloatKeyword:
case SyntaxKind.DoubleKeyword:
case SyntaxKind.DecimalKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.CharKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.VoidKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash);
if (cached != null) return (PredefinedTypeSyntax)cached;
var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash);
if (cached != null) return (ArrayTypeSyntax)cached;
var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> sizes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (ArrayRankSpecifierSyntax)cached;
var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash);
if (cached != null) return (PointerTypeSyntax)cached;
var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
#endif
return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context);
}
public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash);
if (cached != null) return (FunctionPointerParameterListSyntax)cached;
var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList)
{
#if DEBUG
if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword));
switch (managedOrUnmanagedKeyword.Kind)
{
case SyntaxKind.ManagedKeyword:
case SyntaxKind.UnmanagedKeyword: break;
default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash);
if (cached != null) return (FunctionPointerCallingConventionSyntax)cached;
var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> callingConventions, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash);
if (cached != null) return (NullableTypeSyntax)cached;
var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> elements, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash);
if (cached != null) return (TupleTypeSyntax)cached;
var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash);
if (cached != null) return (TupleElementSyntax)cached;
var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken)
{
#if DEBUG
if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken));
if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash);
if (cached != null) return (OmittedTypeArgumentSyntax)cached;
var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (readOnlyKeyword != null)
{
switch (readOnlyKeyword.Kind)
{
case SyntaxKind.ReadOnlyKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(readOnlyKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash);
if (cached != null) return (RefTypeSyntax)cached;
var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash);
if (cached != null) return (ParenthesizedExpressionSyntax)cached;
var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash);
if (cached != null) return (TupleExpressionSyntax)cached;
var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand)
{
switch (kind)
{
case SyntaxKind.UnaryPlusExpression:
case SyntaxKind.UnaryMinusExpression:
case SyntaxKind.BitwiseNotExpression:
case SyntaxKind.LogicalNotExpression:
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.PreDecrementExpression:
case SyntaxKind.AddressOfExpression:
case SyntaxKind.PointerIndirectionExpression:
case SyntaxKind.IndexExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.CaretToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (operand == null) throw new ArgumentNullException(nameof(operand));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, this.context, out hash);
if (cached != null) return (PrefixUnaryExpressionSyntax)cached;
var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword));
if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash);
if (cached != null) return (AwaitExpressionSyntax)cached;
var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
{
switch (kind)
{
case SyntaxKind.PostIncrementExpression:
case SyntaxKind.PostDecrementExpression:
case SyntaxKind.SuppressNullableWarningExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operand == null) throw new ArgumentNullException(nameof(operand));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.ExclamationToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, this.context, out hash);
if (cached != null) return (PostfixUnaryExpressionSyntax)cached;
var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
{
switch (kind)
{
case SyntaxKind.SimpleMemberAccessExpression:
case SyntaxKind.PointerMemberAccessExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.DotToken:
case SyntaxKind.MinusGreaterThanToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, this.context, out hash);
if (cached != null) return (MemberAccessExpressionSyntax)cached;
var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken));
if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash);
if (cached != null) return (ConditionalAccessExpressionSyntax)cached;
var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash);
if (cached != null) return (MemberBindingExpressionSyntax)cached;
var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash);
if (cached != null) return (ElementBindingExpressionSyntax)cached;
var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash);
if (cached != null) return (RangeExpressionSyntax)cached;
var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash);
if (cached != null) return (ImplicitElementAccessSyntax)cached;
var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.AddExpression:
case SyntaxKind.SubtractExpression:
case SyntaxKind.MultiplyExpression:
case SyntaxKind.DivideExpression:
case SyntaxKind.ModuloExpression:
case SyntaxKind.LeftShiftExpression:
case SyntaxKind.RightShiftExpression:
case SyntaxKind.LogicalOrExpression:
case SyntaxKind.LogicalAndExpression:
case SyntaxKind.BitwiseOrExpression:
case SyntaxKind.BitwiseAndExpression:
case SyntaxKind.ExclusiveOrExpression:
case SyntaxKind.EqualsExpression:
case SyntaxKind.NotEqualsExpression:
case SyntaxKind.LessThanExpression:
case SyntaxKind.LessThanOrEqualExpression:
case SyntaxKind.GreaterThanExpression:
case SyntaxKind.GreaterThanOrEqualExpression:
case SyntaxKind.IsExpression:
case SyntaxKind.AsExpression:
case SyntaxKind.CoalesceExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarBarToken:
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.IsKeyword:
case SyntaxKind.AsKeyword:
case SyntaxKind.QuestionQuestionToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash);
if (cached != null) return (BinaryExpressionSyntax)cached;
var result = new BinaryExpressionSyntax(kind, left, operatorToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.SimpleAssignmentExpression:
case SyntaxKind.AddAssignmentExpression:
case SyntaxKind.SubtractAssignmentExpression:
case SyntaxKind.MultiplyAssignmentExpression:
case SyntaxKind.DivideAssignmentExpression:
case SyntaxKind.ModuloAssignmentExpression:
case SyntaxKind.AndAssignmentExpression:
case SyntaxKind.ExclusiveOrAssignmentExpression:
case SyntaxKind.OrAssignmentExpression:
case SyntaxKind.LeftShiftAssignmentExpression:
case SyntaxKind.RightShiftAssignmentExpression:
case SyntaxKind.CoalesceAssignmentExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash);
if (cached != null) return (AssignmentExpressionSyntax)cached;
var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
{
#if DEBUG
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse));
#endif
return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context);
}
public ThisExpressionSyntax ThisExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash);
if (cached != null) return (ThisExpressionSyntax)cached;
var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BaseExpressionSyntax BaseExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash);
if (cached != null) return (BaseExpressionSyntax)cached;
var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token)
{
switch (kind)
{
case SyntaxKind.ArgListExpression:
case SyntaxKind.NumericLiteralExpression:
case SyntaxKind.StringLiteralExpression:
case SyntaxKind.CharacterLiteralExpression:
case SyntaxKind.TrueLiteralExpression:
case SyntaxKind.FalseLiteralExpression:
case SyntaxKind.NullLiteralExpression:
case SyntaxKind.DefaultLiteralExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
switch (token.Kind)
{
case SyntaxKind.ArgListKeyword:
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.StringLiteralToken:
case SyntaxKind.CharacterLiteralToken:
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.DefaultKeyword: break;
default: throw new ArgumentException(nameof(token));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, token, this.context, out hash);
if (cached != null) return (LiteralExpressionSyntax)cached;
var result = new LiteralExpressionSyntax(kind, token, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context);
}
public RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context);
}
public RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (comma == null) throw new ArgumentNullException(nameof(comma));
if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context);
}
public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
switch (kind)
{
case SyntaxKind.CheckedExpression:
case SyntaxKind.UncheckedExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken, this.context);
}
public DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context);
}
public TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context);
}
public SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context);
}
public InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash);
if (cached != null) return (InvocationExpressionSyntax)cached;
var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash);
if (cached != null) return (ElementAccessExpressionSyntax)cached;
var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash);
if (cached != null) return (ArgumentListSyntax)cached;
var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (BracketedArgumentListSyntax)cached;
var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash);
if (cached != null) return (ArgumentSyntax)cached;
var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash);
if (cached != null) return (ExpressionColonSyntax)cached;
var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash);
if (cached != null) return (NameColonSyntax)cached;
var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash);
if (cached != null) return (DeclarationExpressionSyntax)cached;
var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context);
}
public AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context);
}
public SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameter == null) throw new ArgumentNullException(nameof(parameter));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context);
}
public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash);
if (cached != null) return (RefExpressionSyntax)cached;
var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context);
}
public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken)
{
switch (kind)
{
case SyntaxKind.ObjectInitializerExpression:
case SyntaxKind.CollectionInitializerExpression:
case SyntaxKind.ArrayInitializerExpression:
case SyntaxKind.ComplexElementInitializerExpression:
case SyntaxKind.WithInitializerExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, this.context, out hash);
if (cached != null) return (InitializerExpressionSyntax)cached;
var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash);
if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached;
var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context);
}
public WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword));
if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash);
if (cached != null) return (WithExpressionSyntax)cached;
var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash);
if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached;
var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers, SyntaxToken closeBraceToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context);
}
public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash);
if (cached != null) return (ArrayCreationExpressionSyntax)cached;
var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context);
}
public StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash);
if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached;
var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context);
}
public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body)
{
#if DEBUG
if (fromClause == null) throw new ArgumentNullException(nameof(fromClause));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash);
if (cached != null) return (QueryExpressionSyntax)cached;
var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
{
#if DEBUG
if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash);
if (cached != null) return (QueryBodySyntax)cached;
var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword));
if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context);
}
public LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
{
#if DEBUG
if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword));
if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context);
}
public JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into)
{
#if DEBUG
if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword));
if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (inExpression == null) throw new ArgumentNullException(nameof(inExpression));
if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword));
if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword));
if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression));
if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword));
if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword));
if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression));
#endif
return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context);
}
public JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash);
if (cached != null) return (JoinIntoClauseSyntax)cached;
var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash);
if (cached != null) return (WhereClauseSyntax)cached;
var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> orderings)
{
#if DEBUG
if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword));
if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash);
if (cached != null) return (OrderByClauseSyntax)cached;
var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword)
{
switch (kind)
{
case SyntaxKind.AscendingOrdering:
case SyntaxKind.DescendingOrdering: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (ascendingOrDescendingKeyword != null)
{
switch (ascendingOrDescendingKeyword.Kind)
{
case SyntaxKind.AscendingKeyword:
case SyntaxKind.DescendingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword));
}
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, this.context, out hash);
if (cached != null) return (OrderingSyntax)cached;
var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword));
if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash);
if (cached != null) return (SelectClauseSyntax)cached;
var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
{
#if DEBUG
if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword));
if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword));
if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression));
if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword));
if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword));
if (byExpression == null) throw new ArgumentNullException(nameof(byExpression));
#endif
return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context);
}
public QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash);
if (cached != null) return (QueryContinuationSyntax)cached;
var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken)
{
#if DEBUG
if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken));
if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash);
if (cached != null) return (OmittedArraySizeExpressionSyntax)cached;
var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken)
{
#if DEBUG
if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken));
switch (stringStartToken.Kind)
{
case SyntaxKind.InterpolatedStringStartToken:
case SyntaxKind.InterpolatedVerbatimStringStartToken: break;
default: throw new ArgumentException(nameof(stringStartToken));
}
if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken));
if (stringEndToken.Kind != SyntaxKind.InterpolatedStringEndToken) throw new ArgumentException(nameof(stringEndToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash);
if (cached != null) return (InterpolatedStringExpressionSyntax)cached;
var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword));
if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash);
if (cached != null) return (IsPatternExpressionSyntax)cached;
var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash);
if (cached != null) return (ThrowExpressionSyntax)cached;
var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash);
if (cached != null) return (WhenClauseSyntax)cached;
var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash);
if (cached != null) return (DiscardPatternSyntax)cached;
var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash);
if (cached != null) return (DeclarationPatternSyntax)cached;
var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation)
{
#if DEBUG
if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword));
if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash);
if (cached != null) return (VarPatternSyntax)cached;
var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation)
{
#if DEBUG
#endif
return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context);
}
public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash);
if (cached != null) return (PositionalPatternClauseSyntax)cached;
var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash);
if (cached != null) return (PropertyPatternClauseSyntax)cached;
var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash);
if (cached != null) return (SubpatternSyntax)cached;
var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash);
if (cached != null) return (ConstantPatternSyntax)cached;
var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash);
if (cached != null) return (ParenthesizedPatternSyntax)cached;
var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash);
if (cached != null) return (RelationalPatternSyntax)cached;
var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypePatternSyntax TypePattern(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash);
if (cached != null) return (TypePatternSyntax)cached;
var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
{
switch (kind)
{
case SyntaxKind.OrPattern:
case SyntaxKind.AndPattern: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.OrKeyword:
case SyntaxKind.AndKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash);
if (cached != null) return (BinaryPatternSyntax)cached;
var result = new BinaryPatternSyntax(kind, left, operatorToken, right, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash);
if (cached != null) return (UnaryPatternSyntax)cached;
var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken)
{
#if DEBUG
if (textToken == null) throw new ArgumentNullException(nameof(textToken));
if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash);
if (cached != null) return (InterpolatedStringTextSyntax)cached;
var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context);
}
public InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value)
{
#if DEBUG
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash);
if (cached != null) return (InterpolationAlignmentClauseSyntax)cached;
var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken));
if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash);
if (cached != null) return (InterpolationFormatClauseSyntax)cached;
var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, StatementSyntax statement)
{
#if DEBUG
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash);
if (cached != null) return (GlobalStatementSyntax)cached;
var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context);
}
public LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context);
}
public LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword != null)
{
switch (usingKeyword.Kind)
{
case SyntaxKind.UsingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(usingKeyword));
}
}
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context);
}
public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> variables)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash);
if (cached != null) return (VariableDeclarationSyntax)cached;
var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash);
if (cached != null) return (VariableDeclaratorSyntax)cached;
var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value)
{
#if DEBUG
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash);
if (cached != null) return (EqualsValueClauseSyntax)cached;
var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash);
if (cached != null) return (SingleVariableDesignationSyntax)cached;
var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash);
if (cached != null) return (DiscardDesignationSyntax)cached;
var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> variables, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash);
if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached;
var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash);
if (cached != null) return (ExpressionStatementSyntax)cached;
var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken semicolonToken)
{
#if DEBUG
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash);
if (cached != null) return (EmptyStatementSyntax)cached;
var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context);
}
public GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.GotoStatement:
case SyntaxKind.GotoCaseStatement:
case SyntaxKind.GotoDefaultStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword));
if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword));
if (caseOrDefaultKeyword != null)
{
switch (caseOrDefaultKeyword.Kind)
{
case SyntaxKind.CaseKeyword:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(caseOrDefaultKeyword));
}
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context);
}
public BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword));
if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash);
if (cached != null) return (BreakStatementSyntax)cached;
var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword));
if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash);
if (cached != null) return (ContinueStatementSyntax)cached;
var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword));
if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context);
}
public ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context);
}
public YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.YieldReturnStatement:
case SyntaxKind.YieldBreakStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword));
if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword));
if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword));
switch (returnOrBreakKeyword.Kind)
{
case SyntaxKind.ReturnKeyword:
case SyntaxKind.BreakKeyword: break;
default: throw new ArgumentException(nameof(returnOrBreakKeyword));
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context);
}
public WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context);
}
public DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
{
#if DEBUG
if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword));
if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context);
}
public ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword));
if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken));
if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken));
if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken));
if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context);
}
public ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context);
}
public ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (variable == null) throw new ArgumentNullException(nameof(variable));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context);
}
public UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context);
}
public FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword));
if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context);
}
public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block)
{
switch (kind)
{
case SyntaxKind.CheckedStatement:
case SyntaxKind.UncheckedStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, this.context, out hash);
if (cached != null) return (CheckedStatementSyntax)cached;
var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
{
#if DEBUG
if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword));
if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash);
if (cached != null) return (UnsafeStatementSyntax)cached;
var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword));
if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context);
}
public IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else)
{
#if DEBUG
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context);
}
public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement)
{
#if DEBUG
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash);
if (cached != null) return (ElseClauseSyntax)cached;
var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> sections, SyntaxToken closeBraceToken)
{
#if DEBUG
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openParenToken != null)
{
switch (openParenToken.Kind)
{
case SyntaxKind.OpenParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openParenToken));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken != null)
{
switch (closeParenToken.Kind)
{
case SyntaxKind.CloseParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeParenToken));
}
}
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context);
}
public SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements)
{
#if DEBUG
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash);
if (cached != null) return (SwitchSectionSyntax)cached;
var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context);
}
public CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (value == null) throw new ArgumentNullException(nameof(value));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash);
if (cached != null) return (CaseSwitchLabelSyntax)cached;
var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash);
if (cached != null) return (DefaultSwitchLabelSyntax)cached;
var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
#if DEBUG
if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression));
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context);
}
public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken));
if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context);
}
public TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> catches, FinallyClauseSyntax? @finally)
{
#if DEBUG
if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword));
if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context);
}
public CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block)
{
#if DEBUG
if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword));
if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context);
}
public CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context);
}
public CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context);
}
public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block)
{
#if DEBUG
if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword));
if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash);
if (cached != null) return (FinallyClauseSyntax)cached;
var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken endOfFileToken)
{
#if DEBUG
if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken));
if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken));
#endif
return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context);
}
public ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
{
#if DEBUG
if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword));
if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword));
if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword));
if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context);
}
public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken)
{
#if DEBUG
if (globalKeyword != null)
{
switch (globalKeyword.Kind)
{
case SyntaxKind.GlobalKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(globalKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, alias, name, semicolonToken, this.context);
}
public NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context);
}
public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context);
}
public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context);
}
public AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash);
if (cached != null) return (AttributeTargetSpecifierSyntax)cached;
var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, this.context, out hash);
if (cached != null) return (AttributeSyntax)cached;
var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash);
if (cached != null) return (AttributeArgumentListSyntax)cached;
var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash);
if (cached != null) return (AttributeArgumentSyntax)cached;
var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash);
if (cached != null) return (NameEqualsSyntax)cached;
var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash);
if (cached != null) return (TypeParameterListSyntax)cached;
var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier)
{
#if DEBUG
if (varianceKeyword != null)
{
switch (varianceKeyword.Kind)
{
case SyntaxKind.InKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(varianceKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash);
if (cached != null) return (TypeParameterSyntax)cached;
var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (classOrStructKeyword != null)
{
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken != null)
{
switch (openBraceToken.Kind)
{
case SyntaxKind.OpenBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openBraceToken));
}
}
if (closeBraceToken != null)
{
switch (closeBraceToken.Kind)
{
case SyntaxKind.CloseBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeBraceToken));
}
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword));
if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context);
}
public EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context);
}
public BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> types)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash);
if (cached != null) return (BaseListSyntax)cached;
var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash);
if (cached != null) return (SimpleBaseTypeSyntax)cached;
var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash);
if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached;
var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> constraints)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context);
}
public ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash);
if (cached != null) return (ConstructorConstraintSyntax)cached;
var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken)
{
switch (kind)
{
case SyntaxKind.ClassConstraint:
case SyntaxKind.StructConstraint: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword));
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
if (questionToken != null)
{
switch (questionToken.Kind)
{
case SyntaxKind.QuestionToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(questionToken));
}
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, this.context, out hash);
if (cached != null) return (ClassOrStructConstraintSyntax)cached;
var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public TypeConstraintSyntax TypeConstraint(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash);
if (cached != null) return (TypeConstraintSyntax)cached;
var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword)
{
#if DEBUG
if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword));
if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash);
if (cached != null) return (DefaultConstraintSyntax)cached;
var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context);
}
public EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context);
}
public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash);
if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached;
var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context);
}
public OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.IsKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context);
}
public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context);
}
public ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context);
}
public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
{
switch (kind)
{
case SyntaxKind.BaseConstructorInitializer:
case SyntaxKind.ThisConstructorInitializer: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword));
switch (thisOrBaseKeyword.Kind)
{
case SyntaxKind.BaseKeyword:
case SyntaxKind.ThisKeyword: break;
default: throw new ArgumentException(nameof(thisOrBaseKeyword));
}
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, this.context, out hash);
if (cached != null) return (ConstructorInitializerSyntax)cached;
var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken));
if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context);
}
public PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context);
}
public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression)
{
#if DEBUG
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash);
if (cached != null) return (ArrowExpressionClauseSyntax)cached;
var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context);
}
public IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context);
}
public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash);
if (cached != null) return (AccessorListSyntax)cached;
var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.GetAccessorDeclaration:
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.InitAccessorDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.UnknownAccessorDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.InitKeyword:
case SyntaxKind.AddKeyword:
case SyntaxKind.RemoveKeyword:
case SyntaxKind.IdentifierToken: break;
default: throw new ArgumentException(nameof(keyword));
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context);
}
public ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash);
if (cached != null) return (ParameterListSyntax)cached;
var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (BracketedParameterListSyntax)cached;
var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.ArgListKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context);
}
public FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash);
if (cached != null) return (FunctionPointerParameterSyntax)cached;
var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type)
{
#if DEBUG
#endif
return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context);
}
public SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> tokens)
{
#if DEBUG
#endif
return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context);
}
public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment)
{
switch (kind)
{
case SyntaxKind.SingleLineDocumentationCommentTrivia:
case SyntaxKind.MultiLineDocumentationCommentTrivia: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment));
if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment));
#endif
return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment, this.context);
}
public TypeCrefSyntax TypeCref(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash);
if (cached != null) return (TypeCrefSyntax)cached;
var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
{
#if DEBUG
if (container == null) throw new ArgumentNullException(nameof(container));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (member == null) throw new ArgumentNullException(nameof(member));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash);
if (cached != null) return (QualifiedCrefSyntax)cached;
var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash);
if (cached != null) return (NameMemberCrefSyntax)cached;
var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters)
{
#if DEBUG
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash);
if (cached != null) return (IndexerMemberCrefSyntax)cached;
var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters, this.context, out hash);
if (cached != null) return (OperatorMemberCrefSyntax)cached;
var result = new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, type, parameters, this.context);
}
public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash);
if (cached != null) return (CrefParameterListSyntax)cached;
var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash);
if (cached != null) return (CrefBracketedParameterListSyntax)cached;
var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, TypeSyntax type)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, type, this.context, out hash);
if (cached != null) return (CrefParameterSyntax)cached;
var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, type, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, XmlElementEndTagSyntax endTag)
{
#if DEBUG
if (startTag == null) throw new ArgumentNullException(nameof(startTag));
if (endTag == null) throw new ArgumentNullException(nameof(endTag));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash);
if (cached != null) return (XmlElementSyntax)cached;
var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context);
}
public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken));
if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash);
if (cached != null) return (XmlElementEndTagSyntax)cached;
var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken slashGreaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken));
if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken));
#endif
return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context);
}
public XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName)
{
#if DEBUG
if (localName == null) throw new ArgumentNullException(nameof(localName));
if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash);
if (cached != null) return (XmlNameSyntax)cached;
var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken)
{
#if DEBUG
if (prefix == null) throw new ArgumentNullException(nameof(prefix));
if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash);
if (cached != null) return (XmlPrefixSyntax)cached;
var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context);
}
public XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (cref == null) throw new ArgumentNullException(nameof(cref));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context);
}
public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context);
}
public XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens)
{
#if DEBUG
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash);
if (cached != null) return (XmlTextSyntax)cached;
var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endCDataToken)
{
#if DEBUG
if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken));
if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken));
if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken));
if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash);
if (cached != null) return (XmlCDataSectionSyntax)cached;
var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endProcessingInstructionToken)
{
#if DEBUG
if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken));
if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken));
if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken));
#endif
return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context);
}
public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken minusMinusGreaterThanToken)
{
#if DEBUG
if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken));
if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken));
if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken));
if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken));
#endif
int hash;
var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash);
if (cached != null) return (XmlCommentSyntax)cached;
var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context);
}
public ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword));
if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context);
}
public ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context);
}
public EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword));
if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context);
}
public RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword));
if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context);
}
public EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword));
if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context);
}
public ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword));
if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context);
}
public WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context);
}
public BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context);
}
public DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword));
if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context);
}
public UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword));
if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context);
}
public LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (line == null) throw new ArgumentNullException(nameof(line));
switch (line.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.HiddenKeyword: break;
default: throw new ArgumentException(nameof(line));
}
if (file != null)
{
switch (file.Kind)
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(file));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context);
}
public LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (line == null) throw new ArgumentNullException(nameof(line));
if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line));
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken));
if (character == null) throw new ArgumentNullException(nameof(character));
if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context);
}
public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (start == null) throw new ArgumentNullException(nameof(start));
if (minusToken == null) throw new ArgumentNullException(nameof(minusToken));
if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken));
if (end == null) throw new ArgumentNullException(nameof(end));
if (characterOffset != null)
{
switch (characterOffset.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(characterOffset));
}
}
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context);
}
public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword));
switch (disableOrRestoreKeyword.Kind)
{
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(disableOrRestoreKeyword));
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context);
}
public PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword));
if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (guid == null) throw new ArgumentNullException(nameof(guid));
if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid));
if (bytes == null) throw new ArgumentNullException(nameof(bytes));
if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context);
}
public ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword));
if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context);
}
public LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword));
if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context);
}
public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken));
if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context);
}
public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword));
if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword));
if (settingToken == null) throw new ArgumentNullException(nameof(settingToken));
switch (settingToken.Kind)
{
case SyntaxKind.EnableKeyword:
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(settingToken));
}
if (targetToken != null)
{
switch (targetToken.Kind)
{
case SyntaxKind.WarningsKeyword:
case SyntaxKind.AnnotationsKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(targetToken));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context);
}
}
internal static partial class SyntaxFactory
{
public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.GlobalKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash);
if (cached != null) return (IdentifierNameSyntax)cached;
var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
{
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash);
if (cached != null) return (QualifiedNameSyntax)cached;
var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash);
if (cached != null) return (GenericNameSyntax)cached;
var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash);
if (cached != null) return (TypeArgumentListSyntax)cached;
var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name)
{
#if DEBUG
if (alias == null) throw new ArgumentNullException(nameof(alias));
if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken));
if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash);
if (cached != null) return (AliasQualifiedNameSyntax)cached;
var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.BoolKeyword:
case SyntaxKind.ByteKeyword:
case SyntaxKind.SByteKeyword:
case SyntaxKind.IntKeyword:
case SyntaxKind.UIntKeyword:
case SyntaxKind.ShortKeyword:
case SyntaxKind.UShortKeyword:
case SyntaxKind.LongKeyword:
case SyntaxKind.ULongKeyword:
case SyntaxKind.FloatKeyword:
case SyntaxKind.DoubleKeyword:
case SyntaxKind.DecimalKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.CharKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.VoidKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash);
if (cached != null) return (PredefinedTypeSyntax)cached;
var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash);
if (cached != null) return (ArrayTypeSyntax)cached;
var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> sizes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash);
if (cached != null) return (ArrayRankSpecifierSyntax)cached;
var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash);
if (cached != null) return (PointerTypeSyntax)cached;
var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken));
if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
#endif
return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList);
}
public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash);
if (cached != null) return (FunctionPointerParameterListSyntax)cached;
var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList)
{
#if DEBUG
if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword));
switch (managedOrUnmanagedKeyword.Kind)
{
case SyntaxKind.ManagedKeyword:
case SyntaxKind.UnmanagedKeyword: break;
default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash);
if (cached != null) return (FunctionPointerCallingConventionSyntax)cached;
var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<FunctionPointerUnmanagedCallingConventionSyntax> callingConventions, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash);
if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached;
var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken)
{
#if DEBUG
if (elementType == null) throw new ArgumentNullException(nameof(elementType));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash);
if (cached != null) return (NullableTypeSyntax)cached;
var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TupleElementSyntax> elements, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash);
if (cached != null) return (TupleTypeSyntax)cached;
var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash);
if (cached != null) return (TupleElementSyntax)cached;
var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken)
{
#if DEBUG
if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken));
if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash);
if (cached != null) return (OmittedTypeArgumentSyntax)cached;
var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (readOnlyKeyword != null)
{
switch (readOnlyKeyword.Kind)
{
case SyntaxKind.ReadOnlyKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(readOnlyKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash);
if (cached != null) return (RefTypeSyntax)cached;
var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash);
if (cached != null) return (ParenthesizedExpressionSyntax)cached;
var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash);
if (cached != null) return (TupleExpressionSyntax)cached;
var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand)
{
switch (kind)
{
case SyntaxKind.UnaryPlusExpression:
case SyntaxKind.UnaryMinusExpression:
case SyntaxKind.BitwiseNotExpression:
case SyntaxKind.LogicalNotExpression:
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.PreDecrementExpression:
case SyntaxKind.AddressOfExpression:
case SyntaxKind.PointerIndirectionExpression:
case SyntaxKind.IndexExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.CaretToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (operand == null) throw new ArgumentNullException(nameof(operand));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, out hash);
if (cached != null) return (PrefixUnaryExpressionSyntax)cached;
var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword));
if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash);
if (cached != null) return (AwaitExpressionSyntax)cached;
var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
{
switch (kind)
{
case SyntaxKind.PostIncrementExpression:
case SyntaxKind.PostDecrementExpression:
case SyntaxKind.SuppressNullableWarningExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (operand == null) throw new ArgumentNullException(nameof(operand));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.ExclamationToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, out hash);
if (cached != null) return (PostfixUnaryExpressionSyntax)cached;
var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
{
switch (kind)
{
case SyntaxKind.SimpleMemberAccessExpression:
case SyntaxKind.PointerMemberAccessExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.DotToken:
case SyntaxKind.MinusGreaterThanToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, out hash);
if (cached != null) return (MemberAccessExpressionSyntax)cached;
var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken));
if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash);
if (cached != null) return (ConditionalAccessExpressionSyntax)cached;
var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken));
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash);
if (cached != null) return (MemberBindingExpressionSyntax)cached;
var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash);
if (cached != null) return (ElementBindingExpressionSyntax)cached;
var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash);
if (cached != null) return (RangeExpressionSyntax)cached;
var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash);
if (cached != null) return (ImplicitElementAccessSyntax)cached;
var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.AddExpression:
case SyntaxKind.SubtractExpression:
case SyntaxKind.MultiplyExpression:
case SyntaxKind.DivideExpression:
case SyntaxKind.ModuloExpression:
case SyntaxKind.LeftShiftExpression:
case SyntaxKind.RightShiftExpression:
case SyntaxKind.LogicalOrExpression:
case SyntaxKind.LogicalAndExpression:
case SyntaxKind.BitwiseOrExpression:
case SyntaxKind.BitwiseAndExpression:
case SyntaxKind.ExclusiveOrExpression:
case SyntaxKind.EqualsExpression:
case SyntaxKind.NotEqualsExpression:
case SyntaxKind.LessThanExpression:
case SyntaxKind.LessThanOrEqualExpression:
case SyntaxKind.GreaterThanExpression:
case SyntaxKind.GreaterThanOrEqualExpression:
case SyntaxKind.IsExpression:
case SyntaxKind.AsExpression:
case SyntaxKind.CoalesceExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarBarToken:
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.IsKeyword:
case SyntaxKind.AsKeyword:
case SyntaxKind.QuestionQuestionToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash);
if (cached != null) return (BinaryExpressionSyntax)cached;
var result = new BinaryExpressionSyntax(kind, left, operatorToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right)
{
switch (kind)
{
case SyntaxKind.SimpleAssignmentExpression:
case SyntaxKind.AddAssignmentExpression:
case SyntaxKind.SubtractAssignmentExpression:
case SyntaxKind.MultiplyAssignmentExpression:
case SyntaxKind.DivideAssignmentExpression:
case SyntaxKind.ModuloAssignmentExpression:
case SyntaxKind.AndAssignmentExpression:
case SyntaxKind.ExclusiveOrAssignmentExpression:
case SyntaxKind.OrAssignmentExpression:
case SyntaxKind.LeftShiftAssignmentExpression:
case SyntaxKind.RightShiftAssignmentExpression:
case SyntaxKind.CoalesceAssignmentExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.BarEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.QuestionQuestionEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash);
if (cached != null) return (AssignmentExpressionSyntax)cached;
var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse)
{
#if DEBUG
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (questionToken == null) throw new ArgumentNullException(nameof(questionToken));
if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken));
if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse));
#endif
return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse);
}
public static ThisExpressionSyntax ThisExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash);
if (cached != null) return (ThisExpressionSyntax)cached;
var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BaseExpressionSyntax BaseExpression(SyntaxToken token)
{
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash);
if (cached != null) return (BaseExpressionSyntax)cached;
var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token)
{
switch (kind)
{
case SyntaxKind.ArgListExpression:
case SyntaxKind.NumericLiteralExpression:
case SyntaxKind.StringLiteralExpression:
case SyntaxKind.CharacterLiteralExpression:
case SyntaxKind.TrueLiteralExpression:
case SyntaxKind.FalseLiteralExpression:
case SyntaxKind.NullLiteralExpression:
case SyntaxKind.DefaultLiteralExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (token == null) throw new ArgumentNullException(nameof(token));
switch (token.Kind)
{
case SyntaxKind.ArgListKeyword:
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.StringLiteralToken:
case SyntaxKind.CharacterLiteralToken:
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.DefaultKeyword: break;
default: throw new ArgumentException(nameof(token));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, token, out hash);
if (cached != null) return (LiteralExpressionSyntax)cached;
var result = new LiteralExpressionSyntax(kind, token);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken);
}
public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken);
}
public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (comma == null) throw new ArgumentNullException(nameof(comma));
if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken);
}
public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken)
{
switch (kind)
{
case SyntaxKind.CheckedExpression:
case SyntaxKind.UncheckedExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken);
}
public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken);
}
public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken);
}
public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken);
}
public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash);
if (cached != null) return (InvocationExpressionSyntax)cached;
var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash);
if (cached != null) return (ElementAccessExpressionSyntax)cached;
var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash);
if (cached != null) return (ArgumentListSyntax)cached;
var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ArgumentSyntax> arguments, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash);
if (cached != null) return (BracketedArgumentListSyntax)cached;
var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash);
if (cached != null) return (ArgumentSyntax)cached;
var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash);
if (cached != null) return (ExpressionColonSyntax)cached;
var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash);
if (cached != null) return (NameColonSyntax)cached;
var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash);
if (cached != null) return (DeclarationExpressionSyntax)cached;
var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression);
}
public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody);
}
public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameter == null) throw new ArgumentNullException(nameof(parameter));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody);
}
public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword));
if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash);
if (cached != null) return (RefExpressionSyntax)cached;
var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody)
{
#if DEBUG
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
#endif
return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody);
}
public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken)
{
switch (kind)
{
case SyntaxKind.ObjectInitializerExpression:
case SyntaxKind.CollectionInitializerExpression:
case SyntaxKind.ArrayInitializerExpression:
case SyntaxKind.ComplexElementInitializerExpression:
case SyntaxKind.WithInitializerExpression: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, out hash);
if (cached != null) return (InitializerExpressionSyntax)cached;
var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash);
if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached;
var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer);
}
public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword));
if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash);
if (cached != null) return (WithExpressionSyntax)cached;
var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash);
if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached;
var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers, SyntaxToken closeBraceToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken);
}
public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash);
if (cached != null) return (ArrayCreationExpressionSyntax)cached;
var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer);
}
public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash);
if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached;
var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer)
{
#if DEBUG
if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword));
if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword));
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
if (initializer == null) throw new ArgumentNullException(nameof(initializer));
#endif
return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer);
}
public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body)
{
#if DEBUG
if (fromClause == null) throw new ArgumentNullException(nameof(fromClause));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash);
if (cached != null) return (QueryExpressionSyntax)cached;
var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
{
#if DEBUG
if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash);
if (cached != null) return (QueryBodySyntax)cached;
var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword));
if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression);
}
public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
{
#if DEBUG
if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword));
if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression);
}
public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into)
{
#if DEBUG
if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword));
if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (inExpression == null) throw new ArgumentNullException(nameof(inExpression));
if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword));
if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword));
if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression));
if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword));
if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword));
if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression));
#endif
return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into);
}
public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash);
if (cached != null) return (JoinIntoClauseSyntax)cached;
var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash);
if (cached != null) return (WhereClauseSyntax)cached;
var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<OrderingSyntax> orderings)
{
#if DEBUG
if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword));
if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash);
if (cached != null) return (OrderByClauseSyntax)cached;
var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword)
{
switch (kind)
{
case SyntaxKind.AscendingOrdering:
case SyntaxKind.DescendingOrdering: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (ascendingOrDescendingKeyword != null)
{
switch (ascendingOrDescendingKeyword.Kind)
{
case SyntaxKind.AscendingKeyword:
case SyntaxKind.DescendingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword));
}
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, out hash);
if (cached != null) return (OrderingSyntax)cached;
var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword));
if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash);
if (cached != null) return (SelectClauseSyntax)cached;
var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
{
#if DEBUG
if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword));
if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword));
if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression));
if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword));
if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword));
if (byExpression == null) throw new ArgumentNullException(nameof(byExpression));
#endif
return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression);
}
public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body)
{
#if DEBUG
if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword));
if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (body == null) throw new ArgumentNullException(nameof(body));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash);
if (cached != null) return (QueryContinuationSyntax)cached;
var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken)
{
#if DEBUG
if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken));
if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash);
if (cached != null) return (OmittedArraySizeExpressionSyntax)cached;
var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<InterpolatedStringContentSyntax> contents, SyntaxToken stringEndToken)
{
#if DEBUG
if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken));
switch (stringStartToken.Kind)
{
case SyntaxKind.InterpolatedStringStartToken:
case SyntaxKind.InterpolatedVerbatimStringStartToken: break;
default: throw new ArgumentException(nameof(stringStartToken));
}
if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken));
if (stringEndToken.Kind != SyntaxKind.InterpolatedStringEndToken) throw new ArgumentException(nameof(stringEndToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash);
if (cached != null) return (InterpolatedStringExpressionSyntax)cached;
var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword));
if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash);
if (cached != null) return (IsPatternExpressionSyntax)cached;
var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash);
if (cached != null) return (ThrowExpressionSyntax)cached;
var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash);
if (cached != null) return (WhenClauseSyntax)cached;
var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash);
if (cached != null) return (DiscardPatternSyntax)cached;
var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash);
if (cached != null) return (DeclarationPatternSyntax)cached;
var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation)
{
#if DEBUG
if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword));
if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword));
if (designation == null) throw new ArgumentNullException(nameof(designation));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash);
if (cached != null) return (VarPatternSyntax)cached;
var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation)
{
#if DEBUG
#endif
return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation);
}
public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash);
if (cached != null) return (PositionalPatternClauseSyntax)cached;
var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash);
if (cached != null) return (PropertyPatternClauseSyntax)cached;
var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash);
if (cached != null) return (SubpatternSyntax)cached;
var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash);
if (cached != null) return (ConstantPatternSyntax)cached;
var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash);
if (cached != null) return (ParenthesizedPatternSyntax)cached;
var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash);
if (cached != null) return (RelationalPatternSyntax)cached;
var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypePatternSyntax TypePattern(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash);
if (cached != null) return (TypePatternSyntax)cached;
var result = new TypePatternSyntax(SyntaxKind.TypePattern, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right)
{
switch (kind)
{
case SyntaxKind.OrPattern:
case SyntaxKind.AndPattern: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (left == null) throw new ArgumentNullException(nameof(left));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.OrKeyword:
case SyntaxKind.AndKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (right == null) throw new ArgumentNullException(nameof(right));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash);
if (cached != null) return (BinaryPatternSyntax)cached;
var result = new BinaryPatternSyntax(kind, left, operatorToken, right);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern)
{
#if DEBUG
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash);
if (cached != null) return (UnaryPatternSyntax)cached;
var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken)
{
#if DEBUG
if (textToken == null) throw new ArgumentNullException(nameof(textToken));
if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash);
if (cached != null) return (InterpolatedStringTextSyntax)cached;
var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken);
}
public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value)
{
#if DEBUG
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash);
if (cached != null) return (InterpolationAlignmentClauseSyntax)cached;
var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken));
if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash);
if (cached != null) return (InterpolationFormatClauseSyntax)cached;
var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, StatementSyntax statement)
{
#if DEBUG
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash);
if (cached != null) return (GlobalStatementSyntax)cached;
var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken);
}
public static LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken);
}
public static LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword != null)
{
switch (usingKeyword.Kind)
{
case SyntaxKind.UsingKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(usingKeyword));
}
}
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken);
}
public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDeclaratorSyntax> variables)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash);
if (cached != null) return (VariableDeclarationSyntax)cached;
var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash);
if (cached != null) return (VariableDeclaratorSyntax)cached;
var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value)
{
#if DEBUG
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (value == null) throw new ArgumentNullException(nameof(value));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash);
if (cached != null) return (EqualsValueClauseSyntax)cached;
var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash);
if (cached != null) return (SingleVariableDesignationSyntax)cached;
var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken)
{
#if DEBUG
if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken));
if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash);
if (cached != null) return (DiscardDesignationSyntax)cached;
var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<VariableDesignationSyntax> variables, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash);
if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached;
var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash);
if (cached != null) return (ExpressionStatementSyntax)cached;
var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken semicolonToken)
{
#if DEBUG
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash);
if (cached != null) return (EmptyStatementSyntax)cached;
var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement);
}
public static GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.GotoStatement:
case SyntaxKind.GotoCaseStatement:
case SyntaxKind.GotoDefaultStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword));
if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword));
if (caseOrDefaultKeyword != null)
{
switch (caseOrDefaultKeyword.Kind)
{
case SyntaxKind.CaseKeyword:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(caseOrDefaultKeyword));
}
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken);
}
public static BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword));
if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash);
if (cached != null) return (BreakStatementSyntax)cached;
var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken)
{
#if DEBUG
if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword));
if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash);
if (cached != null) return (ContinueStatementSyntax)cached;
var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword));
if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken);
}
public static ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
#if DEBUG
if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword));
if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken);
}
public static YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken)
{
switch (kind)
{
case SyntaxKind.YieldReturnStatement:
case SyntaxKind.YieldBreakStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword));
if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword));
if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword));
switch (returnOrBreakKeyword.Kind)
{
case SyntaxKind.ReturnKeyword:
case SyntaxKind.BreakKeyword: break;
default: throw new ArgumentException(nameof(returnOrBreakKeyword));
}
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken);
}
public static WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement);
}
public static DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken)
{
#if DEBUG
if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword));
if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword));
if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken);
}
public static ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword));
if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken));
if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken));
if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken));
if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement);
}
public static ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement);
}
public static ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword));
if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (variable == null) throw new ArgumentNullException(nameof(variable));
if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword));
if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement);
}
public static UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (awaitKeyword != null)
{
switch (awaitKeyword.Kind)
{
case SyntaxKind.AwaitKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(awaitKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement);
}
public static FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword));
if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement);
}
public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block)
{
switch (kind)
{
case SyntaxKind.CheckedStatement:
case SyntaxKind.UncheckedStatement: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.CheckedKeyword:
case SyntaxKind.UncheckedKeyword: break;
default: throw new ArgumentException(nameof(keyword));
}
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, out hash);
if (cached != null) return (CheckedStatementSyntax)cached;
var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
{
#if DEBUG
if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword));
if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash);
if (cached != null) return (UnsafeStatementSyntax)cached;
var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
{
#if DEBUG
if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword));
if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement);
}
public static IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else)
{
#if DEBUG
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else);
}
public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement)
{
#if DEBUG
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (statement == null) throw new ArgumentNullException(nameof(statement));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash);
if (cached != null) return (ElseClauseSyntax)cached;
var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchSectionSyntax> sections, SyntaxToken closeBraceToken)
{
#if DEBUG
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openParenToken != null)
{
switch (openParenToken.Kind)
{
case SyntaxKind.OpenParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openParenToken));
}
}
if (expression == null) throw new ArgumentNullException(nameof(expression));
if (closeParenToken != null)
{
switch (closeParenToken.Kind)
{
case SyntaxKind.CloseParenToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeParenToken));
}
}
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken);
}
public static SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SwitchLabelSyntax> labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<StatementSyntax> statements)
{
#if DEBUG
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash);
if (cached != null) return (SwitchSectionSyntax)cached;
var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken);
}
public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword));
if (value == null) throw new ArgumentNullException(nameof(value));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash);
if (cached != null) return (CaseSwitchLabelSyntax)cached;
var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash);
if (cached != null) return (DefaultSwitchLabelSyntax)cached;
var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
#if DEBUG
if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression));
if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword));
if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken);
}
public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression)
{
#if DEBUG
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken));
if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression);
}
public static TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<CatchClauseSyntax> catches, FinallyClauseSyntax? @finally)
{
#if DEBUG
if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword));
if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally);
}
public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block)
{
#if DEBUG
if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword));
if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block);
}
public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier != null)
{
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(identifier));
}
}
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken);
}
public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken)
{
#if DEBUG
if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword));
if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken);
}
public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block)
{
#if DEBUG
if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword));
if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword));
if (block == null) throw new ArgumentNullException(nameof(block));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash);
if (cached != null) return (FinallyClauseSyntax)cached;
var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken endOfFileToken)
{
#if DEBUG
if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken));
if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken));
#endif
return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken);
}
public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken)
{
#if DEBUG
if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword));
if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword));
if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword));
if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken);
}
public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, NameEqualsSyntax? alias, NameSyntax name, SyntaxToken semicolonToken)
{
#if DEBUG
if (globalKeyword != null)
{
switch (globalKeyword.Kind)
{
case SyntaxKind.GlobalKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(globalKeyword));
}
}
if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword));
if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, alias, name, semicolonToken);
}
public static NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken);
}
public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<ExternAliasDirectiveSyntax> externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<UsingDirectiveSyntax> usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members)
{
#if DEBUG
if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword));
if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node);
}
public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken);
}
public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash);
if (cached != null) return (AttributeTargetSpecifierSyntax)cached;
var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, out hash);
if (cached != null) return (AttributeSyntax)cached;
var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<AttributeArgumentSyntax> arguments, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash);
if (cached != null) return (AttributeArgumentListSyntax)cached;
var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression)
{
#if DEBUG
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash);
if (cached != null) return (AttributeArgumentSyntax)cached;
var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash);
if (cached != null) return (NameEqualsSyntax)cached;
var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterSyntax> parameters, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash);
if (cached != null) return (TypeParameterListSyntax)cached;
var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier)
{
#if DEBUG
if (varianceKeyword != null)
{
switch (varianceKeyword.Kind)
{
case SyntaxKind.InKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(varianceKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash);
if (cached != null) return (TypeParameterSyntax)cached;
var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
if (classOrStructKeyword != null)
{
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken != null)
{
switch (openBraceToken.Kind)
{
case SyntaxKind.OpenBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(openBraceToken));
}
}
if (closeBraceToken != null)
{
switch (closeBraceToken.Kind)
{
case SyntaxKind.CloseBraceToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(closeBraceToken));
}
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<EnumMemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword));
if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken)
{
#if DEBUG
if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword));
if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword));
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken);
}
public static EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
#endif
return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue);
}
public static BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<BaseTypeSyntax> types)
{
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash);
if (cached != null) return (BaseListSyntax)cached;
var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash);
if (cached != null) return (SimpleBaseTypeSyntax)cached;
var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash);
if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached;
var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<TypeParameterConstraintSyntax> constraints)
{
#if DEBUG
if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword));
if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node);
}
public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken)
{
#if DEBUG
if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword));
if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword));
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash);
if (cached != null) return (ConstructorConstraintSyntax)cached;
var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken)
{
switch (kind)
{
case SyntaxKind.ClassConstraint:
case SyntaxKind.StructConstraint: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword));
switch (classOrStructKeyword.Kind)
{
case SyntaxKind.ClassKeyword:
case SyntaxKind.StructKeyword: break;
default: throw new ArgumentException(nameof(classOrStructKeyword));
}
if (questionToken != null)
{
switch (questionToken.Kind)
{
case SyntaxKind.QuestionToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(questionToken));
}
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, out hash);
if (cached != null) return (ClassOrStructConstraintSyntax)cached;
var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static TypeConstraintSyntax TypeConstraint(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash);
if (cached != null) return (TypeConstraintSyntax)cached;
var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword)
{
#if DEBUG
if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword));
if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash);
if (cached != null) return (DefaultConstraintSyntax)cached;
var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken);
}
public static EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (declaration == null) throw new ArgumentNullException(nameof(declaration));
if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken));
if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken));
#endif
return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken);
}
public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash);
if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached;
var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken);
}
public static OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (returnType == null) throw new ArgumentNullException(nameof(returnType));
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.IsKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken);
}
public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, type, parameterList, body, expressionBody, semicolonToken);
}
public static ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken);
}
public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList)
{
switch (kind)
{
case SyntaxKind.BaseConstructorInitializer:
case SyntaxKind.ThisConstructorInitializer: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword));
switch (thisOrBaseKeyword.Kind)
{
case SyntaxKind.BaseKeyword:
case SyntaxKind.ThisKeyword: break;
default: throw new ArgumentException(nameof(thisOrBaseKeyword));
}
if (argumentList == null) throw new ArgumentNullException(nameof(argumentList));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, out hash);
if (cached != null) return (ConstructorInitializerSyntax)cached;
var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken));
if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken);
}
public static PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken);
}
public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression)
{
#if DEBUG
if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken));
if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken));
if (expression == null) throw new ArgumentNullException(nameof(expression));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash);
if (cached != null) return (ArrowExpressionClauseSyntax)cached;
var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
{
#if DEBUG
if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword));
if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken);
}
public static IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
if (parameterList == null) throw new ArgumentNullException(nameof(parameterList));
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken);
}
public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
{
#if DEBUG
if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken));
if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken));
if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken));
if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash);
if (cached != null) return (AccessorListSyntax)cached;
var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
{
switch (kind)
{
case SyntaxKind.GetAccessorDeclaration:
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.InitAccessorDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.UnknownAccessorDeclaration: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
switch (keyword.Kind)
{
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.InitKeyword:
case SyntaxKind.AddKeyword:
case SyntaxKind.RemoveKeyword:
case SyntaxKind.IdentifierToken: break;
default: throw new ArgumentException(nameof(keyword));
}
if (semicolonToken != null)
{
switch (semicolonToken.Kind)
{
case SyntaxKind.SemicolonToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(semicolonToken));
}
}
#endif
return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken);
}
public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash);
if (cached != null) return (ParameterListSyntax)cached;
var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash);
if (cached != null) return (BracketedParameterListSyntax)cached;
var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default)
{
#if DEBUG
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
switch (identifier.Kind)
{
case SyntaxKind.IdentifierToken:
case SyntaxKind.ArgListKeyword: break;
default: throw new ArgumentException(nameof(identifier));
}
#endif
return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default);
}
public static FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash);
if (cached != null) return (FunctionPointerParameterSyntax)cached;
var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<AttributeListSyntax> attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> modifiers, TypeSyntax? type)
{
#if DEBUG
#endif
return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type);
}
public static SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> tokens)
{
#if DEBUG
#endif
return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node);
}
public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment)
{
switch (kind)
{
case SyntaxKind.SingleLineDocumentationCommentTrivia:
case SyntaxKind.MultiLineDocumentationCommentTrivia: break;
default: throw new ArgumentException(nameof(kind));
}
#if DEBUG
if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment));
if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment));
#endif
return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment);
}
public static TypeCrefSyntax TypeCref(TypeSyntax type)
{
#if DEBUG
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash);
if (cached != null) return (TypeCrefSyntax)cached;
var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member)
{
#if DEBUG
if (container == null) throw new ArgumentNullException(nameof(container));
if (dotToken == null) throw new ArgumentNullException(nameof(dotToken));
if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken));
if (member == null) throw new ArgumentNullException(nameof(member));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash);
if (cached != null) return (QualifiedCrefSyntax)cached;
var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash);
if (cached != null) return (NameMemberCrefSyntax)cached;
var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters)
{
#if DEBUG
if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword));
if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash);
if (cached != null) return (IndexerMemberCrefSyntax)cached;
var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken));
switch (operatorToken.Kind)
{
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.TildeToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.FalseKeyword:
case SyntaxKind.TrueKeyword: break;
default: throw new ArgumentException(nameof(operatorToken));
}
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters, out hash);
if (cached != null) return (OperatorMemberCrefSyntax)cached;
var result = new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, operatorToken, parameters);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
{
#if DEBUG
if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword));
switch (implicitOrExplicitKeyword.Kind)
{
case SyntaxKind.ImplicitKeyword:
case SyntaxKind.ExplicitKeyword: break;
default: throw new ArgumentException(nameof(implicitOrExplicitKeyword));
}
if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword));
if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword));
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, type, parameters);
}
public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash);
if (cached != null) return (CrefParameterListSyntax)cached;
var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<CrefParameterSyntax> parameters, SyntaxToken closeBracketToken)
{
#if DEBUG
if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken));
if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken));
if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken));
if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash);
if (cached != null) return (CrefBracketedParameterListSyntax)cached;
var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, TypeSyntax type)
{
#if DEBUG
if (refKindKeyword != null)
{
switch (refKindKeyword.Kind)
{
case SyntaxKind.RefKeyword:
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(refKindKeyword));
}
}
if (type == null) throw new ArgumentNullException(nameof(type));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, type, out hash);
if (cached != null) return (CrefParameterSyntax)cached;
var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, type);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlNodeSyntax> content, XmlElementEndTagSyntax endTag)
{
#if DEBUG
if (startTag == null) throw new ArgumentNullException(nameof(startTag));
if (endTag == null) throw new ArgumentNullException(nameof(endTag));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash);
if (cached != null) return (XmlElementSyntax)cached;
var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken);
}
public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken)
{
#if DEBUG
if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken));
if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken));
if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash);
if (cached != null) return (XmlElementEndTagSyntax)cached;
var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<XmlAttributeSyntax> attributes, SyntaxToken slashGreaterThanToken)
{
#if DEBUG
if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken));
if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken));
if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken));
#endif
return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken);
}
public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName)
{
#if DEBUG
if (localName == null) throw new ArgumentNullException(nameof(localName));
if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash);
if (cached != null) return (XmlNameSyntax)cached;
var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken)
{
#if DEBUG
if (prefix == null) throw new ArgumentNullException(nameof(prefix));
if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash);
if (cached != null) return (XmlPrefixSyntax)cached;
var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken);
}
public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (cref == null) throw new ArgumentNullException(nameof(cref));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken);
}
public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken)
{
#if DEBUG
if (name == null) throw new ArgumentNullException(nameof(name));
if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken));
if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken));
if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken));
switch (startQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(startQuoteToken));
}
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken));
switch (endQuoteToken.Kind)
{
case SyntaxKind.SingleQuoteToken:
case SyntaxKind.DoubleQuoteToken: break;
default: throw new ArgumentException(nameof(endQuoteToken));
}
#endif
return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken);
}
public static XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens)
{
#if DEBUG
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash);
if (cached != null) return (XmlTextSyntax)cached;
var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endCDataToken)
{
#if DEBUG
if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken));
if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken));
if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken));
if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash);
if (cached != null) return (XmlCDataSectionSyntax)cached;
var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken endProcessingInstructionToken)
{
#if DEBUG
if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken));
if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken));
if (name == null) throw new ArgumentNullException(nameof(name));
if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken));
if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken));
#endif
return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken);
}
public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<SyntaxToken> textTokens, SyntaxToken minusMinusGreaterThanToken)
{
#if DEBUG
if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken));
if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken));
if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken));
if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken));
#endif
int hash;
var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash);
if (cached != null) return (XmlCommentSyntax)cached;
var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken);
if (hash >= 0)
{
SyntaxNodeCache.AddNode(result, hash);
}
return result;
}
public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword));
if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
}
public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword));
if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword));
if (condition == null) throw new ArgumentNullException(nameof(condition));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue);
}
public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword));
if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken);
}
public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword));
if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive);
}
public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword));
if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive);
}
public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword));
if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive);
}
public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword));
if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive);
}
public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive);
}
public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive);
}
public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword));
if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive);
}
public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword));
if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive);
}
public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (line == null) throw new ArgumentNullException(nameof(line));
switch (line.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.HiddenKeyword: break;
default: throw new ArgumentException(nameof(line));
}
if (file != null)
{
switch (file.Kind)
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(file));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive);
}
public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken)
{
#if DEBUG
if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken));
if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken));
if (line == null) throw new ArgumentNullException(nameof(line));
if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line));
if (commaToken == null) throw new ArgumentNullException(nameof(commaToken));
if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken));
if (character == null) throw new ArgumentNullException(nameof(character));
if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character));
if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken));
if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken));
#endif
return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken);
}
public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword));
if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword));
if (start == null) throw new ArgumentNullException(nameof(start));
if (minusToken == null) throw new ArgumentNullException(nameof(minusToken));
if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken));
if (end == null) throw new ArgumentNullException(nameof(end));
if (characterOffset != null)
{
switch (characterOffset.Kind)
{
case SyntaxKind.NumericLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(characterOffset));
}
}
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive);
}
public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList<ExpressionSyntax> errorCodes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword));
if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword));
if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword));
switch (disableOrRestoreKeyword.Kind)
{
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(disableOrRestoreKeyword));
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive);
}
public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword));
if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword));
if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword));
if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (guid == null) throw new ArgumentNullException(nameof(guid));
if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid));
if (bytes == null) throw new ArgumentNullException(nameof(bytes));
if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive);
}
public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword));
if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive);
}
public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword));
if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword));
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive);
}
public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken));
if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken));
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive);
}
public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword));
if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword));
if (settingToken == null) throw new ArgumentNullException(nameof(settingToken));
switch (settingToken.Kind)
{
case SyntaxKind.EnableKeyword:
case SyntaxKind.DisableKeyword:
case SyntaxKind.RestoreKeyword: break;
default: throw new ArgumentException(nameof(settingToken));
}
if (targetToken != null)
{
switch (targetToken.Kind)
{
case SyntaxKind.WarningsKeyword:
case SyntaxKind.AnnotationsKeyword:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(targetToken));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif
return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
}
internal static IEnumerable<Type> GetNodeTypes()
=> new Type[]
{
typeof(IdentifierNameSyntax),
typeof(QualifiedNameSyntax),
typeof(GenericNameSyntax),
typeof(TypeArgumentListSyntax),
typeof(AliasQualifiedNameSyntax),
typeof(PredefinedTypeSyntax),
typeof(ArrayTypeSyntax),
typeof(ArrayRankSpecifierSyntax),
typeof(PointerTypeSyntax),
typeof(FunctionPointerTypeSyntax),
typeof(FunctionPointerParameterListSyntax),
typeof(FunctionPointerCallingConventionSyntax),
typeof(FunctionPointerUnmanagedCallingConventionListSyntax),
typeof(FunctionPointerUnmanagedCallingConventionSyntax),
typeof(NullableTypeSyntax),
typeof(TupleTypeSyntax),
typeof(TupleElementSyntax),
typeof(OmittedTypeArgumentSyntax),
typeof(RefTypeSyntax),
typeof(ParenthesizedExpressionSyntax),
typeof(TupleExpressionSyntax),
typeof(PrefixUnaryExpressionSyntax),
typeof(AwaitExpressionSyntax),
typeof(PostfixUnaryExpressionSyntax),
typeof(MemberAccessExpressionSyntax),
typeof(ConditionalAccessExpressionSyntax),
typeof(MemberBindingExpressionSyntax),
typeof(ElementBindingExpressionSyntax),
typeof(RangeExpressionSyntax),
typeof(ImplicitElementAccessSyntax),
typeof(BinaryExpressionSyntax),
typeof(AssignmentExpressionSyntax),
typeof(ConditionalExpressionSyntax),
typeof(ThisExpressionSyntax),
typeof(BaseExpressionSyntax),
typeof(LiteralExpressionSyntax),
typeof(MakeRefExpressionSyntax),
typeof(RefTypeExpressionSyntax),
typeof(RefValueExpressionSyntax),
typeof(CheckedExpressionSyntax),
typeof(DefaultExpressionSyntax),
typeof(TypeOfExpressionSyntax),
typeof(SizeOfExpressionSyntax),
typeof(InvocationExpressionSyntax),
typeof(ElementAccessExpressionSyntax),
typeof(ArgumentListSyntax),
typeof(BracketedArgumentListSyntax),
typeof(ArgumentSyntax),
typeof(ExpressionColonSyntax),
typeof(NameColonSyntax),
typeof(DeclarationExpressionSyntax),
typeof(CastExpressionSyntax),
typeof(AnonymousMethodExpressionSyntax),
typeof(SimpleLambdaExpressionSyntax),
typeof(RefExpressionSyntax),
typeof(ParenthesizedLambdaExpressionSyntax),
typeof(InitializerExpressionSyntax),
typeof(ImplicitObjectCreationExpressionSyntax),
typeof(ObjectCreationExpressionSyntax),
typeof(WithExpressionSyntax),
typeof(AnonymousObjectMemberDeclaratorSyntax),
typeof(AnonymousObjectCreationExpressionSyntax),
typeof(ArrayCreationExpressionSyntax),
typeof(ImplicitArrayCreationExpressionSyntax),
typeof(StackAllocArrayCreationExpressionSyntax),
typeof(ImplicitStackAllocArrayCreationExpressionSyntax),
typeof(QueryExpressionSyntax),
typeof(QueryBodySyntax),
typeof(FromClauseSyntax),
typeof(LetClauseSyntax),
typeof(JoinClauseSyntax),
typeof(JoinIntoClauseSyntax),
typeof(WhereClauseSyntax),
typeof(OrderByClauseSyntax),
typeof(OrderingSyntax),
typeof(SelectClauseSyntax),
typeof(GroupClauseSyntax),
typeof(QueryContinuationSyntax),
typeof(OmittedArraySizeExpressionSyntax),
typeof(InterpolatedStringExpressionSyntax),
typeof(IsPatternExpressionSyntax),
typeof(ThrowExpressionSyntax),
typeof(WhenClauseSyntax),
typeof(DiscardPatternSyntax),
typeof(DeclarationPatternSyntax),
typeof(VarPatternSyntax),
typeof(RecursivePatternSyntax),
typeof(PositionalPatternClauseSyntax),
typeof(PropertyPatternClauseSyntax),
typeof(SubpatternSyntax),
typeof(ConstantPatternSyntax),
typeof(ParenthesizedPatternSyntax),
typeof(RelationalPatternSyntax),
typeof(TypePatternSyntax),
typeof(BinaryPatternSyntax),
typeof(UnaryPatternSyntax),
typeof(InterpolatedStringTextSyntax),
typeof(InterpolationSyntax),
typeof(InterpolationAlignmentClauseSyntax),
typeof(InterpolationFormatClauseSyntax),
typeof(GlobalStatementSyntax),
typeof(BlockSyntax),
typeof(LocalFunctionStatementSyntax),
typeof(LocalDeclarationStatementSyntax),
typeof(VariableDeclarationSyntax),
typeof(VariableDeclaratorSyntax),
typeof(EqualsValueClauseSyntax),
typeof(SingleVariableDesignationSyntax),
typeof(DiscardDesignationSyntax),
typeof(ParenthesizedVariableDesignationSyntax),
typeof(ExpressionStatementSyntax),
typeof(EmptyStatementSyntax),
typeof(LabeledStatementSyntax),
typeof(GotoStatementSyntax),
typeof(BreakStatementSyntax),
typeof(ContinueStatementSyntax),
typeof(ReturnStatementSyntax),
typeof(ThrowStatementSyntax),
typeof(YieldStatementSyntax),
typeof(WhileStatementSyntax),
typeof(DoStatementSyntax),
typeof(ForStatementSyntax),
typeof(ForEachStatementSyntax),
typeof(ForEachVariableStatementSyntax),
typeof(UsingStatementSyntax),
typeof(FixedStatementSyntax),
typeof(CheckedStatementSyntax),
typeof(UnsafeStatementSyntax),
typeof(LockStatementSyntax),
typeof(IfStatementSyntax),
typeof(ElseClauseSyntax),
typeof(SwitchStatementSyntax),
typeof(SwitchSectionSyntax),
typeof(CasePatternSwitchLabelSyntax),
typeof(CaseSwitchLabelSyntax),
typeof(DefaultSwitchLabelSyntax),
typeof(SwitchExpressionSyntax),
typeof(SwitchExpressionArmSyntax),
typeof(TryStatementSyntax),
typeof(CatchClauseSyntax),
typeof(CatchDeclarationSyntax),
typeof(CatchFilterClauseSyntax),
typeof(FinallyClauseSyntax),
typeof(CompilationUnitSyntax),
typeof(ExternAliasDirectiveSyntax),
typeof(UsingDirectiveSyntax),
typeof(NamespaceDeclarationSyntax),
typeof(FileScopedNamespaceDeclarationSyntax),
typeof(AttributeListSyntax),
typeof(AttributeTargetSpecifierSyntax),
typeof(AttributeSyntax),
typeof(AttributeArgumentListSyntax),
typeof(AttributeArgumentSyntax),
typeof(NameEqualsSyntax),
typeof(TypeParameterListSyntax),
typeof(TypeParameterSyntax),
typeof(ClassDeclarationSyntax),
typeof(StructDeclarationSyntax),
typeof(InterfaceDeclarationSyntax),
typeof(RecordDeclarationSyntax),
typeof(EnumDeclarationSyntax),
typeof(DelegateDeclarationSyntax),
typeof(EnumMemberDeclarationSyntax),
typeof(BaseListSyntax),
typeof(SimpleBaseTypeSyntax),
typeof(PrimaryConstructorBaseTypeSyntax),
typeof(TypeParameterConstraintClauseSyntax),
typeof(ConstructorConstraintSyntax),
typeof(ClassOrStructConstraintSyntax),
typeof(TypeConstraintSyntax),
typeof(DefaultConstraintSyntax),
typeof(FieldDeclarationSyntax),
typeof(EventFieldDeclarationSyntax),
typeof(ExplicitInterfaceSpecifierSyntax),
typeof(MethodDeclarationSyntax),
typeof(OperatorDeclarationSyntax),
typeof(ConversionOperatorDeclarationSyntax),
typeof(ConstructorDeclarationSyntax),
typeof(ConstructorInitializerSyntax),
typeof(DestructorDeclarationSyntax),
typeof(PropertyDeclarationSyntax),
typeof(ArrowExpressionClauseSyntax),
typeof(EventDeclarationSyntax),
typeof(IndexerDeclarationSyntax),
typeof(AccessorListSyntax),
typeof(AccessorDeclarationSyntax),
typeof(ParameterListSyntax),
typeof(BracketedParameterListSyntax),
typeof(ParameterSyntax),
typeof(FunctionPointerParameterSyntax),
typeof(IncompleteMemberSyntax),
typeof(SkippedTokensTriviaSyntax),
typeof(DocumentationCommentTriviaSyntax),
typeof(TypeCrefSyntax),
typeof(QualifiedCrefSyntax),
typeof(NameMemberCrefSyntax),
typeof(IndexerMemberCrefSyntax),
typeof(OperatorMemberCrefSyntax),
typeof(ConversionOperatorMemberCrefSyntax),
typeof(CrefParameterListSyntax),
typeof(CrefBracketedParameterListSyntax),
typeof(CrefParameterSyntax),
typeof(XmlElementSyntax),
typeof(XmlElementStartTagSyntax),
typeof(XmlElementEndTagSyntax),
typeof(XmlEmptyElementSyntax),
typeof(XmlNameSyntax),
typeof(XmlPrefixSyntax),
typeof(XmlTextAttributeSyntax),
typeof(XmlCrefAttributeSyntax),
typeof(XmlNameAttributeSyntax),
typeof(XmlTextSyntax),
typeof(XmlCDataSectionSyntax),
typeof(XmlProcessingInstructionSyntax),
typeof(XmlCommentSyntax),
typeof(IfDirectiveTriviaSyntax),
typeof(ElifDirectiveTriviaSyntax),
typeof(ElseDirectiveTriviaSyntax),
typeof(EndIfDirectiveTriviaSyntax),
typeof(RegionDirectiveTriviaSyntax),
typeof(EndRegionDirectiveTriviaSyntax),
typeof(ErrorDirectiveTriviaSyntax),
typeof(WarningDirectiveTriviaSyntax),
typeof(BadDirectiveTriviaSyntax),
typeof(DefineDirectiveTriviaSyntax),
typeof(UndefDirectiveTriviaSyntax),
typeof(LineDirectiveTriviaSyntax),
typeof(LineDirectivePositionSyntax),
typeof(LineSpanDirectiveTriviaSyntax),
typeof(PragmaWarningDirectiveTriviaSyntax),
typeof(PragmaChecksumDirectiveTriviaSyntax),
typeof(ReferenceDirectiveTriviaSyntax),
typeof(LoadDirectiveTriviaSyntax),
typeof(ShebangDirectiveTriviaSyntax),
typeof(NullableDirectiveTriviaSyntax),
};
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/CSharpTest2/Recommendations/RecordKeywordRecommenderTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
public class RecordKeywordRecommenderTests : KeywordRecommenderTests
{
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAtRoot_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClass_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"class C { }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalStatement_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"System.Console.WriteLine();
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalVariableDeclaration_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"int i = 0;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInUsingAlias()
{
await VerifyAbsenceAsync(
@"using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInGlobalUsingAlias()
{
await VerifyAbsenceAsync(
@"global using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInEmptyStatement()
{
await VerifyAbsenceAsync(AddInsideMethod(
@"$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCompilationUnit()
{
await VerifyKeywordAsync(
@"$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterExtern()
{
await VerifyKeywordAsync(
@"extern alias Goo;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterUsing()
{
await VerifyKeywordAsync(
@"using Goo;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalUsing()
{
await VerifyKeywordAsync(
@"global using Goo;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNamespace()
{
await VerifyKeywordAsync(
@"namespace N {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterFileScopedNamespace()
{
await VerifyKeywordAsync(
@"namespace N;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterTypeDeclaration()
{
await VerifyKeywordAsync(
@"class C {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateDeclaration()
{
await VerifyKeywordAsync(
@"delegate void Goo();
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethod()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterField()
{
await VerifyKeywordAsync(
@"class C {
int i;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterProperty()
{
await VerifyKeywordAsync(
@"class C {
int i { get; }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeUsing()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"$$
using Goo;");
}
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/9880"), Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeUsing_Interactive()
{
await VerifyAbsenceAsync(SourceCodeKind.Script,
@"$$
using Goo;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeGlobalUsing()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"$$
global using Goo;");
}
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/9880"), Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeGlobalUsing_Interactive()
{
await VerifyAbsenceAsync(SourceCodeKind.Script,
@"$$
global using Goo;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterAssemblyAttribute()
{
await VerifyKeywordAsync(
@"[assembly: goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRootAttribute()
{
await VerifyKeywordAsync(
@"[goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedAttribute()
{
await VerifyKeywordAsync(
@"class C {
[goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideStruct()
{
await VerifyKeywordAsync(
@"struct S {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideInterface()
{
await VerifyKeywordAsync(@"interface I {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideClass()
{
await VerifyKeywordAsync(
@"class C {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideRecord1()
{
// The recommender doesn't work in record in script
// Tracked by https://github.com/dotnet/roslyn/issues/44865
await VerifyWorkerAsync(
@"record C {
$$", absent: false, options: TestOptions.RegularPreview);
}
[WorkItem(50783, "https://github.com/dotnet/roslyn/issues/50783")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideRecord2()
{
// The recommender doesn't work in record in script
// Tracked by https://github.com/dotnet/roslyn/issues/44865
await VerifyWorkerAsync(
@"record C {
public $$", absent: false, options: TestOptions.RegularPreview);
}
[WorkItem(50783, "https://github.com/dotnet/roslyn/issues/50783")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideRecord3()
{
// The recommender doesn't work in record in script
// Tracked by https://github.com/dotnet/roslyn/issues/44865
await VerifyWorkerAsync(
@"record C {
[X]
$$", absent: false, options: TestOptions.RegularPreview);
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPartial()
{
await VerifyKeywordAsync(
@"partial $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPublicRecord()
{
await VerifyAbsenceAsync(
@"public record $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterAbstract()
{
await VerifyKeywordAsync(
@"abstract $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterInternal()
{
await VerifyKeywordAsync(
@"internal $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterStaticPublic()
{
await VerifyKeywordAsync(
@"static public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPublicStatic()
{
await VerifyKeywordAsync(
@"public static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterInvalidPublic()
=> await VerifyAbsenceAsync(@"virtual public $$");
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPublic()
{
await VerifyKeywordAsync(
@"public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPrivate()
{
await VerifyKeywordAsync(
@"private $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterProtected()
{
await VerifyKeywordAsync(
@"protected $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterSealed()
{
await VerifyKeywordAsync(
@"sealed $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterStatic()
{
await VerifyKeywordAsync(
@"static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterStaticInUsingDirective()
{
await VerifyAbsenceAsync(
@"using static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterStaticInGlobalUsingDirective()
{
await VerifyAbsenceAsync(
@"global using static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterClass()
=> await VerifyAbsenceAsync(@"class $$");
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(32214, "https://github.com/dotnet/roslyn/issues/32214")]
public async Task TestNotBetweenUsings()
{
// Recommendation in scripting is not stable. See https://github.com/dotnet/roslyn/issues/32214
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"using Goo;
$$
using Bar;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(32214, "https://github.com/dotnet/roslyn/issues/32214")]
public async Task TestNotBetweenGlobalUsings_01()
{
// Recommendation in scripting is not stable. See https://github.com/dotnet/roslyn/issues/32214
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"global using Goo;
$$
using Bar;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(32214, "https://github.com/dotnet/roslyn/issues/32214")]
public async Task TestNotBetweenGlobalUsings_02()
{
// Recommendation in scripting is not stable. See https://github.com/dotnet/roslyn/issues/32214
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"global using Goo;
$$
global using Bar;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClassTypeParameterConstraint()
{
await VerifyAbsenceAsync(
@"class C<T> where T : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClassTypeParameterConstraint2()
{
await VerifyAbsenceAsync(
@"class C<T>
where T : $$
where U : U");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodTypeParameterConstraint()
{
await VerifyAbsenceAsync(
@"class C {
void Goo<T>()
where T : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodTypeParameterConstraint2()
{
await VerifyAbsenceAsync(
@"class C {
void Goo<T>()
where T : $$
where U : T");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNew()
{
await VerifyKeywordAsync(
@"class C {
new $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterReadonly()
{
// readonly record struct is allowed.
await VerifyKeywordAsync("readonly $$");
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
public class RecordKeywordRecommenderTests : KeywordRecommenderTests
{
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAtRoot_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClass_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"class C { }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalStatement_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"System.Console.WriteLine();
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalVariableDeclaration_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"int i = 0;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInUsingAlias()
{
await VerifyAbsenceAsync(
@"using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInGlobalUsingAlias()
{
await VerifyAbsenceAsync(
@"global using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInEmptyStatement()
{
await VerifyAbsenceAsync(AddInsideMethod(
@"$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCompilationUnit()
{
await VerifyKeywordAsync(
@"$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterExtern()
{
await VerifyKeywordAsync(
@"extern alias Goo;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterUsing()
{
await VerifyKeywordAsync(
@"using Goo;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalUsing()
{
await VerifyKeywordAsync(
@"global using Goo;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNamespace()
{
await VerifyKeywordAsync(
@"namespace N {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterFileScopedNamespace()
{
await VerifyKeywordAsync(
@"namespace N;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterTypeDeclaration()
{
await VerifyKeywordAsync(
@"class C {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateDeclaration()
{
await VerifyKeywordAsync(
@"delegate void Goo();
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethod()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterField()
{
await VerifyKeywordAsync(
@"class C {
int i;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterProperty()
{
await VerifyKeywordAsync(
@"class C {
int i { get; }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeUsing()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"$$
using Goo;");
}
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/9880"), Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeUsing_Interactive()
{
await VerifyAbsenceAsync(SourceCodeKind.Script,
@"$$
using Goo;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeGlobalUsing()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"$$
global using Goo;");
}
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/9880"), Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotBeforeGlobalUsing_Interactive()
{
await VerifyAbsenceAsync(SourceCodeKind.Script,
@"$$
global using Goo;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterAssemblyAttribute()
{
await VerifyKeywordAsync(
@"[assembly: goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRootAttribute()
{
await VerifyKeywordAsync(
@"[goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedAttribute()
{
await VerifyKeywordAsync(
@"class C {
[goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideStruct()
{
await VerifyKeywordAsync(
@"struct S {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideInterface()
{
await VerifyKeywordAsync(@"interface I {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideClass()
{
await VerifyKeywordAsync(
@"class C {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideRecord1()
{
// The recommender doesn't work in record in script
// Tracked by https://github.com/dotnet/roslyn/issues/44865
await VerifyWorkerAsync(
@"record C {
$$", absent: false, options: TestOptions.RegularPreview);
}
[WorkItem(50783, "https://github.com/dotnet/roslyn/issues/50783")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideRecord2()
{
// The recommender doesn't work in record in script
// Tracked by https://github.com/dotnet/roslyn/issues/44865
await VerifyWorkerAsync(
@"record C {
public $$", absent: false, options: TestOptions.RegularPreview);
}
[WorkItem(50783, "https://github.com/dotnet/roslyn/issues/50783")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideRecord3()
{
// The recommender doesn't work in record in script
// Tracked by https://github.com/dotnet/roslyn/issues/44865
await VerifyWorkerAsync(
@"record C {
[X]
$$", absent: false, options: TestOptions.RegularPreview);
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPartial()
{
await VerifyKeywordAsync(
@"partial $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPublicRecord()
{
await VerifyAbsenceAsync(
@"public record $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterAbstract()
{
await VerifyKeywordAsync(
@"abstract $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterInternal()
{
await VerifyKeywordAsync(
@"internal $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterStaticPublic()
{
await VerifyKeywordAsync(
@"static public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPublicStatic()
{
await VerifyKeywordAsync(
@"public static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterInvalidPublic()
=> await VerifyAbsenceAsync(@"virtual public $$");
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPublic()
{
await VerifyKeywordAsync(
@"public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPrivate()
{
await VerifyKeywordAsync(
@"private $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterProtected()
{
await VerifyKeywordAsync(
@"protected $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterSealed()
{
await VerifyKeywordAsync(
@"sealed $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterStatic()
{
await VerifyKeywordAsync(
@"static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterStaticInUsingDirective()
{
await VerifyAbsenceAsync(
@"using static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterStaticInGlobalUsingDirective()
{
await VerifyAbsenceAsync(
@"global using static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterClass()
=> await VerifyAbsenceAsync(@"class $$");
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(32214, "https://github.com/dotnet/roslyn/issues/32214")]
public async Task TestNotBetweenUsings()
{
// Recommendation in scripting is not stable. See https://github.com/dotnet/roslyn/issues/32214
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"using Goo;
$$
using Bar;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(32214, "https://github.com/dotnet/roslyn/issues/32214")]
public async Task TestNotBetweenGlobalUsings_01()
{
// Recommendation in scripting is not stable. See https://github.com/dotnet/roslyn/issues/32214
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"global using Goo;
$$
using Bar;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(32214, "https://github.com/dotnet/roslyn/issues/32214")]
public async Task TestNotBetweenGlobalUsings_02()
{
// Recommendation in scripting is not stable. See https://github.com/dotnet/roslyn/issues/32214
await VerifyAbsenceAsync(SourceCodeKind.Regular,
@"global using Goo;
$$
global using Bar;");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClassTypeParameterConstraint()
{
await VerifyAbsenceAsync(
@"class C<T> where T : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClassTypeParameterConstraint2()
{
await VerifyAbsenceAsync(
@"class C<T>
where T : $$
where U : U");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodTypeParameterConstraint()
{
await VerifyAbsenceAsync(
@"class C {
void Goo<T>()
where T : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodTypeParameterConstraint2()
{
await VerifyAbsenceAsync(
@"class C {
void Goo<T>()
where T : $$
where U : T");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNew()
{
await VerifyKeywordAsync(
@"class C {
new $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterReadonly()
{
// readonly record struct is allowed.
await VerifyKeywordAsync("readonly $$");
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/CSharp/Test/Semantic/Semantics/StructConstructorTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics
{
public class StructConstructorTests : CSharpTestBase
{
[CombinatorialData]
[Theory]
public void PublicParameterlessConstructor(bool useCompilationReference)
{
var sourceA =
@"public struct S<T>
{
public readonly bool Initialized;
public S() { Initialized = true; }
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (4,12): error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
// public S() { Initialized = true; }
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "S").WithArguments("parameterless struct constructors", "10.0").WithLocation(4, 12));
comp = CreateCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"using System;
class Program
{
static T CreateNew<T>() where T : new() => new T();
static T CreateStruct<T>() where T : struct => new T();
static void Main()
{
Console.WriteLine(new S<int>().Initialized);
Console.WriteLine(CreateNew<S<int>>().Initialized);
Console.WriteLine(CreateStruct<S<int>>().Initialized);
Console.WriteLine(CreateStruct<S<string>>().Initialized);
Console.WriteLine(CreateNew<S<string>>().Initialized);
Console.WriteLine(new S<string>().Initialized);
}
}";
bool secondCall = ExecutionConditionUtil.IsCoreClr; // .NET Framework ignores constructor in second call to Activator.CreateInstance<T>().
CompileAndVerify(sourceB, references: new[] { refA }, expectedOutput:
$@"True
True
{secondCall}
True
{secondCall}
True");
}
[Fact]
public void NonPublicParameterlessConstructor_01()
{
var source =
@"public struct A0 { public A0() { } }
public struct A1 { internal A1() { } }
public struct A2 { private A2() { } }
public struct A3 { A3() { } }
internal struct B0 { public B0() { } }
internal struct B1 { internal B1() { } }
internal struct B2 { private B2() { } }
internal struct B3 { B3() { } }
public class C
{
internal protected struct C0 { public C0() { } }
internal protected struct C1 { internal C1() { } }
internal protected struct C2 { private C2() { } }
internal protected struct C3 { C3() { } }
protected struct D0 { public D0() { } }
protected struct D1 { internal D1() { } }
protected struct D2 { private D2() { } }
protected struct D3 { D3() { } }
private protected struct E0 { public E0() { } }
private protected struct E1 { internal E1() { } }
private protected struct E2 { private E2() { } }
private protected struct E3 { E3() { } }
private struct F0 { public F0() { } }
private struct F1 { internal F1() { } }
private struct F2 { private F2() { } }
private struct F3 { F3() { } }
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (2,29): error CS8938: The parameterless struct constructor must be 'public'.
// public struct A1 { internal A1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "A1").WithLocation(2, 29),
// (3,28): error CS8938: The parameterless struct constructor must be 'public'.
// public struct A2 { private A2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "A2").WithLocation(3, 28),
// (4,20): error CS8938: The parameterless struct constructor must be 'public'.
// public struct A3 { A3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "A3").WithLocation(4, 20),
// (7,31): error CS8938: The parameterless struct constructor must be 'public'.
// internal struct B1 { internal B1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "B1").WithLocation(7, 31),
// (8,30): error CS8938: The parameterless struct constructor must be 'public'.
// internal struct B2 { private B2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "B2").WithLocation(8, 30),
// (9,22): error CS8938: The parameterless struct constructor must be 'public'.
// internal struct B3 { B3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "B3").WithLocation(9, 22),
// (14,45): error CS8938: The parameterless struct constructor must be 'public'.
// internal protected struct C1 { internal C1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "C1").WithLocation(14, 45),
// (15,44): error CS8938: The parameterless struct constructor must be 'public'.
// internal protected struct C2 { private C2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "C2").WithLocation(15, 44),
// (16,36): error CS8938: The parameterless struct constructor must be 'public'.
// internal protected struct C3 { C3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "C3").WithLocation(16, 36),
// (19,36): error CS8938: The parameterless struct constructor must be 'public'.
// protected struct D1 { internal D1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "D1").WithLocation(19, 36),
// (20,35): error CS8938: The parameterless struct constructor must be 'public'.
// protected struct D2 { private D2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "D2").WithLocation(20, 35),
// (21,27): error CS8938: The parameterless struct constructor must be 'public'.
// protected struct D3 { D3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "D3").WithLocation(21, 27),
// (24,44): error CS8938: The parameterless struct constructor must be 'public'.
// private protected struct E1 { internal E1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "E1").WithLocation(24, 44),
// (25,43): error CS8938: The parameterless struct constructor must be 'public'.
// private protected struct E2 { private E2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "E2").WithLocation(25, 43),
// (26,35): error CS8938: The parameterless struct constructor must be 'public'.
// private protected struct E3 { E3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "E3").WithLocation(26, 35),
// (29,34): error CS8938: The parameterless struct constructor must be 'public'.
// private struct F1 { internal F1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "F1").WithLocation(29, 34),
// (30,33): error CS8938: The parameterless struct constructor must be 'public'.
// private struct F2 { private F2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "F2").WithLocation(30, 33),
// (31,25): error CS8938: The parameterless struct constructor must be 'public'.
// private struct F3 { F3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "F3").WithLocation(31, 25));
}
[InlineData("assembly")]
[InlineData("private")]
[Theory]
public void NonPublicParameterlessConstructor_02(string accessibility)
{
var sourceA =
$@".class public sealed S extends [mscorlib]System.ValueType
{{
.method {accessibility} hidebysig specialname rtspecialname instance void .ctor() cil managed {{ ret }}
}}";
var refA = CompileIL(sourceA);
var sourceB =
@"using System;
class Program
{
static T CreateNew<T>() where T : new() => new T();
static T CreateStruct1<T>() where T : struct => new T();
static T CreateStruct2<T>() where T : struct => CreateNew<T>();
static string Invoke(Func<object> f)
{
object obj;
try
{
obj = f();
}
catch (Exception e)
{
obj = e;
}
return obj.GetType().FullName;
}
static void Main()
{
Console.WriteLine(Invoke(() => new S()));
Console.WriteLine(Invoke(() => CreateNew<S>()));
Console.WriteLine(Invoke(() => CreateStruct1<S>()));
Console.WriteLine(Invoke(() => CreateStruct2<S>()));
}
}";
CompileAndVerify(sourceB, references: new[] { refA }, expectedOutput:
@"S
System.MissingMethodException
System.MissingMethodException
System.MissingMethodException");
}
[InlineData("internal")]
[InlineData("private")]
[Theory]
public void NonPublicParameterlessConstructor_03(string accessibility)
{
var sourceA =
$@"public struct S
{{
{accessibility}
S() {{ }}
}}";
var comp = CreateCompilation(sourceA);
comp.VerifyDiagnostics(
// (4,5): error CS8938: The parameterless struct constructor must be 'public'.
// S() { }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "S").WithLocation(4, 5));
var refA = comp.ToMetadataReference();
var sourceB =
@"class Program
{
static T CreateNew<T>() where T : new() => new T();
static T CreateStruct<T>() where T : struct => new T();
static void Main()
{
_ = new S();
_ = CreateNew<S>();
_ = CreateStruct<S>();
}
}";
var expectedDiagnostics = new[]
{
// (7,17): error CS0122: 'S.S()' is inaccessible due to its protection level
// _ = new S();
Diagnostic(ErrorCode.ERR_BadAccess, "S").WithArguments("S.S()").WithLocation(7, 17),
// (8,13): error CS0310: 'S' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Program.CreateNew<T>()'
// _ = CreateNew<S>();
Diagnostic(ErrorCode.ERR_NewConstraintNotSatisfied, "CreateNew<S>").WithArguments("Program.CreateNew<T>()", "T", "S").WithLocation(8, 13),
};
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
comp = CreateCompilation(sourceB, references: new[] { refA });
comp.VerifyDiagnostics(expectedDiagnostics);
}
[InlineData("internal")]
[InlineData("protected")]
[InlineData("protected internal")]
[InlineData("private")]
[InlineData("private protected")]
[Theory]
public void PublicConstructorPrivateStruct_NewConstraint(string accessibility)
{
var sourceA =
$@"partial class Program
{{
{accessibility} struct S
{{
public readonly bool Initialized;
public S()
{{
Initialized = true;
}}
}}
}}";
var sourceB =
@"using System;
partial class Program
{
static T CreateNew<T>() where T : new() => new T();
static void Main()
{
Console.WriteLine(CreateNew<S>().Initialized);
}
}";
CompileAndVerify(new[] { sourceA, sourceB }, expectedOutput: "True");
}
[Fact]
public void ThisInitializer_01()
{
var source =
@"using static System.Console;
using static Program;
struct S1
{
internal int Value;
public S1() { Value = Two(); }
internal S1(object obj) : this() { }
}
struct S2
{
internal int Value;
public S2() : this(null) { }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"Two()
new S1().Value: 2
Two()
new S1(null).Value: 2
Three()
new S2().Value: 3
");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Two()""
IL_0006: stfld ""int S1.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Three()""
IL_0006: stfld ""int S2.Value""
IL_000b: ret
}");
}
[Fact]
public void ThisInitializer_02()
{
var source =
@"using static System.Console;
using static Program;
struct S1
{
internal int Value;
public S1() { Value = Two(); }
internal S1(object obj) : this() { Value = Three(); }
}
struct S2
{
internal int Value;
public S2() : this(null) { Value = Two(); }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"Two()
new S1().Value: 2
Two()
Three()
new S1(null).Value: 3
Three()
Two()
new S2().Value: 2
");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Two()""
IL_0006: stfld ""int S1.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ldarg.0
IL_0007: call ""int Program.Three()""
IL_000c: stfld ""int S1.Value""
IL_0011: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Three()""
IL_0006: stfld ""int S2.Value""
IL_000b: ret
}");
}
[Fact]
public void ThisInitializer_03()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value = One();
internal S0(object obj) : this() { }
}
struct S1
{
internal int Value = One();
public S1() { }
internal S1(object obj) : this() { }
}
struct S2
{
internal int Value = One();
public S2() : this(null) { }
S2(object obj) { }
}
class Program
{
internal static int One() { WriteLine(""One()""); return 1; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(null).Value: {new S0(null).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput: @"
new S0().Value: 0
One()
new S0(null).Value: 1
One()
new S1().Value: 1
One()
new S1(null).Value: 1
One()
new S2().Value: 1
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S0.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S1.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S2.Value""
IL_000b: ret
}");
}
[Fact]
public void ThisInitializer_04()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value = One();
internal S0(object obj) : this() { Value = Two(); }
}
struct S1
{
internal int Value = One();
public S1() { Value = Two(); }
internal S1(object obj) : this() { Value = Three(); }
}
struct S2
{
internal int Value = One();
public S2() : this(null) { Value = Two(); }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int One() { WriteLine(""One()""); return 1; }
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(null).Value: {new S0(null).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"new S0().Value: 0
One()
Two()
new S0(null).Value: 2
One()
Two()
new S1().Value: 2
One()
Two()
Three()
new S1(null).Value: 3
One()
Three()
Two()
new S2().Value: 2
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(object)",
@"{
// Code size 23 (0x17)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S0.Value""
IL_000b: ldarg.0
IL_000c: call ""int Program.Two()""
IL_0011: stfld ""int S0.Value""
IL_0016: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 23 (0x17)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S1.Value""
IL_000b: ldarg.0
IL_000c: call ""int Program.Two()""
IL_0011: stfld ""int S1.Value""
IL_0016: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ldarg.0
IL_0007: call ""int Program.Three()""
IL_000c: stfld ""int S1.Value""
IL_0011: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 23 (0x17)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S2.Value""
IL_000b: ldarg.0
IL_000c: call ""int Program.Three()""
IL_0011: stfld ""int S2.Value""
IL_0016: ret
}");
}
/// <summary>
/// Initializers with default values to verify that the decision whether
/// to execute an initializer is independent of the initializer value.
/// </summary>
[Fact]
public void ThisInitializer_05()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value = 0;
internal S0(object obj) : this() { Value = Two(); }
}
struct S1
{
internal int Value = 0;
public S1() { Value = Two(); }
internal S1(object obj) : this() { Value = Three(); }
}
struct S2
{
internal int Value = 0;
public S2() : this(null) { Value = Two(); }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(null).Value: {new S0(null).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"new S0().Value: 0
Two()
new S0(null).Value: 2
Two()
new S1().Value: 2
Two()
Three()
new S1(null).Value: 3
Three()
Two()
new S2().Value: 2
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(object)",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: stfld ""int S0.Value""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S0.Value""
IL_0012: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: stfld ""int S1.Value""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S1.Value""
IL_0012: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ldarg.0
IL_0007: call ""int Program.Three()""
IL_000c: stfld ""int S1.Value""
IL_0011: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: stfld ""int S2.Value""
IL_0007: ldarg.0
IL_0008: call ""int Program.Three()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
}
[Fact]
public void ThisInitializer_06()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value;
public S0(params object[] args) { Value = Two(); }
public S0(int i) : this() { }
}
struct S1
{
internal int Value;
public S1(object obj = null) { Value = Two(); }
public S1(int i) : this() { }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(0).Value: {new S0(0).Value}"");
WriteLine($""new S0((object)0).Value: {new S0((object)0).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(1).Value: {new S1(1).Value}"");
WriteLine($""new S1((object)1).Value: {new S1((object)1).Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"new S0().Value: 0
new S0(0).Value: 0
Two()
new S0((object)0).Value: 2
new S1().Value: 0
new S1(1).Value: 0
Two()
new S1((object)1).Value: 2
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(int)",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: initobj ""S0""
IL_0007: ret
}");
verifier.VerifyMissing("S1..ctor()");
verifier.VerifyIL("S1..ctor(int)",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: initobj ""S1""
IL_0007: ret
}");
}
[Fact]
public void FieldInitializers_None()
{
var source =
@"#pragma warning disable 649
using System;
struct S0
{
object X;
object Y;
public override string ToString() => (X, Y).ToString();
}
struct S1
{
object X;
object Y;
public S1() { Y = 1; }
public override string ToString() => (X, Y).ToString();
}
struct S2
{
object X;
object Y;
public S2(object y) { Y = y; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S0());
Console.WriteLine(new S1());
Console.WriteLine(new S2());
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (13,12): error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
// public S1() { Y = 1; }
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "S1").WithArguments("parameterless struct constructors", "10.0").WithLocation(13, 12),
// (13,12): error CS0171: Field 'S1.X' must be fully assigned before control is returned to the caller
// public S1() { Y = 1; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S1").WithArguments("S1.X").WithLocation(13, 12),
// (20,12): error CS0171: Field 'S2.X' must be fully assigned before control is returned to the caller
// public S2(object y) { Y = y; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S2").WithArguments("S2.X").WithLocation(20, 12));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe);
comp.VerifyDiagnostics(
// (13,12): error CS0171: Field 'S1.X' must be fully assigned before control is returned to the caller
// public S1() { Y = 1; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S1").WithArguments("S1.X").WithLocation(13, 12),
// (20,12): error CS0171: Field 'S2.X' must be fully assigned before control is returned to the caller
// public S2(object y) { Y = y; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S2").WithArguments("S2.X").WithLocation(20, 12));
}
[Fact]
public void FieldInitializers_01()
{
var source =
@"#pragma warning disable 649
using System;
struct S1
{
object X = null;
object Y;
public override string ToString() => (X, Y).ToString();
}
struct S2
{
object X = null;
object Y;
public S2() { Y = 1; }
public override string ToString() => (X, Y).ToString();
}
struct S3
{
object X;
object Y = null;
public S3(object x) { X = x; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S1());
Console.WriteLine(new S2());
Console.WriteLine(new S3());
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,12): error CS8773: Feature 'struct field initializers' is not available in C# 9.0. Please use language version 10.0 or greater.
// object X = null;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "X").WithArguments("struct field initializers", "10.0").WithLocation(5, 12),
// (11,12): error CS8773: Feature 'struct field initializers' is not available in C# 9.0. Please use language version 10.0 or greater.
// object X = null;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "X").WithArguments("struct field initializers", "10.0").WithLocation(11, 12),
// (13,12): error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
// public S2() { Y = 1; }
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "S2").WithArguments("parameterless struct constructors", "10.0").WithLocation(13, 12),
// (19,12): error CS8773: Feature 'struct field initializers' is not available in C# 9.0. Please use language version 10.0 or greater.
// object Y = null;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "Y").WithArguments("struct field initializers", "10.0").WithLocation(19, 12));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput:
@"(, )
(, 1)
(, )");
verifier.VerifyIL("Program.Main",
@"{
// Code size 50 (0x32)
.maxstack 1
.locals init (S3 V_0)
IL_0000: newobj ""S1..ctor()""
IL_0005: box ""S1""
IL_000a: call ""void System.Console.WriteLine(object)""
IL_000f: newobj ""S2..ctor()""
IL_0014: box ""S2""
IL_0019: call ""void System.Console.WriteLine(object)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3""
IL_0026: ldloc.0
IL_0027: box ""S3""
IL_002c: call ""void System.Console.WriteLine(object)""
IL_0031: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld ""object S1.X""
IL_0007: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 20 (0x14)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld ""object S2.X""
IL_0007: ldarg.0
IL_0008: ldc.i4.1
IL_0009: box ""int""
IL_000e: stfld ""object S2.Y""
IL_0013: ret
}");
verifier.VerifyMissing("S3..ctor()");
verifier.VerifyIL("S3..ctor(object)",
@"{
// Code size 15 (0xf)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld ""object S3.Y""
IL_0007: ldarg.0
IL_0008: ldarg.1
IL_0009: stfld ""object S3.X""
IL_000e: ret
}");
}
[Fact]
public void FieldInitializers_02()
{
var source =
@"#pragma warning disable 649
using System;
struct S1
{
internal object X = 1;
internal object Y;
public override string ToString() => (X, Y).ToString();
}
struct S2
{
internal object X = 2;
internal object Y;
public S2() { Y = 2; }
public override string ToString() => (X, Y).ToString();
}
struct S3
{
internal object X = 3;
internal object Y;
public S3(object _) { Y = 3; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S1());
Console.WriteLine(new S2());
Console.WriteLine(new S3());
Console.WriteLine(new S1 { });
Console.WriteLine(new S2 { });
Console.WriteLine(new S3 { });
Console.WriteLine(new S1 { Y = 2 });
Console.WriteLine(new S2 { Y = 4 });
Console.WriteLine(new S3 { Y = 6 });
}
}";
var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput:
@"(1, )
(2, 2)
(, )
(1, )
(2, 2)
(, )
(1, 2)
(2, 4)
(, 6)");
verifier.VerifyIL("Program.Main",
@"{
// Code size 193 (0xc1)
.maxstack 2
.locals init (S3 V_0,
S1 V_1,
S2 V_2)
IL_0000: newobj ""S1..ctor()""
IL_0005: box ""S1""
IL_000a: call ""void System.Console.WriteLine(object)""
IL_000f: newobj ""S2..ctor()""
IL_0014: box ""S2""
IL_0019: call ""void System.Console.WriteLine(object)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3""
IL_0026: ldloc.0
IL_0027: box ""S3""
IL_002c: call ""void System.Console.WriteLine(object)""
IL_0031: newobj ""S1..ctor()""
IL_0036: box ""S1""
IL_003b: call ""void System.Console.WriteLine(object)""
IL_0040: newobj ""S2..ctor()""
IL_0045: box ""S2""
IL_004a: call ""void System.Console.WriteLine(object)""
IL_004f: ldloca.s V_0
IL_0051: initobj ""S3""
IL_0057: ldloc.0
IL_0058: box ""S3""
IL_005d: call ""void System.Console.WriteLine(object)""
IL_0062: ldloca.s V_1
IL_0064: call ""S1..ctor()""
IL_0069: ldloca.s V_1
IL_006b: ldc.i4.2
IL_006c: box ""int""
IL_0071: stfld ""object S1.Y""
IL_0076: ldloc.1
IL_0077: box ""S1""
IL_007c: call ""void System.Console.WriteLine(object)""
IL_0081: ldloca.s V_2
IL_0083: call ""S2..ctor()""
IL_0088: ldloca.s V_2
IL_008a: ldc.i4.4
IL_008b: box ""int""
IL_0090: stfld ""object S2.Y""
IL_0095: ldloc.2
IL_0096: box ""S2""
IL_009b: call ""void System.Console.WriteLine(object)""
IL_00a0: ldloca.s V_0
IL_00a2: initobj ""S3""
IL_00a8: ldloca.s V_0
IL_00aa: ldc.i4.6
IL_00ab: box ""int""
IL_00b0: stfld ""object S3.Y""
IL_00b5: ldloc.0
IL_00b6: box ""S3""
IL_00bb: call ""void System.Console.WriteLine(object)""
IL_00c0: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 13 (0xd)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: box ""int""
IL_0007: stfld ""object S1.X""
IL_000c: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.2
IL_0002: box ""int""
IL_0007: stfld ""object S2.X""
IL_000c: ldarg.0
IL_000d: ldc.i4.2
IL_000e: box ""int""
IL_0013: stfld ""object S2.Y""
IL_0018: ret
}");
verifier.VerifyMissing("S3..ctor()");
verifier.VerifyIL("S3..ctor(object)",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.3
IL_0002: box ""int""
IL_0007: stfld ""object S3.X""
IL_000c: ldarg.0
IL_000d: ldc.i4.3
IL_000e: box ""int""
IL_0013: stfld ""object S3.Y""
IL_0018: ret
}");
}
// As above but with auto-properties.
[Fact]
public void FieldInitializers_03()
{
var source =
@"#pragma warning disable 649
using System;
struct S1
{
internal object X { get; } = 1;
internal object Y { get; }
public override string ToString() => (X, Y).ToString();
}
struct S2
{
internal object X { get; init; } = 2;
internal object Y { get; init; }
public S2() { Y = 2; }
public override string ToString() => (X, Y).ToString();
}
struct S3
{
internal object X { get; private set; } = 3;
internal object Y { get; set; }
public S3(object _) { Y = 3; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S1());
Console.WriteLine(new S2());
Console.WriteLine(new S3());
Console.WriteLine(new S1 { });
Console.WriteLine(new S2 { });
Console.WriteLine(new S3 { });
Console.WriteLine(new S2 { Y = 4 });
Console.WriteLine(new S3 { Y = 6 });
}
}";
var verifier = CompileAndVerify(new[] { source, IsExternalInitTypeDefinition }, options: TestOptions.ReleaseExe, verify: Verification.Skipped, expectedOutput:
@"(1, )
(2, 2)
(, )
(1, )
(2, 2)
(, )
(2, 4)
(, 6)");
verifier.VerifyIL("Program.Main",
@"{
// Code size 162 (0xa2)
.maxstack 2
.locals init (S3 V_0,
S2 V_1)
IL_0000: newobj ""S1..ctor()""
IL_0005: box ""S1""
IL_000a: call ""void System.Console.WriteLine(object)""
IL_000f: newobj ""S2..ctor()""
IL_0014: box ""S2""
IL_0019: call ""void System.Console.WriteLine(object)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3""
IL_0026: ldloc.0
IL_0027: box ""S3""
IL_002c: call ""void System.Console.WriteLine(object)""
IL_0031: newobj ""S1..ctor()""
IL_0036: box ""S1""
IL_003b: call ""void System.Console.WriteLine(object)""
IL_0040: newobj ""S2..ctor()""
IL_0045: box ""S2""
IL_004a: call ""void System.Console.WriteLine(object)""
IL_004f: ldloca.s V_0
IL_0051: initobj ""S3""
IL_0057: ldloc.0
IL_0058: box ""S3""
IL_005d: call ""void System.Console.WriteLine(object)""
IL_0062: ldloca.s V_1
IL_0064: call ""S2..ctor()""
IL_0069: ldloca.s V_1
IL_006b: ldc.i4.4
IL_006c: box ""int""
IL_0071: call ""void S2.Y.init""
IL_0076: ldloc.1
IL_0077: box ""S2""
IL_007c: call ""void System.Console.WriteLine(object)""
IL_0081: ldloca.s V_0
IL_0083: initobj ""S3""
IL_0089: ldloca.s V_0
IL_008b: ldc.i4.6
IL_008c: box ""int""
IL_0091: call ""void S3.Y.set""
IL_0096: ldloc.0
IL_0097: box ""S3""
IL_009c: call ""void System.Console.WriteLine(object)""
IL_00a1: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 13 (0xd)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: box ""int""
IL_0007: stfld ""object S1.<X>k__BackingField""
IL_000c: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.2
IL_0002: box ""int""
IL_0007: stfld ""object S2.<X>k__BackingField""
IL_000c: ldarg.0
IL_000d: ldc.i4.2
IL_000e: box ""int""
IL_0013: call ""void S2.Y.init""
IL_0018: ret
}");
verifier.VerifyMissing("S3..ctor()");
verifier.VerifyIL("S3..ctor(object)",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.3
IL_0002: box ""int""
IL_0007: stfld ""object S3.<X>k__BackingField""
IL_000c: ldarg.0
IL_000d: ldc.i4.3
IL_000e: box ""int""
IL_0013: call ""void S3.Y.set""
IL_0018: ret
}");
}
[Fact]
public void FieldInitializers_04()
{
var source =
@"#pragma warning disable 649
using System;
struct S1<T> { internal int X = 1; }
struct S2<T> { internal int X = 2; public S2() { } }
struct S3<T> { internal int X = 3; public S3(int _) { } }
class Program
{
static void Main()
{
Console.WriteLine(new S1<object>().X);
Console.WriteLine(new S2<object>().X);
Console.WriteLine(new S3<object>().X);
}
}";
var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput:
@"1
2
0");
verifier.VerifyIL("Program.Main",
@"{
// Code size 50 (0x32)
.maxstack 1
.locals init (S3<object> V_0)
IL_0000: newobj ""S1<object>..ctor()""
IL_0005: ldfld ""int S1<object>.X""
IL_000a: call ""void System.Console.WriteLine(int)""
IL_000f: newobj ""S2<object>..ctor()""
IL_0014: ldfld ""int S2<object>.X""
IL_0019: call ""void System.Console.WriteLine(int)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3<object>""
IL_0026: ldloc.0
IL_0027: ldfld ""int S3<object>.X""
IL_002c: call ""void System.Console.WriteLine(int)""
IL_0031: ret
}");
}
[Fact]
public void FieldInitializers_05()
{
var source =
@"#pragma warning disable 649
using System;
class A<T>
{
internal struct S1 { internal int X { get; } = 1; }
internal struct S2 { internal int X { get; init; } = 2; public S2() { } }
internal struct S3 { internal int X { get; set; } = 3; public S3(int _) { } }
}
class Program
{
static void Main()
{
Console.WriteLine(new A<object>.S1().X);
Console.WriteLine(new A<object>.S2().X);
Console.WriteLine(new A<object>.S3().X);
}
}";
var verifier = CompileAndVerify(new[] { source, IsExternalInitTypeDefinition }, options: TestOptions.ReleaseExe, verify: Verification.Skipped, expectedOutput:
@"1
2
0");
verifier.VerifyIL("Program.Main",
@"{
// Code size 56 (0x38)
.maxstack 2
.locals init (A<object>.S1 V_0,
A<object>.S2 V_1,
A<object>.S3 V_2)
IL_0000: newobj ""A<object>.S1..ctor()""
IL_0005: stloc.0
IL_0006: ldloca.s V_0
IL_0008: call ""readonly int A<object>.S1.X.get""
IL_000d: call ""void System.Console.WriteLine(int)""
IL_0012: newobj ""A<object>.S2..ctor()""
IL_0017: stloc.1
IL_0018: ldloca.s V_1
IL_001a: call ""readonly int A<object>.S2.X.get""
IL_001f: call ""void System.Console.WriteLine(int)""
IL_0024: ldloca.s V_2
IL_0026: dup
IL_0027: initobj ""A<object>.S3""
IL_002d: call ""readonly int A<object>.S3.X.get""
IL_0032: call ""void System.Console.WriteLine(int)""
IL_0037: ret
}");
verifier.VerifyIL("A<T>.S1..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: stfld ""int A<T>.S1.<X>k__BackingField""
IL_0007: ret
}");
verifier.VerifyIL("A<T>.S2..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.2
IL_0002: stfld ""int A<T>.S2.<X>k__BackingField""
IL_0007: ret
}");
verifier.VerifyIL("A<T>.S3..ctor(int)",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.3
IL_0002: stfld ""int A<T>.S3.<X>k__BackingField""
IL_0007: ret
}");
}
[Fact]
public void ExpressionTrees()
{
var source =
@"#pragma warning disable 649
using System;
using System.Linq.Expressions;
struct S0
{
int X;
public override string ToString() => X.ToString();
}
struct S1
{
int X = 1;
public override string ToString() => X.ToString();
}
struct S2
{
int X = 2;
public S2() { }
public override string ToString() => X.ToString();
}
class Program
{
static void Main()
{
Report(() => new S0());
Report(() => new S1());
Report(() => new S2());
}
static void Report<T>(Expression<Func<T>> e)
{
var t = e.Compile().Invoke();
Console.WriteLine(t);
}
}";
var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput:
@"0
1
2");
verifier.VerifyIL("Program.Main",
@"{
// Code size 111 (0x6f)
.maxstack 2
IL_0000: ldtoken ""S0""
IL_0005: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_000a: call ""System.Linq.Expressions.NewExpression System.Linq.Expressions.Expression.New(System.Type)""
IL_000f: call ""System.Linq.Expressions.ParameterExpression[] System.Array.Empty<System.Linq.Expressions.ParameterExpression>()""
IL_0014: call ""System.Linq.Expressions.Expression<System.Func<S0>> System.Linq.Expressions.Expression.Lambda<System.Func<S0>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
IL_0019: call ""void Program.Report<S0>(System.Linq.Expressions.Expression<System.Func<S0>>)""
IL_001e: ldtoken ""S1..ctor()""
IL_0023: call ""System.Reflection.MethodBase System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle)""
IL_0028: castclass ""System.Reflection.ConstructorInfo""
IL_002d: call ""System.Linq.Expressions.Expression[] System.Array.Empty<System.Linq.Expressions.Expression>()""
IL_0032: call ""System.Linq.Expressions.NewExpression System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression>)""
IL_0037: call ""System.Linq.Expressions.ParameterExpression[] System.Array.Empty<System.Linq.Expressions.ParameterExpression>()""
IL_003c: call ""System.Linq.Expressions.Expression<System.Func<S1>> System.Linq.Expressions.Expression.Lambda<System.Func<S1>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
IL_0041: call ""void Program.Report<S1>(System.Linq.Expressions.Expression<System.Func<S1>>)""
IL_0046: ldtoken ""S2..ctor()""
IL_004b: call ""System.Reflection.MethodBase System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle)""
IL_0050: castclass ""System.Reflection.ConstructorInfo""
IL_0055: call ""System.Linq.Expressions.Expression[] System.Array.Empty<System.Linq.Expressions.Expression>()""
IL_005a: call ""System.Linq.Expressions.NewExpression System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression>)""
IL_005f: call ""System.Linq.Expressions.ParameterExpression[] System.Array.Empty<System.Linq.Expressions.ParameterExpression>()""
IL_0064: call ""System.Linq.Expressions.Expression<System.Func<S2>> System.Linq.Expressions.Expression.Lambda<System.Func<S2>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
IL_0069: call ""void Program.Report<S2>(System.Linq.Expressions.Expression<System.Func<S2>>)""
IL_006e: ret
}");
}
[Fact]
public void Retargeting_01()
{
var sourceA =
@"public struct S1
{
public int X = 1;
}
public struct S2
{
public int X = 2;
public S2() { }
}
public struct S3
{
public int X = 3;
public S3(object _) { }
}";
var comp = CreateCompilation(sourceA, targetFramework: TargetFramework.Mscorlib40);
var refA = comp.ToMetadataReference();
var typeA = comp.GetMember<FieldSymbol>("S1.X").Type;
var corLibA = comp.Assembly.CorLibrary;
Assert.Equal(corLibA, typeA.ContainingAssembly);
var sourceB =
@"using System;
class Program
{
static void Main()
{
Console.WriteLine(new S1().X);
Console.WriteLine(new S2().X);
Console.WriteLine(new S3().X);
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Mscorlib45);
CompileAndVerify(comp, expectedOutput:
@"1
2
0");
var corLibB = comp.Assembly.CorLibrary;
Assert.NotEqual(corLibA, corLibB);
var field = comp.GetMember<FieldSymbol>("S1.X");
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(field);
var typeB = (NamedTypeSymbol)field.Type;
Assert.Equal(corLibB, typeB.ContainingAssembly);
}
[Fact]
public void NullableAnalysis_01()
{
var source =
@"#pragma warning disable 169
#nullable enable
struct S0
{
object F0;
}
struct S1
{
object F1;
public S1() { }
}
struct S2
{
object F2;
public S2() : this(null) { }
S2(object? obj) { }
}
struct S3
{
object F3;
public S3() { F3 = GetValue(); }
static object? GetValue() => null;
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (10,12): warning CS8618: Non-nullable field 'F1' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
// public S1() { }
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "S1").WithArguments("field", "F1").WithLocation(10, 12),
// (10,12): error CS0171: Field 'S1.F1' must be fully assigned before control is returned to the caller
// public S1() { }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S1").WithArguments("S1.F1").WithLocation(10, 12),
// (16,5): warning CS8618: Non-nullable field 'F2' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
// S2(object? obj) { }
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "S2").WithArguments("field", "F2").WithLocation(16, 5),
// (16,5): error CS0171: Field 'S2.F2' must be fully assigned before control is returned to the caller
// S2(object? obj) { }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S2").WithArguments("S2.F2").WithLocation(16, 5),
// (21,12): warning CS8618: Non-nullable field 'F3' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
// public S3() { F3 = GetValue(); }
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "S3").WithArguments("field", "F3").WithLocation(21, 12),
// (21,24): warning CS8601: Possible null reference assignment.
// public S3() { F3 = GetValue(); }
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "GetValue()").WithLocation(21, 24));
}
[Fact]
public void NullableAnalysis_02()
{
var source =
@"#nullable enable
struct S0
{
object F0 = Utils.GetValue();
}
struct S1
{
object F1 = Utils.GetValue();
public S1() { }
}
struct S2
{
object F2 = Utils.GetValue();
public S2() : this(null) { }
S2(object obj) { }
}
static class Utils
{
internal static object? GetValue() => null;
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (4,17): warning CS8601: Possible null reference assignment.
// object F0 = Utils.GetValue();
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "Utils.GetValue()").WithLocation(4, 17),
// (8,17): warning CS8601: Possible null reference assignment.
// object F1 = Utils.GetValue();
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "Utils.GetValue()").WithLocation(8, 17),
// (13,17): warning CS8601: Possible null reference assignment.
// object F2 = Utils.GetValue();
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "Utils.GetValue()").WithLocation(13, 17),
// (14,24): warning CS8625: Cannot convert null literal to non-nullable reference type.
// public S2() : this(null) { }
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").WithLocation(14, 24));
}
[Fact]
public void DefiniteAssignment()
{
var source =
@"#pragma warning disable 169
unsafe struct S0
{
fixed int Y[1];
}
unsafe struct S1
{
fixed int Y[1];
public S1() { }
}
unsafe struct S2
{
int X;
fixed int Y[1];
}
unsafe struct S3
{
int X;
fixed int Y[1];
public S3() { }
}
unsafe struct S4
{
int X = 4;
fixed int Y[1];
}
unsafe struct S5
{
int X;
fixed int Y[1];
public S5() { X = 5; }
}";
var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (20,12): error CS0171: Field 'S3.X' must be fully assigned before control is returned to the caller
// public S3() { }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S3").WithArguments("S3.X").WithLocation(20, 12),
// (24,9): warning CS0414: The field 'S4.X' is assigned but its value is never used
// int X = 4;
Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "X").WithArguments("S4.X").WithLocation(24, 9),
// (29,9): warning CS0414: The field 'S5.X' is assigned but its value is never used
// int X;
Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "X").WithArguments("S5.X").WithLocation(29, 9));
}
[Fact]
public void ParameterDefaultValues_01()
{
var source =
@"struct S1 { }
struct S2 { public S2() { } }
struct S3 { internal S3() { } }
struct S4 { private S4() { } }
class Program
{
static void F1(S1 s = default) { }
static void F2(S2 s = default) { }
static void F3(S3 s = default) { }
static void F4(S4 s = default) { }
static void G1(S1 s = new()) { }
static void G2(S2 s = new()) { }
static void G3(S3 s = new()) { }
static void G4(S4 s = new()) { }
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (3,22): error CS8938: The parameterless struct constructor must be 'public'.
// struct S3 { internal S3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "S3").WithLocation(3, 22),
// (4,21): error CS8938: The parameterless struct constructor must be 'public'.
// struct S4 { private S4() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "S4").WithLocation(4, 21),
// (12,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G2(S2 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(12, 27),
// (13,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G3(S3 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(13, 27),
// (14,27): error CS0122: 'S4.S4()' is inaccessible due to its protection level
// static void G4(S4 s = new()) { }
Diagnostic(ErrorCode.ERR_BadAccess, "new()").WithArguments("S4.S4()").WithLocation(14, 27),
// (14,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G4(S4 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(14, 27));
}
[Fact]
public void ParameterDefaultValues_02()
{
var source =
@"struct S1
{
object X = 1;
}
struct S2
{
object X = 2;
public S2() { }
}
struct S3
{
object X = 3;
public S3(object x) { X = x; }
}
class Program
{
static void F1(S1 s = default) { }
static void F2(S2 s = default) { }
static void F3(S3 s = default) { }
static void G1(S1 s = new()) { }
static void G2(S2 s = new()) { }
static void G3(S3 s = new()) { }
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (20,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G1(S1 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(20, 27),
// (21,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G2(S2 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(21, 27));
}
[Fact]
public void Constants()
{
var source =
@"struct S0
{
}
struct S1
{
object X = 1;
}
struct S2
{
public S2() { }
}
class Program
{
const object d0 = default(S0);
const object d1 = default(S1);
const object d2 = default(S2);
const object s0 = new S0();
const object s1 = new S1();
const object s2 = new S2();
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (14,23): error CS0133: The expression being assigned to 'Program.d0' must be constant
// const object d0 = default(S0);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(S0)").WithArguments("Program.d0").WithLocation(14, 23),
// (15,23): error CS0133: The expression being assigned to 'Program.d1' must be constant
// const object d1 = default(S1);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(S1)").WithArguments("Program.d1").WithLocation(15, 23),
// (16,23): error CS0133: The expression being assigned to 'Program.d2' must be constant
// const object d2 = default(S2);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(S2)").WithArguments("Program.d2").WithLocation(16, 23),
// (17,23): error CS0133: The expression being assigned to 'Program.s0' must be constant
// const object s0 = new S0();
Diagnostic(ErrorCode.ERR_NotConstantExpression, "new S0()").WithArguments("Program.s0").WithLocation(17, 23),
// (18,23): error CS0133: The expression being assigned to 'Program.s1' must be constant
// const object s1 = new S1();
Diagnostic(ErrorCode.ERR_NotConstantExpression, "new S1()").WithArguments("Program.s1").WithLocation(18, 23),
// (19,23): error CS0133: The expression being assigned to 'Program.s2' must be constant
// const object s2 = new S2();
Diagnostic(ErrorCode.ERR_NotConstantExpression, "new S2()").WithArguments("Program.s2").WithLocation(19, 23));
}
[Fact]
public void NoPIA()
{
var sourceA =
@"using System.Runtime.InteropServices;
[assembly: ImportedFromTypeLib(""_.dll"")]
[assembly: Guid(""9758B46C-5297-4832-BB58-F2B5B78B0D01"")]
[ComImport()]
[Guid(""6D947BE5-75B1-4D97-B444-2720624761D7"")]
public interface I
{
S0 F0();
S1 F1();
S2 F2();
}
public struct S0
{
}
public struct S1
{
public S1() { }
}
public struct S2
{
object F = 2;
}";
var comp = CreateCompilationWithMscorlib40(sourceA);
var refA = comp.EmitToImageReference(embedInteropTypes: true);
var sourceB =
@"class Program
{
static void M(I i)
{
var s0 = i.F0();
var s1 = i.F1();
var s2 = i.F2();
}
}";
comp = CreateCompilationWithMscorlib40(sourceB, references: new[] { refA });
comp.VerifyEmitDiagnostics(
// (6,18): error CS1757: Embedded interop struct 'S1' can contain only public instance fields.
// var s1 = i.F1();
Diagnostic(ErrorCode.ERR_InteropStructContainsMethods, "i.F1()").WithArguments("S1").WithLocation(6, 18),
// (7,18): error CS1757: Embedded interop struct 'S2' can contain only public instance fields.
// var s2 = i.F2();
Diagnostic(ErrorCode.ERR_InteropStructContainsMethods, "i.F2()").WithArguments("S2").WithLocation(7, 18));
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics
{
public class StructConstructorTests : CSharpTestBase
{
[CombinatorialData]
[Theory]
public void PublicParameterlessConstructor(bool useCompilationReference)
{
var sourceA =
@"public struct S<T>
{
public readonly bool Initialized;
public S() { Initialized = true; }
}";
var comp = CreateCompilation(sourceA, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (4,12): error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
// public S() { Initialized = true; }
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "S").WithArguments("parameterless struct constructors", "10.0").WithLocation(4, 12));
comp = CreateCompilation(sourceA);
comp.VerifyDiagnostics();
var refA = AsReference(comp, useCompilationReference);
var sourceB =
@"using System;
class Program
{
static T CreateNew<T>() where T : new() => new T();
static T CreateStruct<T>() where T : struct => new T();
static void Main()
{
Console.WriteLine(new S<int>().Initialized);
Console.WriteLine(CreateNew<S<int>>().Initialized);
Console.WriteLine(CreateStruct<S<int>>().Initialized);
Console.WriteLine(CreateStruct<S<string>>().Initialized);
Console.WriteLine(CreateNew<S<string>>().Initialized);
Console.WriteLine(new S<string>().Initialized);
}
}";
bool secondCall = ExecutionConditionUtil.IsCoreClr; // .NET Framework ignores constructor in second call to Activator.CreateInstance<T>().
CompileAndVerify(sourceB, references: new[] { refA }, expectedOutput:
$@"True
True
{secondCall}
True
{secondCall}
True");
}
[Fact]
public void NonPublicParameterlessConstructor_01()
{
var source =
@"public struct A0 { public A0() { } }
public struct A1 { internal A1() { } }
public struct A2 { private A2() { } }
public struct A3 { A3() { } }
internal struct B0 { public B0() { } }
internal struct B1 { internal B1() { } }
internal struct B2 { private B2() { } }
internal struct B3 { B3() { } }
public class C
{
internal protected struct C0 { public C0() { } }
internal protected struct C1 { internal C1() { } }
internal protected struct C2 { private C2() { } }
internal protected struct C3 { C3() { } }
protected struct D0 { public D0() { } }
protected struct D1 { internal D1() { } }
protected struct D2 { private D2() { } }
protected struct D3 { D3() { } }
private protected struct E0 { public E0() { } }
private protected struct E1 { internal E1() { } }
private protected struct E2 { private E2() { } }
private protected struct E3 { E3() { } }
private struct F0 { public F0() { } }
private struct F1 { internal F1() { } }
private struct F2 { private F2() { } }
private struct F3 { F3() { } }
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (2,29): error CS8938: The parameterless struct constructor must be 'public'.
// public struct A1 { internal A1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "A1").WithLocation(2, 29),
// (3,28): error CS8938: The parameterless struct constructor must be 'public'.
// public struct A2 { private A2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "A2").WithLocation(3, 28),
// (4,20): error CS8938: The parameterless struct constructor must be 'public'.
// public struct A3 { A3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "A3").WithLocation(4, 20),
// (7,31): error CS8938: The parameterless struct constructor must be 'public'.
// internal struct B1 { internal B1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "B1").WithLocation(7, 31),
// (8,30): error CS8938: The parameterless struct constructor must be 'public'.
// internal struct B2 { private B2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "B2").WithLocation(8, 30),
// (9,22): error CS8938: The parameterless struct constructor must be 'public'.
// internal struct B3 { B3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "B3").WithLocation(9, 22),
// (14,45): error CS8938: The parameterless struct constructor must be 'public'.
// internal protected struct C1 { internal C1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "C1").WithLocation(14, 45),
// (15,44): error CS8938: The parameterless struct constructor must be 'public'.
// internal protected struct C2 { private C2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "C2").WithLocation(15, 44),
// (16,36): error CS8938: The parameterless struct constructor must be 'public'.
// internal protected struct C3 { C3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "C3").WithLocation(16, 36),
// (19,36): error CS8938: The parameterless struct constructor must be 'public'.
// protected struct D1 { internal D1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "D1").WithLocation(19, 36),
// (20,35): error CS8938: The parameterless struct constructor must be 'public'.
// protected struct D2 { private D2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "D2").WithLocation(20, 35),
// (21,27): error CS8938: The parameterless struct constructor must be 'public'.
// protected struct D3 { D3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "D3").WithLocation(21, 27),
// (24,44): error CS8938: The parameterless struct constructor must be 'public'.
// private protected struct E1 { internal E1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "E1").WithLocation(24, 44),
// (25,43): error CS8938: The parameterless struct constructor must be 'public'.
// private protected struct E2 { private E2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "E2").WithLocation(25, 43),
// (26,35): error CS8938: The parameterless struct constructor must be 'public'.
// private protected struct E3 { E3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "E3").WithLocation(26, 35),
// (29,34): error CS8938: The parameterless struct constructor must be 'public'.
// private struct F1 { internal F1() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "F1").WithLocation(29, 34),
// (30,33): error CS8938: The parameterless struct constructor must be 'public'.
// private struct F2 { private F2() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "F2").WithLocation(30, 33),
// (31,25): error CS8938: The parameterless struct constructor must be 'public'.
// private struct F3 { F3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "F3").WithLocation(31, 25));
}
[InlineData("assembly")]
[InlineData("private")]
[Theory]
public void NonPublicParameterlessConstructor_02(string accessibility)
{
var sourceA =
$@".class public sealed S extends [mscorlib]System.ValueType
{{
.method {accessibility} hidebysig specialname rtspecialname instance void .ctor() cil managed {{ ret }}
}}";
var refA = CompileIL(sourceA);
var sourceB =
@"using System;
class Program
{
static T CreateNew<T>() where T : new() => new T();
static T CreateStruct1<T>() where T : struct => new T();
static T CreateStruct2<T>() where T : struct => CreateNew<T>();
static string Invoke(Func<object> f)
{
object obj;
try
{
obj = f();
}
catch (Exception e)
{
obj = e;
}
return obj.GetType().FullName;
}
static void Main()
{
Console.WriteLine(Invoke(() => new S()));
Console.WriteLine(Invoke(() => CreateNew<S>()));
Console.WriteLine(Invoke(() => CreateStruct1<S>()));
Console.WriteLine(Invoke(() => CreateStruct2<S>()));
}
}";
CompileAndVerify(sourceB, references: new[] { refA }, expectedOutput:
@"S
System.MissingMethodException
System.MissingMethodException
System.MissingMethodException");
}
[InlineData("internal")]
[InlineData("private")]
[Theory]
public void NonPublicParameterlessConstructor_03(string accessibility)
{
var sourceA =
$@"public struct S
{{
{accessibility}
S() {{ }}
}}";
var comp = CreateCompilation(sourceA);
comp.VerifyDiagnostics(
// (4,5): error CS8938: The parameterless struct constructor must be 'public'.
// S() { }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "S").WithLocation(4, 5));
var refA = comp.ToMetadataReference();
var sourceB =
@"class Program
{
static T CreateNew<T>() where T : new() => new T();
static T CreateStruct<T>() where T : struct => new T();
static void Main()
{
_ = new S();
_ = CreateNew<S>();
_ = CreateStruct<S>();
}
}";
var expectedDiagnostics = new[]
{
// (7,17): error CS0122: 'S.S()' is inaccessible due to its protection level
// _ = new S();
Diagnostic(ErrorCode.ERR_BadAccess, "S").WithArguments("S.S()").WithLocation(7, 17),
// (8,13): error CS0310: 'S' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Program.CreateNew<T>()'
// _ = CreateNew<S>();
Diagnostic(ErrorCode.ERR_NewConstraintNotSatisfied, "CreateNew<S>").WithArguments("Program.CreateNew<T>()", "T", "S").WithLocation(8, 13),
};
comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(expectedDiagnostics);
comp = CreateCompilation(sourceB, references: new[] { refA });
comp.VerifyDiagnostics(expectedDiagnostics);
}
[InlineData("internal")]
[InlineData("protected")]
[InlineData("protected internal")]
[InlineData("private")]
[InlineData("private protected")]
[Theory]
public void PublicConstructorPrivateStruct_NewConstraint(string accessibility)
{
var sourceA =
$@"partial class Program
{{
{accessibility} struct S
{{
public readonly bool Initialized;
public S()
{{
Initialized = true;
}}
}}
}}";
var sourceB =
@"using System;
partial class Program
{
static T CreateNew<T>() where T : new() => new T();
static void Main()
{
Console.WriteLine(CreateNew<S>().Initialized);
}
}";
CompileAndVerify(new[] { sourceA, sourceB }, expectedOutput: "True");
}
[Fact]
public void ThisInitializer_01()
{
var source =
@"using static System.Console;
using static Program;
struct S1
{
internal int Value;
public S1() { Value = Two(); }
internal S1(object obj) : this() { }
}
struct S2
{
internal int Value;
public S2() : this(null) { }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"Two()
new S1().Value: 2
Two()
new S1(null).Value: 2
Three()
new S2().Value: 3
");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Two()""
IL_0006: stfld ""int S1.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Three()""
IL_0006: stfld ""int S2.Value""
IL_000b: ret
}");
}
[Fact]
public void ThisInitializer_02()
{
var source =
@"using static System.Console;
using static Program;
struct S1
{
internal int Value;
public S1() { Value = Two(); }
internal S1(object obj) : this() { Value = Three(); }
}
struct S2
{
internal int Value;
public S2() : this(null) { Value = Two(); }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"Two()
new S1().Value: 2
Two()
Three()
new S1(null).Value: 3
Three()
Two()
new S2().Value: 2
");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Two()""
IL_0006: stfld ""int S1.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ldarg.0
IL_0007: call ""int Program.Three()""
IL_000c: stfld ""int S1.Value""
IL_0011: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.Three()""
IL_0006: stfld ""int S2.Value""
IL_000b: ret
}");
}
[Fact]
public void ThisInitializer_03()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value = One();
internal S0(object obj) : this() { }
}
struct S1
{
internal int Value = One();
public S1() { }
internal S1(object obj) : this() { }
}
struct S2
{
internal int Value = One();
public S2() : this(null) { }
S2(object obj) { }
}
class Program
{
internal static int One() { WriteLine(""One()""); return 1; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(null).Value: {new S0(null).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput: @"
new S0().Value: 0
One()
new S0(null).Value: 1
One()
new S1().Value: 1
One()
new S1(null).Value: 1
One()
new S2().Value: 1
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S0.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S1.Value""
IL_000b: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 12 (0xc)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S2.Value""
IL_000b: ret
}");
}
[Fact]
public void ThisInitializer_04()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value = One();
internal S0(object obj) : this() { Value = Two(); }
}
struct S1
{
internal int Value = One();
public S1() { Value = Two(); }
internal S1(object obj) : this() { Value = Three(); }
}
struct S2
{
internal int Value = One();
public S2() : this(null) { Value = Two(); }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int One() { WriteLine(""One()""); return 1; }
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(null).Value: {new S0(null).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"new S0().Value: 0
One()
Two()
new S0(null).Value: 2
One()
Two()
new S1().Value: 2
One()
Two()
Three()
new S1(null).Value: 3
One()
Three()
Two()
new S2().Value: 2
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(object)",
@"{
// Code size 23 (0x17)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S0.Value""
IL_000b: ldarg.0
IL_000c: call ""int Program.Two()""
IL_0011: stfld ""int S0.Value""
IL_0016: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 23 (0x17)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S1.Value""
IL_000b: ldarg.0
IL_000c: call ""int Program.Two()""
IL_0011: stfld ""int S1.Value""
IL_0016: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ldarg.0
IL_0007: call ""int Program.Three()""
IL_000c: stfld ""int S1.Value""
IL_0011: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 23 (0x17)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""int Program.One()""
IL_0006: stfld ""int S2.Value""
IL_000b: ldarg.0
IL_000c: call ""int Program.Three()""
IL_0011: stfld ""int S2.Value""
IL_0016: ret
}");
}
/// <summary>
/// Initializers with default values to verify that the decision whether
/// to execute an initializer is independent of the initializer value.
/// </summary>
[Fact]
public void ThisInitializer_05()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value = 0;
internal S0(object obj) : this() { Value = Two(); }
}
struct S1
{
internal int Value = 0;
public S1() { Value = Two(); }
internal S1(object obj) : this() { Value = Three(); }
}
struct S2
{
internal int Value = 0;
public S2() : this(null) { Value = Two(); }
S2(object obj) { Value = Three(); }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
internal static int Three() { WriteLine(""Three()""); return 3; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(null).Value: {new S0(null).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(null).Value: {new S1(null).Value}"");
WriteLine($""new S2().Value: {new S2().Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"new S0().Value: 0
Two()
new S0(null).Value: 2
Two()
new S1().Value: 2
Two()
Three()
new S1(null).Value: 3
Three()
Two()
new S2().Value: 2
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(object)",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: stfld ""int S0.Value""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S0.Value""
IL_0012: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: stfld ""int S1.Value""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S1.Value""
IL_0012: ret
}");
verifier.VerifyIL("S1..ctor(object)",
@"{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call ""S1..ctor()""
IL_0006: ldarg.0
IL_0007: call ""int Program.Three()""
IL_000c: stfld ""int S1.Value""
IL_0011: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: call ""S2..ctor(object)""
IL_0007: ldarg.0
IL_0008: call ""int Program.Two()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
verifier.VerifyIL("S2..ctor(object)",
@"{
// Code size 19 (0x13)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: stfld ""int S2.Value""
IL_0007: ldarg.0
IL_0008: call ""int Program.Three()""
IL_000d: stfld ""int S2.Value""
IL_0012: ret
}");
}
[Fact]
public void ThisInitializer_06()
{
var source =
@"using static System.Console;
using static Program;
struct S0
{
internal int Value;
public S0(params object[] args) { Value = Two(); }
public S0(int i) : this() { }
}
struct S1
{
internal int Value;
public S1(object obj = null) { Value = Two(); }
public S1(int i) : this() { }
}
class Program
{
internal static int Two() { WriteLine(""Two()""); return 2; }
static void Main()
{
WriteLine($""new S0().Value: {new S0().Value}"");
WriteLine($""new S0(0).Value: {new S0(0).Value}"");
WriteLine($""new S0((object)0).Value: {new S0((object)0).Value}"");
WriteLine($""new S1().Value: {new S1().Value}"");
WriteLine($""new S1(1).Value: {new S1(1).Value}"");
WriteLine($""new S1((object)1).Value: {new S1((object)1).Value}"");
}
}";
var verifier = CompileAndVerify(source, expectedOutput:
@"new S0().Value: 0
new S0(0).Value: 0
Two()
new S0((object)0).Value: 2
new S1().Value: 0
new S1(1).Value: 0
Two()
new S1((object)1).Value: 2
");
verifier.VerifyMissing("S0..ctor()");
verifier.VerifyIL("S0..ctor(int)",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: initobj ""S0""
IL_0007: ret
}");
verifier.VerifyMissing("S1..ctor()");
verifier.VerifyIL("S1..ctor(int)",
@"{
// Code size 8 (0x8)
.maxstack 1
IL_0000: ldarg.0
IL_0001: initobj ""S1""
IL_0007: ret
}");
}
[Fact]
public void FieldInitializers_None()
{
var source =
@"#pragma warning disable 649
using System;
struct S0
{
object X;
object Y;
public override string ToString() => (X, Y).ToString();
}
struct S1
{
object X;
object Y;
public S1() { Y = 1; }
public override string ToString() => (X, Y).ToString();
}
struct S2
{
object X;
object Y;
public S2(object y) { Y = y; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S0());
Console.WriteLine(new S1());
Console.WriteLine(new S2());
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (13,12): error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
// public S1() { Y = 1; }
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "S1").WithArguments("parameterless struct constructors", "10.0").WithLocation(13, 12),
// (13,12): error CS0171: Field 'S1.X' must be fully assigned before control is returned to the caller
// public S1() { Y = 1; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S1").WithArguments("S1.X").WithLocation(13, 12),
// (20,12): error CS0171: Field 'S2.X' must be fully assigned before control is returned to the caller
// public S2(object y) { Y = y; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S2").WithArguments("S2.X").WithLocation(20, 12));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe);
comp.VerifyDiagnostics(
// (13,12): error CS0171: Field 'S1.X' must be fully assigned before control is returned to the caller
// public S1() { Y = 1; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S1").WithArguments("S1.X").WithLocation(13, 12),
// (20,12): error CS0171: Field 'S2.X' must be fully assigned before control is returned to the caller
// public S2(object y) { Y = y; }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S2").WithArguments("S2.X").WithLocation(20, 12));
}
[Fact]
public void FieldInitializers_01()
{
var source =
@"#pragma warning disable 649
using System;
struct S1
{
object X = null;
object Y;
public override string ToString() => (X, Y).ToString();
}
struct S2
{
object X = null;
object Y;
public S2() { Y = 1; }
public override string ToString() => (X, Y).ToString();
}
struct S3
{
object X;
object Y = null;
public S3(object x) { X = x; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S1());
Console.WriteLine(new S2());
Console.WriteLine(new S3());
}
}";
var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9);
comp.VerifyDiagnostics(
// (5,12): error CS8773: Feature 'struct field initializers' is not available in C# 9.0. Please use language version 10.0 or greater.
// object X = null;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "X").WithArguments("struct field initializers", "10.0").WithLocation(5, 12),
// (11,12): error CS8773: Feature 'struct field initializers' is not available in C# 9.0. Please use language version 10.0 or greater.
// object X = null;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "X").WithArguments("struct field initializers", "10.0").WithLocation(11, 12),
// (13,12): error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
// public S2() { Y = 1; }
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "S2").WithArguments("parameterless struct constructors", "10.0").WithLocation(13, 12),
// (19,12): error CS8773: Feature 'struct field initializers' is not available in C# 9.0. Please use language version 10.0 or greater.
// object Y = null;
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "Y").WithArguments("struct field initializers", "10.0").WithLocation(19, 12));
comp = CreateCompilation(source, options: TestOptions.ReleaseExe);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput:
@"(, )
(, 1)
(, )");
verifier.VerifyIL("Program.Main",
@"{
// Code size 50 (0x32)
.maxstack 1
.locals init (S3 V_0)
IL_0000: newobj ""S1..ctor()""
IL_0005: box ""S1""
IL_000a: call ""void System.Console.WriteLine(object)""
IL_000f: newobj ""S2..ctor()""
IL_0014: box ""S2""
IL_0019: call ""void System.Console.WriteLine(object)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3""
IL_0026: ldloc.0
IL_0027: box ""S3""
IL_002c: call ""void System.Console.WriteLine(object)""
IL_0031: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld ""object S1.X""
IL_0007: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 20 (0x14)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld ""object S2.X""
IL_0007: ldarg.0
IL_0008: ldc.i4.1
IL_0009: box ""int""
IL_000e: stfld ""object S2.Y""
IL_0013: ret
}");
verifier.VerifyMissing("S3..ctor()");
verifier.VerifyIL("S3..ctor(object)",
@"{
// Code size 15 (0xf)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldnull
IL_0002: stfld ""object S3.Y""
IL_0007: ldarg.0
IL_0008: ldarg.1
IL_0009: stfld ""object S3.X""
IL_000e: ret
}");
}
[Fact]
public void FieldInitializers_02()
{
var source =
@"#pragma warning disable 649
using System;
struct S1
{
internal object X = 1;
internal object Y;
public override string ToString() => (X, Y).ToString();
}
struct S2
{
internal object X = 2;
internal object Y;
public S2() { Y = 2; }
public override string ToString() => (X, Y).ToString();
}
struct S3
{
internal object X = 3;
internal object Y;
public S3(object _) { Y = 3; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S1());
Console.WriteLine(new S2());
Console.WriteLine(new S3());
Console.WriteLine(new S1 { });
Console.WriteLine(new S2 { });
Console.WriteLine(new S3 { });
Console.WriteLine(new S1 { Y = 2 });
Console.WriteLine(new S2 { Y = 4 });
Console.WriteLine(new S3 { Y = 6 });
}
}";
var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput:
@"(1, )
(2, 2)
(, )
(1, )
(2, 2)
(, )
(1, 2)
(2, 4)
(, 6)");
verifier.VerifyIL("Program.Main",
@"{
// Code size 193 (0xc1)
.maxstack 2
.locals init (S3 V_0,
S1 V_1,
S2 V_2)
IL_0000: newobj ""S1..ctor()""
IL_0005: box ""S1""
IL_000a: call ""void System.Console.WriteLine(object)""
IL_000f: newobj ""S2..ctor()""
IL_0014: box ""S2""
IL_0019: call ""void System.Console.WriteLine(object)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3""
IL_0026: ldloc.0
IL_0027: box ""S3""
IL_002c: call ""void System.Console.WriteLine(object)""
IL_0031: newobj ""S1..ctor()""
IL_0036: box ""S1""
IL_003b: call ""void System.Console.WriteLine(object)""
IL_0040: newobj ""S2..ctor()""
IL_0045: box ""S2""
IL_004a: call ""void System.Console.WriteLine(object)""
IL_004f: ldloca.s V_0
IL_0051: initobj ""S3""
IL_0057: ldloc.0
IL_0058: box ""S3""
IL_005d: call ""void System.Console.WriteLine(object)""
IL_0062: ldloca.s V_1
IL_0064: call ""S1..ctor()""
IL_0069: ldloca.s V_1
IL_006b: ldc.i4.2
IL_006c: box ""int""
IL_0071: stfld ""object S1.Y""
IL_0076: ldloc.1
IL_0077: box ""S1""
IL_007c: call ""void System.Console.WriteLine(object)""
IL_0081: ldloca.s V_2
IL_0083: call ""S2..ctor()""
IL_0088: ldloca.s V_2
IL_008a: ldc.i4.4
IL_008b: box ""int""
IL_0090: stfld ""object S2.Y""
IL_0095: ldloc.2
IL_0096: box ""S2""
IL_009b: call ""void System.Console.WriteLine(object)""
IL_00a0: ldloca.s V_0
IL_00a2: initobj ""S3""
IL_00a8: ldloca.s V_0
IL_00aa: ldc.i4.6
IL_00ab: box ""int""
IL_00b0: stfld ""object S3.Y""
IL_00b5: ldloc.0
IL_00b6: box ""S3""
IL_00bb: call ""void System.Console.WriteLine(object)""
IL_00c0: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 13 (0xd)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: box ""int""
IL_0007: stfld ""object S1.X""
IL_000c: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.2
IL_0002: box ""int""
IL_0007: stfld ""object S2.X""
IL_000c: ldarg.0
IL_000d: ldc.i4.2
IL_000e: box ""int""
IL_0013: stfld ""object S2.Y""
IL_0018: ret
}");
verifier.VerifyMissing("S3..ctor()");
verifier.VerifyIL("S3..ctor(object)",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.3
IL_0002: box ""int""
IL_0007: stfld ""object S3.X""
IL_000c: ldarg.0
IL_000d: ldc.i4.3
IL_000e: box ""int""
IL_0013: stfld ""object S3.Y""
IL_0018: ret
}");
}
// As above but with auto-properties.
[Fact]
public void FieldInitializers_03()
{
var source =
@"#pragma warning disable 649
using System;
struct S1
{
internal object X { get; } = 1;
internal object Y { get; }
public override string ToString() => (X, Y).ToString();
}
struct S2
{
internal object X { get; init; } = 2;
internal object Y { get; init; }
public S2() { Y = 2; }
public override string ToString() => (X, Y).ToString();
}
struct S3
{
internal object X { get; private set; } = 3;
internal object Y { get; set; }
public S3(object _) { Y = 3; }
public override string ToString() => (X, Y).ToString();
}
class Program
{
static void Main()
{
Console.WriteLine(new S1());
Console.WriteLine(new S2());
Console.WriteLine(new S3());
Console.WriteLine(new S1 { });
Console.WriteLine(new S2 { });
Console.WriteLine(new S3 { });
Console.WriteLine(new S2 { Y = 4 });
Console.WriteLine(new S3 { Y = 6 });
}
}";
var verifier = CompileAndVerify(new[] { source, IsExternalInitTypeDefinition }, options: TestOptions.ReleaseExe, verify: Verification.Skipped, expectedOutput:
@"(1, )
(2, 2)
(, )
(1, )
(2, 2)
(, )
(2, 4)
(, 6)");
verifier.VerifyIL("Program.Main",
@"{
// Code size 162 (0xa2)
.maxstack 2
.locals init (S3 V_0,
S2 V_1)
IL_0000: newobj ""S1..ctor()""
IL_0005: box ""S1""
IL_000a: call ""void System.Console.WriteLine(object)""
IL_000f: newobj ""S2..ctor()""
IL_0014: box ""S2""
IL_0019: call ""void System.Console.WriteLine(object)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3""
IL_0026: ldloc.0
IL_0027: box ""S3""
IL_002c: call ""void System.Console.WriteLine(object)""
IL_0031: newobj ""S1..ctor()""
IL_0036: box ""S1""
IL_003b: call ""void System.Console.WriteLine(object)""
IL_0040: newobj ""S2..ctor()""
IL_0045: box ""S2""
IL_004a: call ""void System.Console.WriteLine(object)""
IL_004f: ldloca.s V_0
IL_0051: initobj ""S3""
IL_0057: ldloc.0
IL_0058: box ""S3""
IL_005d: call ""void System.Console.WriteLine(object)""
IL_0062: ldloca.s V_1
IL_0064: call ""S2..ctor()""
IL_0069: ldloca.s V_1
IL_006b: ldc.i4.4
IL_006c: box ""int""
IL_0071: call ""void S2.Y.init""
IL_0076: ldloc.1
IL_0077: box ""S2""
IL_007c: call ""void System.Console.WriteLine(object)""
IL_0081: ldloca.s V_0
IL_0083: initobj ""S3""
IL_0089: ldloca.s V_0
IL_008b: ldc.i4.6
IL_008c: box ""int""
IL_0091: call ""void S3.Y.set""
IL_0096: ldloc.0
IL_0097: box ""S3""
IL_009c: call ""void System.Console.WriteLine(object)""
IL_00a1: ret
}");
verifier.VerifyIL("S1..ctor()",
@"{
// Code size 13 (0xd)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: box ""int""
IL_0007: stfld ""object S1.<X>k__BackingField""
IL_000c: ret
}");
verifier.VerifyIL("S2..ctor()",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.2
IL_0002: box ""int""
IL_0007: stfld ""object S2.<X>k__BackingField""
IL_000c: ldarg.0
IL_000d: ldc.i4.2
IL_000e: box ""int""
IL_0013: call ""void S2.Y.init""
IL_0018: ret
}");
verifier.VerifyMissing("S3..ctor()");
verifier.VerifyIL("S3..ctor(object)",
@"{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.3
IL_0002: box ""int""
IL_0007: stfld ""object S3.<X>k__BackingField""
IL_000c: ldarg.0
IL_000d: ldc.i4.3
IL_000e: box ""int""
IL_0013: call ""void S3.Y.set""
IL_0018: ret
}");
}
[Fact]
public void FieldInitializers_04()
{
var source =
@"#pragma warning disable 649
using System;
struct S1<T> { internal int X = 1; }
struct S2<T> { internal int X = 2; public S2() { } }
struct S3<T> { internal int X = 3; public S3(int _) { } }
class Program
{
static void Main()
{
Console.WriteLine(new S1<object>().X);
Console.WriteLine(new S2<object>().X);
Console.WriteLine(new S3<object>().X);
}
}";
var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput:
@"1
2
0");
verifier.VerifyIL("Program.Main",
@"{
// Code size 50 (0x32)
.maxstack 1
.locals init (S3<object> V_0)
IL_0000: newobj ""S1<object>..ctor()""
IL_0005: ldfld ""int S1<object>.X""
IL_000a: call ""void System.Console.WriteLine(int)""
IL_000f: newobj ""S2<object>..ctor()""
IL_0014: ldfld ""int S2<object>.X""
IL_0019: call ""void System.Console.WriteLine(int)""
IL_001e: ldloca.s V_0
IL_0020: initobj ""S3<object>""
IL_0026: ldloc.0
IL_0027: ldfld ""int S3<object>.X""
IL_002c: call ""void System.Console.WriteLine(int)""
IL_0031: ret
}");
}
[Fact]
public void FieldInitializers_05()
{
var source =
@"#pragma warning disable 649
using System;
class A<T>
{
internal struct S1 { internal int X { get; } = 1; }
internal struct S2 { internal int X { get; init; } = 2; public S2() { } }
internal struct S3 { internal int X { get; set; } = 3; public S3(int _) { } }
}
class Program
{
static void Main()
{
Console.WriteLine(new A<object>.S1().X);
Console.WriteLine(new A<object>.S2().X);
Console.WriteLine(new A<object>.S3().X);
}
}";
var verifier = CompileAndVerify(new[] { source, IsExternalInitTypeDefinition }, options: TestOptions.ReleaseExe, verify: Verification.Skipped, expectedOutput:
@"1
2
0");
verifier.VerifyIL("Program.Main",
@"{
// Code size 56 (0x38)
.maxstack 2
.locals init (A<object>.S1 V_0,
A<object>.S2 V_1,
A<object>.S3 V_2)
IL_0000: newobj ""A<object>.S1..ctor()""
IL_0005: stloc.0
IL_0006: ldloca.s V_0
IL_0008: call ""readonly int A<object>.S1.X.get""
IL_000d: call ""void System.Console.WriteLine(int)""
IL_0012: newobj ""A<object>.S2..ctor()""
IL_0017: stloc.1
IL_0018: ldloca.s V_1
IL_001a: call ""readonly int A<object>.S2.X.get""
IL_001f: call ""void System.Console.WriteLine(int)""
IL_0024: ldloca.s V_2
IL_0026: dup
IL_0027: initobj ""A<object>.S3""
IL_002d: call ""readonly int A<object>.S3.X.get""
IL_0032: call ""void System.Console.WriteLine(int)""
IL_0037: ret
}");
verifier.VerifyIL("A<T>.S1..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: stfld ""int A<T>.S1.<X>k__BackingField""
IL_0007: ret
}");
verifier.VerifyIL("A<T>.S2..ctor()",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.2
IL_0002: stfld ""int A<T>.S2.<X>k__BackingField""
IL_0007: ret
}");
verifier.VerifyIL("A<T>.S3..ctor(int)",
@"{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.3
IL_0002: stfld ""int A<T>.S3.<X>k__BackingField""
IL_0007: ret
}");
}
[Fact]
public void ExpressionTrees()
{
var source =
@"#pragma warning disable 649
using System;
using System.Linq.Expressions;
struct S0
{
int X;
public override string ToString() => X.ToString();
}
struct S1
{
int X = 1;
public override string ToString() => X.ToString();
}
struct S2
{
int X = 2;
public S2() { }
public override string ToString() => X.ToString();
}
class Program
{
static void Main()
{
Report(() => new S0());
Report(() => new S1());
Report(() => new S2());
}
static void Report<T>(Expression<Func<T>> e)
{
var t = e.Compile().Invoke();
Console.WriteLine(t);
}
}";
var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput:
@"0
1
2");
verifier.VerifyIL("Program.Main",
@"{
// Code size 111 (0x6f)
.maxstack 2
IL_0000: ldtoken ""S0""
IL_0005: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_000a: call ""System.Linq.Expressions.NewExpression System.Linq.Expressions.Expression.New(System.Type)""
IL_000f: call ""System.Linq.Expressions.ParameterExpression[] System.Array.Empty<System.Linq.Expressions.ParameterExpression>()""
IL_0014: call ""System.Linq.Expressions.Expression<System.Func<S0>> System.Linq.Expressions.Expression.Lambda<System.Func<S0>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
IL_0019: call ""void Program.Report<S0>(System.Linq.Expressions.Expression<System.Func<S0>>)""
IL_001e: ldtoken ""S1..ctor()""
IL_0023: call ""System.Reflection.MethodBase System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle)""
IL_0028: castclass ""System.Reflection.ConstructorInfo""
IL_002d: call ""System.Linq.Expressions.Expression[] System.Array.Empty<System.Linq.Expressions.Expression>()""
IL_0032: call ""System.Linq.Expressions.NewExpression System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression>)""
IL_0037: call ""System.Linq.Expressions.ParameterExpression[] System.Array.Empty<System.Linq.Expressions.ParameterExpression>()""
IL_003c: call ""System.Linq.Expressions.Expression<System.Func<S1>> System.Linq.Expressions.Expression.Lambda<System.Func<S1>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
IL_0041: call ""void Program.Report<S1>(System.Linq.Expressions.Expression<System.Func<S1>>)""
IL_0046: ldtoken ""S2..ctor()""
IL_004b: call ""System.Reflection.MethodBase System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle)""
IL_0050: castclass ""System.Reflection.ConstructorInfo""
IL_0055: call ""System.Linq.Expressions.Expression[] System.Array.Empty<System.Linq.Expressions.Expression>()""
IL_005a: call ""System.Linq.Expressions.NewExpression System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression>)""
IL_005f: call ""System.Linq.Expressions.ParameterExpression[] System.Array.Empty<System.Linq.Expressions.ParameterExpression>()""
IL_0064: call ""System.Linq.Expressions.Expression<System.Func<S2>> System.Linq.Expressions.Expression.Lambda<System.Func<S2>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
IL_0069: call ""void Program.Report<S2>(System.Linq.Expressions.Expression<System.Func<S2>>)""
IL_006e: ret
}");
}
[Fact]
public void Retargeting_01()
{
var sourceA =
@"public struct S1
{
public int X = 1;
}
public struct S2
{
public int X = 2;
public S2() { }
}
public struct S3
{
public int X = 3;
public S3(object _) { }
}";
var comp = CreateCompilation(sourceA, targetFramework: TargetFramework.Mscorlib40);
var refA = comp.ToMetadataReference();
var typeA = comp.GetMember<FieldSymbol>("S1.X").Type;
var corLibA = comp.Assembly.CorLibrary;
Assert.Equal(corLibA, typeA.ContainingAssembly);
var sourceB =
@"using System;
class Program
{
static void Main()
{
Console.WriteLine(new S1().X);
Console.WriteLine(new S2().X);
Console.WriteLine(new S3().X);
}
}";
comp = CreateCompilation(sourceB, references: new[] { refA }, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Mscorlib45);
CompileAndVerify(comp, expectedOutput:
@"1
2
0");
var corLibB = comp.Assembly.CorLibrary;
Assert.NotEqual(corLibA, corLibB);
var field = comp.GetMember<FieldSymbol>("S1.X");
Assert.IsType<Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingFieldSymbol>(field);
var typeB = (NamedTypeSymbol)field.Type;
Assert.Equal(corLibB, typeB.ContainingAssembly);
}
[Fact]
public void NullableAnalysis_01()
{
var source =
@"#pragma warning disable 169
#nullable enable
struct S0
{
object F0;
}
struct S1
{
object F1;
public S1() { }
}
struct S2
{
object F2;
public S2() : this(null) { }
S2(object? obj) { }
}
struct S3
{
object F3;
public S3() { F3 = GetValue(); }
static object? GetValue() => null;
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (10,12): warning CS8618: Non-nullable field 'F1' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
// public S1() { }
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "S1").WithArguments("field", "F1").WithLocation(10, 12),
// (10,12): error CS0171: Field 'S1.F1' must be fully assigned before control is returned to the caller
// public S1() { }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S1").WithArguments("S1.F1").WithLocation(10, 12),
// (16,5): warning CS8618: Non-nullable field 'F2' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
// S2(object? obj) { }
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "S2").WithArguments("field", "F2").WithLocation(16, 5),
// (16,5): error CS0171: Field 'S2.F2' must be fully assigned before control is returned to the caller
// S2(object? obj) { }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S2").WithArguments("S2.F2").WithLocation(16, 5),
// (21,12): warning CS8618: Non-nullable field 'F3' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
// public S3() { F3 = GetValue(); }
Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "S3").WithArguments("field", "F3").WithLocation(21, 12),
// (21,24): warning CS8601: Possible null reference assignment.
// public S3() { F3 = GetValue(); }
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "GetValue()").WithLocation(21, 24));
}
[Fact]
public void NullableAnalysis_02()
{
var source =
@"#nullable enable
struct S0
{
object F0 = Utils.GetValue();
}
struct S1
{
object F1 = Utils.GetValue();
public S1() { }
}
struct S2
{
object F2 = Utils.GetValue();
public S2() : this(null) { }
S2(object obj) { }
}
static class Utils
{
internal static object? GetValue() => null;
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (4,17): warning CS8601: Possible null reference assignment.
// object F0 = Utils.GetValue();
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "Utils.GetValue()").WithLocation(4, 17),
// (8,17): warning CS8601: Possible null reference assignment.
// object F1 = Utils.GetValue();
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "Utils.GetValue()").WithLocation(8, 17),
// (13,17): warning CS8601: Possible null reference assignment.
// object F2 = Utils.GetValue();
Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "Utils.GetValue()").WithLocation(13, 17),
// (14,24): warning CS8625: Cannot convert null literal to non-nullable reference type.
// public S2() : this(null) { }
Diagnostic(ErrorCode.WRN_NullAsNonNullable, "null").WithLocation(14, 24));
}
[Fact]
public void DefiniteAssignment()
{
var source =
@"#pragma warning disable 169
unsafe struct S0
{
fixed int Y[1];
}
unsafe struct S1
{
fixed int Y[1];
public S1() { }
}
unsafe struct S2
{
int X;
fixed int Y[1];
}
unsafe struct S3
{
int X;
fixed int Y[1];
public S3() { }
}
unsafe struct S4
{
int X = 4;
fixed int Y[1];
}
unsafe struct S5
{
int X;
fixed int Y[1];
public S5() { X = 5; }
}";
var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (20,12): error CS0171: Field 'S3.X' must be fully assigned before control is returned to the caller
// public S3() { }
Diagnostic(ErrorCode.ERR_UnassignedThis, "S3").WithArguments("S3.X").WithLocation(20, 12),
// (24,9): warning CS0414: The field 'S4.X' is assigned but its value is never used
// int X = 4;
Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "X").WithArguments("S4.X").WithLocation(24, 9),
// (29,9): warning CS0414: The field 'S5.X' is assigned but its value is never used
// int X;
Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "X").WithArguments("S5.X").WithLocation(29, 9));
}
[Fact]
public void ParameterDefaultValues_01()
{
var source =
@"struct S1 { }
struct S2 { public S2() { } }
struct S3 { internal S3() { } }
struct S4 { private S4() { } }
class Program
{
static void F1(S1 s = default) { }
static void F2(S2 s = default) { }
static void F3(S3 s = default) { }
static void F4(S4 s = default) { }
static void G1(S1 s = new()) { }
static void G2(S2 s = new()) { }
static void G3(S3 s = new()) { }
static void G4(S4 s = new()) { }
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (3,22): error CS8938: The parameterless struct constructor must be 'public'.
// struct S3 { internal S3() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "S3").WithLocation(3, 22),
// (4,21): error CS8938: The parameterless struct constructor must be 'public'.
// struct S4 { private S4() { } }
Diagnostic(ErrorCode.ERR_NonPublicParameterlessStructConstructor, "S4").WithLocation(4, 21),
// (12,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G2(S2 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(12, 27),
// (13,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G3(S3 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(13, 27),
// (14,27): error CS0122: 'S4.S4()' is inaccessible due to its protection level
// static void G4(S4 s = new()) { }
Diagnostic(ErrorCode.ERR_BadAccess, "new()").WithArguments("S4.S4()").WithLocation(14, 27),
// (14,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G4(S4 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(14, 27));
}
[Fact]
public void ParameterDefaultValues_02()
{
var source =
@"struct S1
{
object X = 1;
}
struct S2
{
object X = 2;
public S2() { }
}
struct S3
{
object X = 3;
public S3(object x) { X = x; }
}
class Program
{
static void F1(S1 s = default) { }
static void F2(S2 s = default) { }
static void F3(S3 s = default) { }
static void G1(S1 s = new()) { }
static void G2(S2 s = new()) { }
static void G3(S3 s = new()) { }
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (20,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G1(S1 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(20, 27),
// (21,27): error CS1736: Default parameter value for 's' must be a compile-time constant
// static void G2(S2 s = new()) { }
Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "new()").WithArguments("s").WithLocation(21, 27));
}
[Fact]
public void Constants()
{
var source =
@"struct S0
{
}
struct S1
{
object X = 1;
}
struct S2
{
public S2() { }
}
class Program
{
const object d0 = default(S0);
const object d1 = default(S1);
const object d2 = default(S2);
const object s0 = new S0();
const object s1 = new S1();
const object s2 = new S2();
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (14,23): error CS0133: The expression being assigned to 'Program.d0' must be constant
// const object d0 = default(S0);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(S0)").WithArguments("Program.d0").WithLocation(14, 23),
// (15,23): error CS0133: The expression being assigned to 'Program.d1' must be constant
// const object d1 = default(S1);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(S1)").WithArguments("Program.d1").WithLocation(15, 23),
// (16,23): error CS0133: The expression being assigned to 'Program.d2' must be constant
// const object d2 = default(S2);
Diagnostic(ErrorCode.ERR_NotConstantExpression, "default(S2)").WithArguments("Program.d2").WithLocation(16, 23),
// (17,23): error CS0133: The expression being assigned to 'Program.s0' must be constant
// const object s0 = new S0();
Diagnostic(ErrorCode.ERR_NotConstantExpression, "new S0()").WithArguments("Program.s0").WithLocation(17, 23),
// (18,23): error CS0133: The expression being assigned to 'Program.s1' must be constant
// const object s1 = new S1();
Diagnostic(ErrorCode.ERR_NotConstantExpression, "new S1()").WithArguments("Program.s1").WithLocation(18, 23),
// (19,23): error CS0133: The expression being assigned to 'Program.s2' must be constant
// const object s2 = new S2();
Diagnostic(ErrorCode.ERR_NotConstantExpression, "new S2()").WithArguments("Program.s2").WithLocation(19, 23));
}
[Fact]
public void NoPIA()
{
var sourceA =
@"using System.Runtime.InteropServices;
[assembly: ImportedFromTypeLib(""_.dll"")]
[assembly: Guid(""9758B46C-5297-4832-BB58-F2B5B78B0D01"")]
[ComImport()]
[Guid(""6D947BE5-75B1-4D97-B444-2720624761D7"")]
public interface I
{
S0 F0();
S1 F1();
S2 F2();
}
public struct S0
{
}
public struct S1
{
public S1() { }
}
public struct S2
{
object F = 2;
}";
var comp = CreateCompilationWithMscorlib40(sourceA);
var refA = comp.EmitToImageReference(embedInteropTypes: true);
var sourceB =
@"class Program
{
static void M(I i)
{
var s0 = i.F0();
var s1 = i.F1();
var s2 = i.F2();
}
}";
comp = CreateCompilationWithMscorlib40(sourceB, references: new[] { refA });
comp.VerifyEmitDiagnostics(
// (6,18): error CS1757: Embedded interop struct 'S1' can contain only public instance fields.
// var s1 = i.F1();
Diagnostic(ErrorCode.ERR_InteropStructContainsMethods, "i.F1()").WithArguments("S1").WithLocation(6, 18),
// (7,18): error CS1757: Embedded interop struct 'S2' can contain only public instance fields.
// var s2 = i.F2();
Diagnostic(ErrorCode.ERR_InteropStructContainsMethods, "i.F2()").WithArguments("S2").WithLocation(7, 18));
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Core/Portable/MetadataReader/PEModule.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Threading;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Symbols;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// A set of helpers for extracting elements from metadata.
/// This type is not responsible for managing the underlying storage
/// backing the PE image.
/// </summary>
internal sealed class PEModule : IDisposable
{
/// <summary>
/// We need to store reference to the module metadata to keep the metadata alive while
/// symbols have reference to PEModule.
/// </summary>
private readonly ModuleMetadata _owner;
// Either we have PEReader or we have pointer and size of the metadata blob:
private readonly PEReader _peReaderOpt;
private readonly IntPtr _metadataPointerOpt;
private readonly int _metadataSizeOpt;
private MetadataReader _lazyMetadataReader;
private ImmutableArray<AssemblyIdentity> _lazyAssemblyReferences;
/// <summary>
/// This is a tuple for optimization purposes. In valid cases, we need to store
/// only one assembly index per type. However, if we found more than one, we
/// keep a second one as well to use it for error reporting.
/// We use -1 in case there was no forward.
/// </summary>
private Dictionary<string, (int FirstIndex, int SecondIndex)> _lazyForwardedTypesToAssemblyIndexMap;
private readonly Lazy<IdentifierCollection> _lazyTypeNameCollection;
private readonly Lazy<IdentifierCollection> _lazyNamespaceNameCollection;
private string _lazyName;
private bool _isDisposed;
/// <summary>
/// Using <see cref="ThreeState"/> as a type for atomicity.
/// </summary>
private ThreeState _lazyContainsNoPiaLocalTypes;
/// <summary>
/// If bitmap is not null, each bit indicates whether a TypeDef
/// with corresponding RowId has been checked if it is a NoPia
/// local type. If the bit is 1, local type will have an entry
/// in m_lazyTypeDefToTypeIdentifierMap.
/// </summary>
private int[] _lazyNoPiaLocalTypeCheckBitMap;
/// <summary>
/// For each TypeDef that has 1 in m_lazyNoPiaLocalTypeCheckBitMap,
/// this map stores corresponding TypeIdentifier AttributeInfo.
/// </summary>
private ConcurrentDictionary<TypeDefinitionHandle, AttributeInfo> _lazyTypeDefToTypeIdentifierMap;
// The module can be used by different compilations or different versions of the "same"
// compilation, which use different hash algorithms. Let's cache result for each distinct
// algorithm.
private readonly CryptographicHashProvider _hashesOpt;
#nullable enable
private delegate bool AttributeValueExtractor<T>(out T value, ref BlobReader sigReader);
private static readonly AttributeValueExtractor<string?> s_attributeStringValueExtractor = CrackStringInAttributeValue;
private static readonly AttributeValueExtractor<StringAndInt> s_attributeStringAndIntValueExtractor = CrackStringAndIntInAttributeValue;
private static readonly AttributeValueExtractor<bool> s_attributeBooleanValueExtractor = CrackBooleanInAttributeValue;
private static readonly AttributeValueExtractor<byte> s_attributeByteValueExtractor = CrackByteInAttributeValue;
private static readonly AttributeValueExtractor<short> s_attributeShortValueExtractor = CrackShortInAttributeValue;
private static readonly AttributeValueExtractor<int> s_attributeIntValueExtractor = CrackIntInAttributeValue;
private static readonly AttributeValueExtractor<long> s_attributeLongValueExtractor = CrackLongInAttributeValue;
// Note: not a general purpose helper
private static readonly AttributeValueExtractor<decimal> s_decimalValueInDecimalConstantAttributeExtractor = CrackDecimalInDecimalConstantAttribute;
private static readonly AttributeValueExtractor<ImmutableArray<bool>> s_attributeBoolArrayValueExtractor = CrackBoolArrayInAttributeValue;
private static readonly AttributeValueExtractor<ImmutableArray<byte>> s_attributeByteArrayValueExtractor = CrackByteArrayInAttributeValue;
private static readonly AttributeValueExtractor<ImmutableArray<string?>> s_attributeStringArrayValueExtractor = CrackStringArrayInAttributeValue;
private static readonly AttributeValueExtractor<ObsoleteAttributeData?> s_attributeDeprecatedDataExtractor = CrackDeprecatedAttributeData;
private static readonly AttributeValueExtractor<BoolAndStringArrayData> s_attributeBoolAndStringArrayValueExtractor = CrackBoolAndStringArrayInAttributeValue;
private static readonly AttributeValueExtractor<BoolAndStringData> s_attributeBoolAndStringValueExtractor = CrackBoolAndStringInAttributeValue;
internal struct BoolAndStringArrayData
{
public BoolAndStringArrayData(bool sense, ImmutableArray<string?> strings)
{
Sense = sense;
Strings = strings;
}
public readonly bool Sense;
public readonly ImmutableArray<string?> Strings;
}
internal struct BoolAndStringData
{
public BoolAndStringData(bool sense, string? @string)
{
Sense = sense;
String = @string;
}
public readonly bool Sense;
public readonly string? String;
}
#nullable disable
// 'ignoreAssemblyRefs' is used by the EE only, when debugging
// .NET Native, where the corlib may have assembly references
// (see https://github.com/dotnet/roslyn/issues/13275).
internal PEModule(ModuleMetadata owner, PEReader peReader, IntPtr metadataOpt, int metadataSizeOpt, bool includeEmbeddedInteropTypes, bool ignoreAssemblyRefs)
{
// shall not throw
Debug.Assert((peReader == null) ^ (metadataOpt == IntPtr.Zero && metadataSizeOpt == 0));
Debug.Assert(metadataOpt == IntPtr.Zero || metadataSizeOpt > 0);
_owner = owner;
_peReaderOpt = peReader;
_metadataPointerOpt = metadataOpt;
_metadataSizeOpt = metadataSizeOpt;
_lazyTypeNameCollection = new Lazy<IdentifierCollection>(ComputeTypeNameCollection);
_lazyNamespaceNameCollection = new Lazy<IdentifierCollection>(ComputeNamespaceNameCollection);
_hashesOpt = (peReader != null) ? new PEHashProvider(peReader) : null;
_lazyContainsNoPiaLocalTypes = includeEmbeddedInteropTypes ? ThreeState.False : ThreeState.Unknown;
if (ignoreAssemblyRefs)
{
_lazyAssemblyReferences = ImmutableArray<AssemblyIdentity>.Empty;
}
}
private sealed class PEHashProvider : CryptographicHashProvider
{
private readonly PEReader _peReader;
public PEHashProvider(PEReader peReader)
{
Debug.Assert(peReader != null);
_peReader = peReader;
}
internal override unsafe ImmutableArray<byte> ComputeHash(HashAlgorithm algorithm)
{
PEMemoryBlock block = _peReader.GetEntireImage();
byte[] hash;
using (var stream = new ReadOnlyUnmanagedMemoryStream(_peReader, (IntPtr)block.Pointer, block.Length))
{
hash = algorithm.ComputeHash(stream);
}
return ImmutableArray.Create(hash);
}
}
internal bool IsDisposed
{
get
{
return _isDisposed;
}
}
public void Dispose()
{
_isDisposed = true;
_peReaderOpt?.Dispose();
}
// for testing
internal PEReader PEReaderOpt
{
get
{
return _peReaderOpt;
}
}
internal MetadataReader MetadataReader
{
get
{
if (_lazyMetadataReader == null)
{
InitializeMetadataReader();
}
if (_isDisposed)
{
// Without locking, which might be expensive, we can't guarantee that the underlying memory
// won't be accessed after the metadata object is disposed. However we can do a cheap check here that
// handles most cases.
ThrowMetadataDisposed();
}
return _lazyMetadataReader;
}
}
private unsafe void InitializeMetadataReader()
{
MetadataReader newReader;
// PEModule is either created with metadata memory block or a PE reader.
if (_metadataPointerOpt != IntPtr.Zero)
{
newReader = new MetadataReader((byte*)_metadataPointerOpt, _metadataSizeOpt, MetadataReaderOptions.ApplyWindowsRuntimeProjections, StringTableDecoder.Instance);
}
else
{
Debug.Assert(_peReaderOpt != null);
// A workaround for https://github.com/dotnet/corefx/issues/1815
bool hasMetadata;
try
{
hasMetadata = _peReaderOpt.HasMetadata;
}
catch
{
hasMetadata = false;
}
if (!hasMetadata)
{
throw new BadImageFormatException(CodeAnalysisResources.PEImageDoesntContainManagedMetadata);
}
newReader = _peReaderOpt.GetMetadataReader(MetadataReaderOptions.ApplyWindowsRuntimeProjections, StringTableDecoder.Instance);
}
Interlocked.CompareExchange(ref _lazyMetadataReader, newReader, null);
}
private static void ThrowMetadataDisposed()
{
throw new ObjectDisposedException(nameof(ModuleMetadata));
}
#region Module level properties and methods
internal bool IsManifestModule
{
get
{
return MetadataReader.IsAssembly;
}
}
internal bool IsLinkedModule
{
get
{
return !MetadataReader.IsAssembly;
}
}
internal bool IsCOFFOnly
{
get
{
// default value if we only have metadata
if (_peReaderOpt == null)
{
return false;
}
return _peReaderOpt.PEHeaders.IsCoffOnly;
}
}
/// <summary>
/// Target architecture of the machine.
/// </summary>
internal Machine Machine
{
get
{
// platform agnostic if we only have metadata
if (_peReaderOpt == null)
{
return Machine.I386;
}
return _peReaderOpt.PEHeaders.CoffHeader.Machine;
}
}
/// <summary>
/// Indicates that this PE file makes Win32 calls. See CorPEKind.pe32BitRequired for more information (http://msdn.microsoft.com/en-us/library/ms230275.aspx).
/// </summary>
internal bool Bit32Required
{
get
{
// platform agnostic if we only have metadata
if (_peReaderOpt == null)
{
return false;
}
return (_peReaderOpt.PEHeaders.CorHeader.Flags & CorFlags.Requires32Bit) != 0;
}
}
internal ImmutableArray<byte> GetHash(AssemblyHashAlgorithm algorithmId)
{
Debug.Assert(_hashesOpt != null);
return _hashesOpt.GetHash(algorithmId);
}
#endregion
#region ModuleDef helpers
internal string Name
{
get
{
if (_lazyName == null)
{
_lazyName = MetadataReader.GetString(MetadataReader.GetModuleDefinition().Name);
}
return _lazyName;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal Guid GetModuleVersionIdOrThrow()
{
return MetadataReader.GetModuleVersionIdOrThrow();
}
#endregion
#region ModuleRef, File helpers
/// <summary>
/// Returns the names of linked managed modules.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal ImmutableArray<string> GetMetadataModuleNamesOrThrow()
{
var builder = ArrayBuilder<string>.GetInstance();
try
{
foreach (var fileHandle in MetadataReader.AssemblyFiles)
{
var file = MetadataReader.GetAssemblyFile(fileHandle);
if (!file.ContainsMetadata)
{
continue;
}
string moduleName = MetadataReader.GetString(file.Name);
if (!MetadataHelpers.IsValidMetadataFileName(moduleName))
{
throw new BadImageFormatException(string.Format(CodeAnalysisResources.InvalidModuleName, this.Name, moduleName));
}
builder.Add(moduleName);
}
return builder.ToImmutable();
}
finally
{
builder.Free();
}
}
/// <summary>
/// Returns names of referenced modules.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal IEnumerable<string> GetReferencedManagedModulesOrThrow()
{
HashSet<EntityHandle> nameTokens = new HashSet<EntityHandle>();
foreach (var handle in MetadataReader.TypeReferences)
{
TypeReference typeRef = MetadataReader.GetTypeReference(handle);
EntityHandle scope = typeRef.ResolutionScope;
if (scope.Kind == HandleKind.ModuleReference)
{
nameTokens.Add(scope);
}
}
foreach (var token in nameTokens)
{
yield return this.GetModuleRefNameOrThrow((ModuleReferenceHandle)token);
}
}
internal ImmutableArray<EmbeddedResource> GetEmbeddedResourcesOrThrow()
{
if (MetadataReader.ManifestResources.Count == 0)
{
return ImmutableArray<EmbeddedResource>.Empty;
}
var builder = ImmutableArray.CreateBuilder<EmbeddedResource>();
foreach (var handle in MetadataReader.ManifestResources)
{
var resource = MetadataReader.GetManifestResource(handle);
if (resource.Implementation.IsNil)
{
string resourceName = MetadataReader.GetString(resource.Name);
builder.Add(new EmbeddedResource((uint)resource.Offset, resource.Attributes, resourceName));
}
}
return builder.ToImmutable();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetModuleRefNameOrThrow(ModuleReferenceHandle moduleRef)
{
return MetadataReader.GetString(MetadataReader.GetModuleReference(moduleRef).Name);
}
#endregion
#region AssemblyRef helpers
// The array is sorted by AssemblyRef RowId, starting with RowId=1 and doesn't have any RowId gaps.
public ImmutableArray<AssemblyIdentity> ReferencedAssemblies
{
get
{
if (_lazyAssemblyReferences == null)
{
_lazyAssemblyReferences = this.MetadataReader.GetReferencedAssembliesOrThrow();
}
return _lazyAssemblyReferences;
}
}
#endregion
#region PE Header helpers
internal string MetadataVersion
{
get { return MetadataReader.MetadataVersion; }
}
#endregion
#region Heaps
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobReader GetMemoryReaderOrThrow(BlobHandle blob)
{
return MetadataReader.GetBlobReader(blob);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetFullNameOrThrow(StringHandle namespaceHandle, StringHandle nameHandle)
{
var attributeTypeName = MetadataReader.GetString(nameHandle);
var attributeTypeNamespaceName = MetadataReader.GetString(namespaceHandle);
return MetadataHelpers.BuildQualifiedName(attributeTypeNamespaceName, attributeTypeName);
}
#endregion
#region AssemblyDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal AssemblyIdentity ReadAssemblyIdentityOrThrow()
{
return MetadataReader.ReadAssemblyIdentityOrThrow();
}
#endregion
#region TypeDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public TypeDefinitionHandle GetContainingTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetDeclaringType();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetTypeDefNameOrThrow(TypeDefinitionHandle typeDef)
{
TypeDefinition typeDefinition = MetadataReader.GetTypeDefinition(typeDef);
string name = MetadataReader.GetString(typeDefinition.Name);
Debug.Assert(name.Length == 0 || MetadataHelpers.IsValidMetadataIdentifier(name)); // Obfuscated assemblies can have types with empty names.
// The problem is that the mangled name for a static machine type looks like
// "<" + methodName + ">d__" + uniqueId.However, methodName will have dots in
// it for explicit interface implementations (e.g. "<I.F>d__0"). Unfortunately,
// the native compiler emits such names in a very strange way: everything before
// the last dot goes in the namespace (!!) field of the typedef.Since state
// machine types are always nested types and since nested types never have
// explicit namespaces (since they are in the same namespaces as their containing
// types), it should be safe to check for a non-empty namespace name on a nested
// type and prepend the namespace name and a dot to the type name. After that,
// debugging support falls out.
if (IsNestedTypeDefOrThrow(typeDef))
{
string namespaceName = MetadataReader.GetString(typeDefinition.Namespace);
if (namespaceName.Length > 0)
{
// As explained above, this is not really the qualified name - the namespace
// name is actually the part of the name that preceded the last dot (in bad
// metadata).
name = namespaceName + "." + name;
}
}
return name;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetTypeDefNamespaceOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetString(MetadataReader.GetTypeDefinition(typeDef).Namespace);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public EntityHandle GetTypeDefExtendsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).BaseType;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public TypeAttributes GetTypeDefFlagsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public GenericParameterHandleCollection GetTypeDefGenericParamsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetGenericParameters();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public bool HasGenericParametersOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetGenericParameters().Count > 0;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetTypeDefPropsOrThrow(
TypeDefinitionHandle typeDef,
out string name,
out string @namespace,
out TypeAttributes flags,
out EntityHandle extends)
{
TypeDefinition row = MetadataReader.GetTypeDefinition(typeDef);
name = MetadataReader.GetString(row.Name);
@namespace = MetadataReader.GetString(row.Namespace);
flags = row.Attributes;
extends = row.BaseType;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal bool IsNestedTypeDefOrThrow(TypeDefinitionHandle typeDef)
{
return IsNestedTypeDefOrThrow(MetadataReader, typeDef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static bool IsNestedTypeDefOrThrow(MetadataReader metadataReader, TypeDefinitionHandle typeDef)
{
return IsNested(metadataReader.GetTypeDefinition(typeDef).Attributes);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal bool IsInterfaceOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).Attributes.IsInterface();
}
private struct TypeDefToNamespace
{
internal readonly TypeDefinitionHandle TypeDef;
internal readonly NamespaceDefinitionHandle NamespaceHandle;
internal TypeDefToNamespace(TypeDefinitionHandle typeDef, NamespaceDefinitionHandle namespaceHandle)
{
TypeDef = typeDef;
NamespaceHandle = namespaceHandle;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private IEnumerable<TypeDefToNamespace> GetTypeDefsOrThrow(bool topLevelOnly)
{
foreach (var typeDef in MetadataReader.TypeDefinitions)
{
var row = MetadataReader.GetTypeDefinition(typeDef);
if (topLevelOnly && IsNested(row.Attributes))
{
continue;
}
yield return new TypeDefToNamespace(typeDef, row.NamespaceDefinition);
}
}
/// <summary>
/// The function groups types defined in the module by their fully-qualified namespace name.
/// The case-sensitivity of the grouping depends upon the provided StringComparer.
///
/// The sequence is sorted by name by using provided comparer. Therefore, if there are multiple
/// groups for a namespace name (e.g. because they differ in case), the groups are going to be
/// adjacent to each other.
///
/// Empty string is used as namespace name for types in the Global namespace. Therefore, all types
/// in the Global namespace, if any, should be in the first group (assuming a reasonable StringComparer).
/// </summary>
/// Comparer to sort the groups.
/// <param name="nameComparer">
/// </param>
/// <returns>A sorted list of TypeDef row ids, grouped by fully-qualified namespace name.</returns>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal IEnumerable<IGrouping<string, TypeDefinitionHandle>> GroupTypesByNamespaceOrThrow(StringComparer nameComparer)
{
// TODO: Consider if we should cache the result (not the IEnumerable, but the actual values).
// NOTE: Rather than use a sorted dictionary, we accumulate the groupings in a normal dictionary
// and then sort the list. We do this so that namespaces with distinct names are not
// merged, even if they are equal according to the provided comparer. This improves the error
// experience because types retain their exact namespaces.
Dictionary<string, ArrayBuilder<TypeDefinitionHandle>> namespaces = new Dictionary<string, ArrayBuilder<TypeDefinitionHandle>>();
GetTypeNamespaceNamesOrThrow(namespaces);
GetForwardedTypeNamespaceNamesOrThrow(namespaces);
var result = new ArrayBuilder<IGrouping<string, TypeDefinitionHandle>>(namespaces.Count);
foreach (var pair in namespaces)
{
result.Add(new Grouping<string, TypeDefinitionHandle>(pair.Key, pair.Value ?? SpecializedCollections.EmptyEnumerable<TypeDefinitionHandle>()));
}
result.Sort(new TypesByNamespaceSortComparer(nameComparer));
return result;
}
internal class TypesByNamespaceSortComparer : IComparer<IGrouping<string, TypeDefinitionHandle>>
{
private readonly StringComparer _nameComparer;
public TypesByNamespaceSortComparer(StringComparer nameComparer)
{
_nameComparer = nameComparer;
}
public int Compare(IGrouping<string, TypeDefinitionHandle> left, IGrouping<string, TypeDefinitionHandle> right)
{
if (left == right)
{
return 0;
}
int result = _nameComparer.Compare(left.Key, right.Key);
if (result == 0)
{
var fLeft = left.FirstOrDefault();
var fRight = right.FirstOrDefault();
if (fLeft.IsNil ^ fRight.IsNil)
{
result = fLeft.IsNil ? +1 : -1;
}
else
{
result = HandleComparer.Default.Compare(fLeft, fRight);
}
if (result == 0)
{
// This can only happen when both are for forwarded types.
Debug.Assert(left.IsEmpty() && right.IsEmpty());
result = string.CompareOrdinal(left.Key, right.Key);
}
}
Debug.Assert(result != 0);
return result;
}
}
/// <summary>
/// Groups together the RowIds of types in a given namespaces. The types considered are
/// those defined in this module.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private void GetTypeNamespaceNamesOrThrow(Dictionary<string, ArrayBuilder<TypeDefinitionHandle>> namespaces)
{
// PERF: Group by namespace handle so we only have to allocate one string for every namespace
var namespaceHandles = new Dictionary<NamespaceDefinitionHandle, ArrayBuilder<TypeDefinitionHandle>>(NamespaceHandleEqualityComparer.Singleton);
foreach (TypeDefToNamespace pair in GetTypeDefsOrThrow(topLevelOnly: true))
{
NamespaceDefinitionHandle nsHandle = pair.NamespaceHandle;
TypeDefinitionHandle typeDef = pair.TypeDef;
ArrayBuilder<TypeDefinitionHandle> builder;
if (namespaceHandles.TryGetValue(nsHandle, out builder))
{
builder.Add(typeDef);
}
else
{
namespaceHandles.Add(nsHandle, new ArrayBuilder<TypeDefinitionHandle> { typeDef });
}
}
foreach (var kvp in namespaceHandles)
{
string @namespace = MetadataReader.GetString(kvp.Key);
ArrayBuilder<TypeDefinitionHandle> builder;
if (namespaces.TryGetValue(@namespace, out builder))
{
builder.AddRange(kvp.Value);
}
else
{
namespaces.Add(@namespace, kvp.Value);
}
}
}
private class NamespaceHandleEqualityComparer : IEqualityComparer<NamespaceDefinitionHandle>
{
public static readonly NamespaceHandleEqualityComparer Singleton = new NamespaceHandleEqualityComparer();
private NamespaceHandleEqualityComparer()
{
}
public bool Equals(NamespaceDefinitionHandle x, NamespaceDefinitionHandle y)
{
return x == y;
}
public int GetHashCode(NamespaceDefinitionHandle obj)
{
return obj.GetHashCode();
}
}
/// <summary>
/// Supplements the namespace-to-RowIDs map with the namespaces of forwarded types.
/// These types will not have associated row IDs (represented as null, for efficiency).
/// These namespaces are important because we want lookups of missing forwarded types
/// to succeed far enough that we can actually find the type forwarder and provide
/// information about the target assembly.
///
/// For example, consider the following forwarded type:
///
/// .class extern forwarder Namespace.Type {}
///
/// If this type is referenced in source as "Namespace.Type", then dev10 reports
///
/// error CS1070: The type name 'Namespace.Name' could not be found. This type has been
/// forwarded to assembly 'pe2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
/// Consider adding a reference to that assembly.
///
/// If we did not include "Namespace" as a child of the global namespace of this module
/// (the forwarding module), then Roslyn would report that the type "Namespace" was not
/// found and say nothing about "Name" (because of the diagnostic already attached to
/// the qualifier).
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private void GetForwardedTypeNamespaceNamesOrThrow(Dictionary<string, ArrayBuilder<TypeDefinitionHandle>> namespaces)
{
EnsureForwardTypeToAssemblyMap();
foreach (var typeName in _lazyForwardedTypesToAssemblyIndexMap.Keys)
{
int index = typeName.LastIndexOf('.');
string namespaceName = index >= 0 ? typeName.Substring(0, index) : "";
if (!namespaces.ContainsKey(namespaceName))
{
namespaces.Add(namespaceName, null);
}
}
}
private IdentifierCollection ComputeTypeNameCollection()
{
try
{
var allTypeDefs = GetTypeDefsOrThrow(topLevelOnly: false);
var typeNames =
from typeDef in allTypeDefs
let metadataName = GetTypeDefNameOrThrow(typeDef.TypeDef)
let backtickIndex = metadataName.IndexOf('`')
select backtickIndex < 0 ? metadataName : metadataName.Substring(0, backtickIndex);
return new IdentifierCollection(typeNames);
}
catch (BadImageFormatException)
{
return new IdentifierCollection();
}
}
private IdentifierCollection ComputeNamespaceNameCollection()
{
try
{
var allTypeIds = GetTypeDefsOrThrow(topLevelOnly: true);
var fullNamespaceNames =
from id in allTypeIds
where !id.NamespaceHandle.IsNil
select MetadataReader.GetString(id.NamespaceHandle);
var namespaceNames =
from fullName in fullNamespaceNames.Distinct()
from name in fullName.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries)
select name;
return new IdentifierCollection(namespaceNames);
}
catch (BadImageFormatException)
{
return new IdentifierCollection();
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal ImmutableArray<TypeDefinitionHandle> GetNestedTypeDefsOrThrow(TypeDefinitionHandle container)
{
return MetadataReader.GetTypeDefinition(container).GetNestedTypes();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal MethodImplementationHandleCollection GetMethodImplementationsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetMethodImplementations();
}
/// <summary>
/// Returns a collection of interfaces implemented by given type.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal InterfaceImplementationHandleCollection GetInterfaceImplementationsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetInterfaceImplementations();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal MethodDefinitionHandleCollection GetMethodsOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetMethods();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal PropertyDefinitionHandleCollection GetPropertiesOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetProperties();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EventDefinitionHandleCollection GetEventsOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetEvents();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal FieldDefinitionHandleCollection GetFieldsOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetFields();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EntityHandle GetBaseTypeOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).BaseType;
}
internal TypeLayout GetTypeLayout(TypeDefinitionHandle typeDef)
{
try
{
// CLI Spec 22.8.3:
// The Class or ValueType indexed by Parent shall be SequentialLayout or ExplicitLayout.
// That is, AutoLayout types shall not own any rows in the ClassLayout table.
var def = MetadataReader.GetTypeDefinition(typeDef);
LayoutKind kind;
switch (def.Attributes & TypeAttributes.LayoutMask)
{
case TypeAttributes.SequentialLayout:
kind = LayoutKind.Sequential;
break;
case TypeAttributes.ExplicitLayout:
kind = LayoutKind.Explicit;
break;
case TypeAttributes.AutoLayout:
return default(TypeLayout);
default:
// TODO (tomat) report error:
return default(TypeLayout);
}
var layout = def.GetLayout();
int size = layout.Size;
int packingSize = layout.PackingSize;
if (packingSize > byte.MaxValue)
{
// TODO (tomat) report error:
packingSize = 0;
}
if (size < 0)
{
// TODO (tomat) report error:
size = 0;
}
return new TypeLayout(kind, size, (byte)packingSize);
}
catch (BadImageFormatException)
{
return default(TypeLayout);
}
}
internal bool IsNoPiaLocalType(TypeDefinitionHandle typeDef)
{
AttributeInfo attributeInfo;
return IsNoPiaLocalType(typeDef, out attributeInfo);
}
internal bool HasParamsAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.ParamArrayAttribute).HasValue;
}
internal bool HasIsReadOnlyAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.IsReadOnlyAttribute).HasValue;
}
internal bool HasDoesNotReturnAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.DoesNotReturnAttribute).HasValue;
}
internal bool HasIsUnmanagedAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.IsUnmanagedAttribute).HasValue;
}
internal bool HasExtensionAttribute(EntityHandle token, bool ignoreCase)
{
return FindTargetAttribute(token, ignoreCase ? AttributeDescription.CaseInsensitiveExtensionAttribute : AttributeDescription.CaseSensitiveExtensionAttribute).HasValue;
}
internal bool HasVisualBasicEmbeddedAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.VisualBasicEmbeddedAttribute).HasValue;
}
internal bool HasCodeAnalysisEmbeddedAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.CodeAnalysisEmbeddedAttribute).HasValue;
}
internal bool HasInterpolatedStringHandlerAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.InterpolatedStringHandlerAttribute).HasValue;
}
internal bool HasDefaultMemberAttribute(EntityHandle token, out string memberName)
{
return HasStringValuedAttribute(token, AttributeDescription.DefaultMemberAttribute, out memberName);
}
internal bool HasGuidAttribute(EntityHandle token, out string guidValue)
{
return HasStringValuedAttribute(token, AttributeDescription.GuidAttribute, out guidValue);
}
internal bool HasFixedBufferAttribute(EntityHandle token, out string elementTypeName, out int bufferSize)
{
return HasStringAndIntValuedAttribute(token, AttributeDescription.FixedBufferAttribute, out elementTypeName, out bufferSize);
}
internal bool HasAccessedThroughPropertyAttribute(EntityHandle token, out string propertyName)
{
return HasStringValuedAttribute(token, AttributeDescription.AccessedThroughPropertyAttribute, out propertyName);
}
internal bool HasRequiredAttributeAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.RequiredAttributeAttribute).HasValue;
}
internal bool HasAttribute(EntityHandle token, AttributeDescription description)
{
return FindTargetAttribute(token, description).HasValue;
}
internal CustomAttributeHandle GetAttributeHandle(EntityHandle token, AttributeDescription description)
{
return FindTargetAttribute(token, description).Handle;
}
private static readonly ImmutableArray<bool> s_simpleTransformFlags = ImmutableArray.Create(true);
internal bool HasDynamicAttribute(EntityHandle token, out ImmutableArray<bool> transformFlags)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.DynamicAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
if (!info.HasValue)
{
transformFlags = default;
return false;
}
if (info.SignatureIndex == 0)
{
transformFlags = s_simpleTransformFlags;
return true;
}
return TryExtractBoolArrayValueFromAttribute(info.Handle, out transformFlags);
}
internal bool HasNativeIntegerAttribute(EntityHandle token, out ImmutableArray<bool> transformFlags)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NativeIntegerAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
if (!info.HasValue)
{
transformFlags = default;
return false;
}
if (info.SignatureIndex == 0)
{
transformFlags = s_simpleTransformFlags;
return true;
}
return TryExtractBoolArrayValueFromAttribute(info.Handle, out transformFlags);
}
internal bool HasTupleElementNamesAttribute(EntityHandle token, out ImmutableArray<string> tupleElementNames)
{
var info = FindTargetAttribute(token, AttributeDescription.TupleElementNamesAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
if (!info.HasValue)
{
tupleElementNames = default(ImmutableArray<string>);
return false;
}
return TryExtractStringArrayValueFromAttribute(info.Handle, out tupleElementNames);
}
internal bool HasIsByRefLikeAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.IsByRefLikeAttribute).HasValue;
}
internal const string ByRefLikeMarker = "Types with embedded references are not supported in this version of your compiler.";
internal ObsoleteAttributeData TryGetDeprecatedOrExperimentalOrObsoleteAttribute(
EntityHandle token,
IAttributeNamedArgumentDecoder decoder,
bool ignoreByRefLikeMarker)
{
AttributeInfo info;
info = FindTargetAttribute(token, AttributeDescription.DeprecatedAttribute);
if (info.HasValue)
{
return TryExtractDeprecatedDataFromAttribute(info);
}
info = FindTargetAttribute(token, AttributeDescription.ObsoleteAttribute);
if (info.HasValue)
{
ObsoleteAttributeData obsoleteData = TryExtractObsoleteDataFromAttribute(info, decoder);
switch (obsoleteData?.Message)
{
case ByRefLikeMarker when ignoreByRefLikeMarker:
return null;
}
return obsoleteData;
}
// [Experimental] is always a warning, not an
// error, so search for [Experimental] last.
info = FindTargetAttribute(token, AttributeDescription.ExperimentalAttribute);
if (info.HasValue)
{
return TryExtractExperimentalDataFromAttribute(info);
}
return null;
}
#nullable enable
internal UnmanagedCallersOnlyAttributeData? TryGetUnmanagedCallersOnlyAttribute(
EntityHandle token,
IAttributeNamedArgumentDecoder attributeArgumentDecoder,
Func<string, TypedConstant, bool, (bool IsCallConvs, ImmutableHashSet<INamedTypeSymbolInternal>? CallConvs)> unmanagedCallersOnlyDecoder)
{
// We don't want to load all attributes and their public data just to answer whether a PEMethodSymbol has an UnmanagedCallersOnly
// attached. It would create unnecessary memory pressure that isn't going to be needed 99% of the time, so we just crack this 1
// attribute.
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.UnmanagedCallersOnlyAttribute);
if (!info.HasValue || info.SignatureIndex != 0 || !TryGetAttributeReader(info.Handle, out BlobReader sigReader))
{
return null;
}
var unmanagedConventionTypes = ImmutableHashSet<INamedTypeSymbolInternal>.Empty;
if (sigReader.RemainingBytes > 0)
{
try
{
var numNamed = sigReader.ReadUInt16();
for (int i = 0; i < numNamed; i++)
{
var ((name, value), isProperty, typeCode, elementTypeCode) = attributeArgumentDecoder.DecodeCustomAttributeNamedArgumentOrThrow(ref sigReader);
if (typeCode != SerializationTypeCode.SZArray || elementTypeCode != SerializationTypeCode.Type)
{
continue;
}
var namedArgumentDecoded = unmanagedCallersOnlyDecoder(name, value, !isProperty);
if (namedArgumentDecoded.IsCallConvs)
{
unmanagedConventionTypes = namedArgumentDecoded.CallConvs;
break;
}
}
}
catch (Exception ex) when (ex is BadImageFormatException or UnsupportedSignatureContent)
{
}
}
return UnmanagedCallersOnlyAttributeData.Create(unmanagedConventionTypes);
}
internal (ImmutableArray<string?> Names, bool FoundAttribute) GetInterpolatedStringHandlerArgumentAttributeValues(EntityHandle token)
{
var targetAttribute = FindTargetAttribute(token, AttributeDescription.InterpolatedStringHandlerArgumentAttribute);
if (!targetAttribute.HasValue)
{
return (default, false);
}
Debug.Assert(AttributeDescription.InterpolatedStringHandlerArgumentAttribute.Signatures.Length == 2);
Debug.Assert(targetAttribute.SignatureIndex is 0 or 1);
if (targetAttribute.SignatureIndex == 0)
{
if (TryExtractStringValueFromAttribute(targetAttribute.Handle, out string? paramName))
{
return (ImmutableArray.Create(paramName), true);
}
}
else if (TryExtractStringArrayValueFromAttribute(targetAttribute.Handle, out var paramNames))
{
return (paramNames.NullToEmpty(), true);
}
return (default, true);
}
#nullable disable
internal bool HasMaybeNullWhenOrNotNullWhenOrDoesNotReturnIfAttribute(EntityHandle token, AttributeDescription description, out bool when)
{
Debug.Assert(description.Namespace == "System.Diagnostics.CodeAnalysis");
Debug.Assert(description.Name == "MaybeNullWhenAttribute" || description.Name == "NotNullWhenAttribute" || description.Name == "DoesNotReturnIfAttribute");
AttributeInfo info = FindTargetAttribute(token, description);
if (info.HasValue &&
// MaybeNullWhen(bool), NotNullWhen(bool), DoesNotReturnIf(bool)
info.SignatureIndex == 0)
{
return TryExtractValueFromAttribute(info.Handle, out when, s_attributeBooleanValueExtractor);
}
when = false;
return false;
}
internal ImmutableHashSet<string> GetStringValuesOfNotNullIfNotNullAttribute(EntityHandle token)
{
var attributeInfos = FindTargetAttributes(token, AttributeDescription.NotNullIfNotNullAttribute);
var result = ImmutableHashSet<string>.Empty;
if (attributeInfos is null)
{
return result;
}
foreach (var attributeInfo in attributeInfos)
{
if (TryExtractStringValueFromAttribute(attributeInfo.Handle, out string parameterName))
{
result = result.Add(parameterName);
}
}
return result;
}
internal CustomAttributeHandle GetAttributeUsageAttributeHandle(EntityHandle token)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.AttributeUsageAttribute);
Debug.Assert(info.SignatureIndex == 0);
return info.Handle;
}
internal bool HasInterfaceTypeAttribute(EntityHandle token, out ComInterfaceType interfaceType)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.InterfaceTypeAttribute);
if (info.HasValue && TryExtractInterfaceTypeFromAttribute(info, out interfaceType))
{
return true;
}
interfaceType = default(ComInterfaceType);
return false;
}
internal bool HasTypeLibTypeAttribute(EntityHandle token, out Cci.TypeLibTypeFlags flags)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.TypeLibTypeAttribute);
if (info.HasValue && TryExtractTypeLibTypeFromAttribute(info, out flags))
{
return true;
}
flags = default(Cci.TypeLibTypeFlags);
return false;
}
internal bool HasDateTimeConstantAttribute(EntityHandle token, out ConstantValue defaultValue)
{
long value;
AttributeInfo info = FindLastTargetAttribute(token, AttributeDescription.DateTimeConstantAttribute);
if (info.HasValue && TryExtractLongValueFromAttribute(info.Handle, out value))
{
// if value is outside this range, DateTime would throw when constructed
if (value < DateTime.MinValue.Ticks || value > DateTime.MaxValue.Ticks)
{
defaultValue = ConstantValue.Bad;
}
else
{
defaultValue = ConstantValue.Create(new DateTime(value));
}
return true;
}
defaultValue = null;
return false;
}
internal bool HasDecimalConstantAttribute(EntityHandle token, out ConstantValue defaultValue)
{
decimal value;
AttributeInfo info = FindLastTargetAttribute(token, AttributeDescription.DecimalConstantAttribute);
if (info.HasValue && TryExtractDecimalValueFromDecimalConstantAttribute(info.Handle, out value))
{
defaultValue = ConstantValue.Create(value);
return true;
}
defaultValue = null;
return false;
}
internal bool HasNullablePublicOnlyAttribute(EntityHandle token, out bool includesInternals)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NullablePublicOnlyAttribute);
if (info.HasValue)
{
Debug.Assert(info.SignatureIndex == 0);
if (TryExtractValueFromAttribute(info.Handle, out bool value, s_attributeBooleanValueExtractor))
{
includesInternals = value;
return true;
}
}
includesInternals = false;
return false;
}
internal ImmutableArray<string> GetInternalsVisibleToAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.InternalsVisibleToAttribute);
ArrayBuilder<string> result = ExtractStringValuesFromAttributes(attrInfos);
return result?.ToImmutableAndFree() ?? ImmutableArray<string>.Empty;
}
internal ImmutableArray<string> GetConditionalAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.ConditionalAttribute);
ArrayBuilder<string> result = ExtractStringValuesFromAttributes(attrInfos);
return result?.ToImmutableAndFree() ?? ImmutableArray<string>.Empty;
}
/// <summary>
/// Find the MemberNotNull attribute(s) and extract the list of referenced member names
/// </summary>
internal ImmutableArray<string> GetMemberNotNullAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.MemberNotNullAttribute);
if (attrInfos is null || attrInfos.Count == 0)
{
return ImmutableArray<string>.Empty;
}
var result = ArrayBuilder<string>.GetInstance(attrInfos.Count);
foreach (var ai in attrInfos)
{
if (ai.SignatureIndex == 0)
{
if (TryExtractStringValueFromAttribute(ai.Handle, out string extracted))
{
if (extracted is object)
{
result.Add(extracted);
}
}
}
else if (TryExtractStringArrayValueFromAttribute(ai.Handle, out ImmutableArray<string> extracted2))
{
foreach (var value in extracted2)
{
if (value is object)
{
result.Add(value);
}
}
}
}
return result.ToImmutableAndFree();
}
/// <summary>
/// Find the MemberNotNullWhen attribute(s) and extract the list of referenced member names
/// </summary>
internal (ImmutableArray<string> whenTrue, ImmutableArray<string> whenFalse) GetMemberNotNullWhenAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.MemberNotNullWhenAttribute);
if (attrInfos is null || attrInfos.Count == 0)
{
return (ImmutableArray<string>.Empty, ImmutableArray<string>.Empty);
}
var whenTrue = ArrayBuilder<string>.GetInstance(attrInfos.Count);
var whenFalse = ArrayBuilder<string>.GetInstance(attrInfos.Count);
foreach (var ai in attrInfos)
{
if (ai.SignatureIndex == 0)
{
if (TryExtractValueFromAttribute(ai.Handle, out BoolAndStringData extracted, s_attributeBoolAndStringValueExtractor))
{
if (extracted.String is object)
{
var whenResult = extracted.Sense ? whenTrue : whenFalse;
whenResult.Add(extracted.String);
}
}
}
else if (TryExtractValueFromAttribute(ai.Handle, out BoolAndStringArrayData extracted2, s_attributeBoolAndStringArrayValueExtractor))
{
var whenResult = extracted2.Sense ? whenTrue : whenFalse;
foreach (var value in extracted2.Strings)
{
if (value is object)
{
whenResult.Add(value);
}
}
}
}
return (whenTrue.ToImmutableAndFree(), whenFalse.ToImmutableAndFree());
}
// This method extracts all the non-null string values from the given attributes.
private ArrayBuilder<string> ExtractStringValuesFromAttributes(List<AttributeInfo> attrInfos)
{
if (attrInfos == null)
{
return null;
}
var result = ArrayBuilder<string>.GetInstance(attrInfos.Count);
foreach (var ai in attrInfos)
{
string extractedStr;
if (TryExtractStringValueFromAttribute(ai.Handle, out extractedStr) && extractedStr != null)
{
result.Add(extractedStr);
}
}
return result;
}
#nullable enable
private ObsoleteAttributeData? TryExtractObsoleteDataFromAttribute(AttributeInfo attributeInfo, IAttributeNamedArgumentDecoder decoder)
{
Debug.Assert(attributeInfo.HasValue);
if (!TryGetAttributeReader(attributeInfo.Handle, out var sig))
{
return null;
}
string? message = null;
bool isError = false;
switch (attributeInfo.SignatureIndex)
{
case 0:
// ObsoleteAttribute()
break;
case 1:
// ObsoleteAttribute(string)
if (sig.RemainingBytes > 0 && CrackStringInAttributeValue(out message, ref sig))
{
break;
}
return null;
case 2:
// ObsoleteAttribute(string, bool)
if (sig.RemainingBytes > 0 && CrackStringInAttributeValue(out message, ref sig) &&
sig.RemainingBytes > 0 && CrackBooleanInAttributeValue(out isError, ref sig))
{
break;
}
return null;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
(string? diagnosticId, string? urlFormat) = sig.RemainingBytes > 0 ? CrackObsoleteProperties(ref sig, decoder) : default;
return new ObsoleteAttributeData(ObsoleteAttributeKind.Obsolete, message, isError, diagnosticId, urlFormat);
}
private bool TryGetAttributeReader(CustomAttributeHandle handle, out BlobReader blobReader)
{
Debug.Assert(!handle.IsNil);
try
{
var valueBlob = GetCustomAttributeValueOrThrow(handle);
if (!valueBlob.IsNil)
{
blobReader = MetadataReader.GetBlobReader(valueBlob);
if (blobReader.Length >= 4)
{
// check prolog
if (blobReader.ReadInt16() == 1)
{
return true;
}
}
}
}
catch (BadImageFormatException)
{ }
blobReader = default;
return false;
}
#nullable disable
private ObsoleteAttributeData TryExtractDeprecatedDataFromAttribute(AttributeInfo attributeInfo)
{
Debug.Assert(attributeInfo.HasValue);
switch (attributeInfo.SignatureIndex)
{
case 0: // DeprecatedAttribute(String, DeprecationType, UInt32)
case 1: // DeprecatedAttribute(String, DeprecationType, UInt32, Platform)
case 2: // DeprecatedAttribute(String, DeprecationType, UInt32, Type)
case 3: // DeprecatedAttribute(String, DeprecationType, UInt32, String)
return TryExtractValueFromAttribute(attributeInfo.Handle, out var obsoleteData, s_attributeDeprecatedDataExtractor) ?
obsoleteData :
null;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
}
private ObsoleteAttributeData TryExtractExperimentalDataFromAttribute(AttributeInfo attributeInfo)
{
Debug.Assert(attributeInfo.HasValue);
switch (attributeInfo.SignatureIndex)
{
case 0: // ExperimentalAttribute()
return ObsoleteAttributeData.Experimental;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
}
private bool TryExtractInterfaceTypeFromAttribute(AttributeInfo attributeInfo, out ComInterfaceType interfaceType)
{
Debug.Assert(attributeInfo.HasValue);
switch (attributeInfo.SignatureIndex)
{
case 0:
// InterfaceTypeAttribute(Int16)
short shortValue;
if (TryExtractValueFromAttribute(attributeInfo.Handle, out shortValue, s_attributeShortValueExtractor) &&
IsValidComInterfaceType(shortValue))
{
interfaceType = (ComInterfaceType)shortValue;
return true;
}
break;
case 1:
// InterfaceTypeAttribute(ComInterfaceType)
int intValue;
if (TryExtractValueFromAttribute(attributeInfo.Handle, out intValue, s_attributeIntValueExtractor) &&
IsValidComInterfaceType(intValue))
{
interfaceType = (ComInterfaceType)intValue;
return true;
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
interfaceType = default(ComInterfaceType);
return false;
}
private static bool IsValidComInterfaceType(int comInterfaceType)
{
switch (comInterfaceType)
{
case (int)Cci.Constants.ComInterfaceType_InterfaceIsDual:
case (int)Cci.Constants.ComInterfaceType_InterfaceIsIDispatch:
case (int)ComInterfaceType.InterfaceIsIInspectable:
case (int)ComInterfaceType.InterfaceIsIUnknown:
return true;
default:
return false;
}
}
private bool TryExtractTypeLibTypeFromAttribute(AttributeInfo info, out Cci.TypeLibTypeFlags flags)
{
Debug.Assert(info.HasValue);
switch (info.SignatureIndex)
{
case 0:
// TypeLibTypeAttribute(Int16)
short shortValue;
if (TryExtractValueFromAttribute(info.Handle, out shortValue, s_attributeShortValueExtractor))
{
flags = (Cci.TypeLibTypeFlags)shortValue;
return true;
}
break;
case 1:
// TypeLibTypeAttribute(TypeLibTypeFlags)
int intValue;
if (TryExtractValueFromAttribute(info.Handle, out intValue, s_attributeIntValueExtractor))
{
flags = (Cci.TypeLibTypeFlags)intValue;
return true;
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(info.SignatureIndex);
}
flags = default(Cci.TypeLibTypeFlags);
return false;
}
#nullable enable
internal bool TryExtractStringValueFromAttribute(CustomAttributeHandle handle, out string? value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeStringValueExtractor);
}
internal bool TryExtractLongValueFromAttribute(CustomAttributeHandle handle, out long value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeLongValueExtractor);
}
// Note: not a general purpose helper
private bool TryExtractDecimalValueFromDecimalConstantAttribute(CustomAttributeHandle handle, out decimal value)
{
return TryExtractValueFromAttribute(handle, out value, s_decimalValueInDecimalConstantAttributeExtractor);
}
private struct StringAndInt
{
public string? StringValue;
public int IntValue;
}
private bool TryExtractStringAndIntValueFromAttribute(CustomAttributeHandle handle, out string? stringValue, out int intValue)
{
StringAndInt data;
var result = TryExtractValueFromAttribute(handle, out data, s_attributeStringAndIntValueExtractor);
stringValue = data.StringValue;
intValue = data.IntValue;
return result;
}
private bool TryExtractBoolArrayValueFromAttribute(CustomAttributeHandle handle, out ImmutableArray<bool> value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeBoolArrayValueExtractor);
}
private bool TryExtractByteArrayValueFromAttribute(CustomAttributeHandle handle, out ImmutableArray<byte> value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeByteArrayValueExtractor);
}
private bool TryExtractStringArrayValueFromAttribute(CustomAttributeHandle handle, out ImmutableArray<string?> value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeStringArrayValueExtractor);
}
private bool TryExtractValueFromAttribute<T>(CustomAttributeHandle handle, out T? value, AttributeValueExtractor<T?> valueExtractor)
{
Debug.Assert(!handle.IsNil);
// extract the value
try
{
BlobHandle valueBlob = GetCustomAttributeValueOrThrow(handle);
if (!valueBlob.IsNil)
{
// TODO: error checking offset in range
BlobReader reader = MetadataReader.GetBlobReader(valueBlob);
if (reader.Length > 4)
{
// check prolog
if (reader.ReadByte() == 1 && reader.ReadByte() == 0)
{
return valueExtractor(out value, ref reader);
}
}
}
}
catch (BadImageFormatException)
{ }
value = default(T);
return false;
}
#nullable disable
internal bool HasStringValuedAttribute(EntityHandle token, AttributeDescription description, out string value)
{
AttributeInfo info = FindTargetAttribute(token, description);
if (info.HasValue)
{
return TryExtractStringValueFromAttribute(info.Handle, out value);
}
value = null;
return false;
}
private bool HasStringAndIntValuedAttribute(EntityHandle token, AttributeDescription description, out string stringValue, out int intValue)
{
AttributeInfo info = FindTargetAttribute(token, description);
if (info.HasValue)
{
return TryExtractStringAndIntValueFromAttribute(info.Handle, out stringValue, out intValue);
}
stringValue = null;
intValue = 0;
return false;
}
internal bool IsNoPiaLocalType(
TypeDefinitionHandle typeDef,
out string interfaceGuid,
out string scope,
out string identifier)
{
AttributeInfo typeIdentifierInfo;
if (!IsNoPiaLocalType(typeDef, out typeIdentifierInfo))
{
interfaceGuid = null;
scope = null;
identifier = null;
return false;
}
interfaceGuid = null;
scope = null;
identifier = null;
try
{
if (GetTypeDefFlagsOrThrow(typeDef).IsInterface())
{
HasGuidAttribute(typeDef, out interfaceGuid);
}
if (typeIdentifierInfo.SignatureIndex == 1)
{
// extract the value
BlobHandle valueBlob = GetCustomAttributeValueOrThrow(typeIdentifierInfo.Handle);
if (!valueBlob.IsNil)
{
BlobReader reader = MetadataReader.GetBlobReader(valueBlob);
if (reader.Length > 4)
{
// check prolog
if (reader.ReadInt16() == 1)
{
if (!CrackStringInAttributeValue(out scope, ref reader) ||
!CrackStringInAttributeValue(out identifier, ref reader))
{
return false;
}
}
}
}
}
return true;
}
catch (BadImageFormatException)
{
return false;
}
}
#nullable enable
/// <summary>
/// Gets the well-known optional named properties on ObsoleteAttribute, if present.
/// Both 'diagnosticId' and 'urlFormat' may be present, or only one, or neither.
/// </summary>
/// <remarks>
/// Failure to find any of these properties does not imply failure to decode the ObsoleteAttribute,
/// so we don't return a value indicating success or failure.
/// </remarks>
private static (string? diagnosticId, string? urlFormat) CrackObsoleteProperties(ref BlobReader sig, IAttributeNamedArgumentDecoder decoder)
{
string? diagnosticId = null;
string? urlFormat = null;
try
{
// See CIL spec section II.23.3 Custom attributes
//
// Next is a description of the optional “named” fields and properties.
// This starts with NumNamed– an unsigned int16 giving the number of “named” properties or fields that follow.
var numNamed = sig.ReadUInt16();
for (int i = 0; i < numNamed && (diagnosticId is null || urlFormat is null); i++)
{
var ((name, value), isProperty, typeCode, /* elementTypeCode */ _) = decoder.DecodeCustomAttributeNamedArgumentOrThrow(ref sig);
if (typeCode == SerializationTypeCode.String && isProperty && value.ValueInternal is string stringValue)
{
if (diagnosticId is null && name == ObsoleteAttributeData.DiagnosticIdPropertyName)
{
diagnosticId = stringValue;
}
else if (urlFormat is null && name == ObsoleteAttributeData.UrlFormatPropertyName)
{
urlFormat = stringValue;
}
}
}
}
catch (BadImageFormatException) { }
catch (UnsupportedSignatureContent) { }
return (diagnosticId, urlFormat);
}
private static bool CrackDeprecatedAttributeData([NotNullWhen(true)] out ObsoleteAttributeData? value, ref BlobReader sig)
{
StringAndInt args;
if (CrackStringAndIntInAttributeValue(out args, ref sig))
{
value = new ObsoleteAttributeData(ObsoleteAttributeKind.Deprecated, args.StringValue, args.IntValue == 1, diagnosticId: null, urlFormat: null);
return true;
}
value = null;
return false;
}
private static bool CrackStringAndIntInAttributeValue(out StringAndInt value, ref BlobReader sig)
{
value = default(StringAndInt);
return
CrackStringInAttributeValue(out value.StringValue, ref sig) &&
CrackIntInAttributeValue(out value.IntValue, ref sig);
}
internal static bool CrackStringInAttributeValue(out string? value, ref BlobReader sig)
{
try
{
int strLen;
if (sig.TryReadCompressedInteger(out strLen) && sig.RemainingBytes >= strLen)
{
value = sig.ReadUTF8(strLen);
// Trim null characters at the end to mimic native compiler behavior.
// There are libraries that have them and leaving them in breaks tests.
value = value.TrimEnd('\0');
return true;
}
value = null;
// Strings are stored as UTF8, but 0xFF means NULL string.
return sig.RemainingBytes >= 1 && sig.ReadByte() == 0xFF;
}
catch (BadImageFormatException)
{
value = null;
return false;
}
}
internal static bool CrackStringArrayInAttributeValue(out ImmutableArray<string?> value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
uint arrayLen = sig.ReadUInt32();
var stringArray = new string?[arrayLen];
for (int i = 0; i < arrayLen; i++)
{
if (!CrackStringInAttributeValue(out stringArray[i], ref sig))
{
value = stringArray.AsImmutableOrNull();
return false;
}
}
value = stringArray.AsImmutableOrNull();
return true;
}
value = default;
return false;
}
internal static bool CrackBoolAndStringArrayInAttributeValue(out BoolAndStringArrayData value, ref BlobReader sig)
{
if (CrackBooleanInAttributeValue(out bool sense, ref sig) &&
CrackStringArrayInAttributeValue(out ImmutableArray<string?> strings, ref sig))
{
value = new BoolAndStringArrayData(sense, strings);
return true;
}
value = default;
return false;
}
internal static bool CrackBoolAndStringInAttributeValue(out BoolAndStringData value, ref BlobReader sig)
{
if (CrackBooleanInAttributeValue(out bool sense, ref sig) &&
CrackStringInAttributeValue(out string? @string, ref sig))
{
value = new BoolAndStringData(sense, @string);
return true;
}
value = default;
return false;
}
internal static bool CrackBooleanInAttributeValue(out bool value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 1)
{
value = sig.ReadBoolean();
return true;
}
value = false;
return false;
}
internal static bool CrackByteInAttributeValue(out byte value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 1)
{
value = sig.ReadByte();
return true;
}
value = 0xff;
return false;
}
internal static bool CrackShortInAttributeValue(out short value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 2)
{
value = sig.ReadInt16();
return true;
}
value = -1;
return false;
}
internal static bool CrackIntInAttributeValue(out int value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
value = sig.ReadInt32();
return true;
}
value = -1;
return false;
}
internal static bool CrackLongInAttributeValue(out long value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 8)
{
value = sig.ReadInt64();
return true;
}
value = -1;
return false;
}
// Note: not a general purpose helper
private static bool CrackDecimalInDecimalConstantAttribute(out decimal value, ref BlobReader sig)
{
byte scale;
byte sign;
int high;
int mid;
int low;
if (CrackByteInAttributeValue(out scale, ref sig) &&
CrackByteInAttributeValue(out sign, ref sig) &&
CrackIntInAttributeValue(out high, ref sig) &&
CrackIntInAttributeValue(out mid, ref sig) &&
CrackIntInAttributeValue(out low, ref sig))
{
value = new decimal(low, mid, high, sign != 0, scale);
return true;
}
value = -1;
return false;
}
internal static bool CrackBoolArrayInAttributeValue(out ImmutableArray<bool> value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
uint arrayLen = sig.ReadUInt32();
if (sig.RemainingBytes >= arrayLen)
{
var boolArrayBuilder = ArrayBuilder<bool>.GetInstance((int)arrayLen);
for (int i = 0; i < arrayLen; i++)
{
boolArrayBuilder.Add(sig.ReadByte() == 1);
}
value = boolArrayBuilder.ToImmutableAndFree();
return true;
}
}
value = default(ImmutableArray<bool>);
return false;
}
internal static bool CrackByteArrayInAttributeValue(out ImmutableArray<byte> value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
uint arrayLen = sig.ReadUInt32();
if (sig.RemainingBytes >= arrayLen)
{
var byteArrayBuilder = ArrayBuilder<byte>.GetInstance((int)arrayLen);
for (int i = 0; i < arrayLen; i++)
{
byteArrayBuilder.Add(sig.ReadByte());
}
value = byteArrayBuilder.ToImmutableAndFree();
return true;
}
}
value = default(ImmutableArray<byte>);
return false;
}
#nullable disable
internal struct AttributeInfo
{
public readonly CustomAttributeHandle Handle;
public readonly byte SignatureIndex;
public AttributeInfo(CustomAttributeHandle handle, int signatureIndex)
{
Debug.Assert(signatureIndex >= 0 && signatureIndex <= byte.MaxValue);
this.Handle = handle;
this.SignatureIndex = (byte)signatureIndex;
}
public bool HasValue
{
get { return !Handle.IsNil; }
}
}
internal List<AttributeInfo> FindTargetAttributes(EntityHandle hasAttribute, AttributeDescription description)
{
List<AttributeInfo> result = null;
try
{
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(hasAttribute))
{
int signatureIndex = GetTargetAttributeSignatureIndex(attributeHandle, description);
if (signatureIndex != -1)
{
if (result == null)
{
result = new List<AttributeInfo>();
}
// We found a match
result.Add(new AttributeInfo(attributeHandle, signatureIndex));
}
}
}
catch (BadImageFormatException)
{ }
return result;
}
internal AttributeInfo FindTargetAttribute(EntityHandle hasAttribute, AttributeDescription description)
{
return FindTargetAttribute(MetadataReader, hasAttribute, description);
}
internal static AttributeInfo FindTargetAttribute(MetadataReader metadataReader, EntityHandle hasAttribute, AttributeDescription description)
{
try
{
foreach (var attributeHandle in metadataReader.GetCustomAttributes(hasAttribute))
{
int signatureIndex = GetTargetAttributeSignatureIndex(metadataReader, attributeHandle, description);
if (signatureIndex != -1)
{
// We found a match
return new AttributeInfo(attributeHandle, signatureIndex);
}
}
}
catch (BadImageFormatException)
{ }
return default(AttributeInfo);
}
internal AttributeInfo FindLastTargetAttribute(EntityHandle hasAttribute, AttributeDescription description)
{
try
{
AttributeInfo attrInfo = default(AttributeInfo);
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(hasAttribute))
{
int signatureIndex = GetTargetAttributeSignatureIndex(attributeHandle, description);
if (signatureIndex != -1)
{
// We found a match
attrInfo = new AttributeInfo(attributeHandle, signatureIndex);
}
}
return attrInfo;
}
catch (BadImageFormatException)
{ }
return default(AttributeInfo);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal int GetParamArrayCountOrThrow(EntityHandle hasAttribute)
{
int count = 0;
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(hasAttribute))
{
if (GetTargetAttributeSignatureIndex(attributeHandle,
AttributeDescription.ParamArrayAttribute) != -1)
{
count++;
}
}
return count;
}
private bool IsNoPiaLocalType(TypeDefinitionHandle typeDef, out AttributeInfo attributeInfo)
{
if (_lazyContainsNoPiaLocalTypes == ThreeState.False)
{
attributeInfo = default(AttributeInfo);
return false;
}
if (_lazyNoPiaLocalTypeCheckBitMap != null &&
_lazyTypeDefToTypeIdentifierMap != null)
{
int rid = MetadataReader.GetRowNumber(typeDef);
Debug.Assert(rid > 0);
int item = rid / 32;
int bit = 1 << (rid % 32);
if ((_lazyNoPiaLocalTypeCheckBitMap[item] & bit) != 0)
{
return _lazyTypeDefToTypeIdentifierMap.TryGetValue(typeDef, out attributeInfo);
}
}
try
{
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(typeDef))
{
int signatureIndex = IsTypeIdentifierAttribute(attributeHandle);
if (signatureIndex != -1)
{
// We found a match
_lazyContainsNoPiaLocalTypes = ThreeState.True;
RegisterNoPiaLocalType(typeDef, attributeHandle, signatureIndex);
attributeInfo = new AttributeInfo(attributeHandle, signatureIndex);
return true;
}
}
}
catch (BadImageFormatException)
{ }
RecordNoPiaLocalTypeCheck(typeDef);
attributeInfo = default(AttributeInfo);
return false;
}
private void RegisterNoPiaLocalType(TypeDefinitionHandle typeDef, CustomAttributeHandle customAttribute, int signatureIndex)
{
if (_lazyNoPiaLocalTypeCheckBitMap == null)
{
Interlocked.CompareExchange(
ref _lazyNoPiaLocalTypeCheckBitMap,
new int[(MetadataReader.TypeDefinitions.Count + 32) / 32],
null);
}
if (_lazyTypeDefToTypeIdentifierMap == null)
{
Interlocked.CompareExchange(
ref _lazyTypeDefToTypeIdentifierMap,
new ConcurrentDictionary<TypeDefinitionHandle, AttributeInfo>(),
null);
}
_lazyTypeDefToTypeIdentifierMap.TryAdd(typeDef, new AttributeInfo(customAttribute, signatureIndex));
RecordNoPiaLocalTypeCheck(typeDef);
}
private void RecordNoPiaLocalTypeCheck(TypeDefinitionHandle typeDef)
{
if (_lazyNoPiaLocalTypeCheckBitMap == null)
{
return;
}
int rid = MetadataTokens.GetRowNumber(typeDef);
Debug.Assert(rid > 0);
int item = rid / 32;
int bit = 1 << (rid % 32);
int oldValue;
do
{
oldValue = _lazyNoPiaLocalTypeCheckBitMap[item];
}
while (Interlocked.CompareExchange(
ref _lazyNoPiaLocalTypeCheckBitMap[item],
oldValue | bit,
oldValue) != oldValue);
}
/// <summary>
/// Determine if custom attribute application is
/// NoPia TypeIdentifier.
/// </summary>
/// <returns>
/// An index of the target constructor signature in
/// signaturesOfTypeIdentifierAttribute array, -1 if
/// this is not NoPia TypeIdentifier.
/// </returns>
private int IsTypeIdentifierAttribute(CustomAttributeHandle customAttribute)
{
const int No = -1;
try
{
if (MetadataReader.GetCustomAttribute(customAttribute).Parent.Kind != HandleKind.TypeDefinition)
{
// Ignore attributes attached to anything, but type definitions.
return No;
}
return GetTargetAttributeSignatureIndex(customAttribute, AttributeDescription.TypeIdentifierAttribute);
}
catch (BadImageFormatException)
{
return No;
}
}
/// <summary>
/// Determines if a custom attribute matches a namespace and name.
/// </summary>
/// <param name="customAttribute">Handle of the custom attribute.</param>
/// <param name="namespaceName">The custom attribute's namespace in metadata format (case sensitive)</param>
/// <param name="typeName">The custom attribute's type name in metadata format (case sensitive)</param>
/// <param name="ctor">Constructor of the custom attribute.</param>
/// <param name="ignoreCase">Should case be ignored for name comparison?</param>
/// <returns>true if match is found</returns>
internal bool IsTargetAttribute(
CustomAttributeHandle customAttribute,
string namespaceName,
string typeName,
out EntityHandle ctor,
bool ignoreCase = false)
{
return IsTargetAttribute(MetadataReader, customAttribute, namespaceName, typeName, out ctor, ignoreCase);
}
/// <summary>
/// Determines if a custom attribute matches a namespace and name.
/// </summary>
/// <param name="metadataReader">The metadata reader.</param>
/// <param name="customAttribute">Handle of the custom attribute.</param>
/// <param name="namespaceName">The custom attribute's namespace in metadata format (case sensitive)</param>
/// <param name="typeName">The custom attribute's type name in metadata format (case sensitive)</param>
/// <param name="ctor">Constructor of the custom attribute.</param>
/// <param name="ignoreCase">Should case be ignored for name comparison?</param>
/// <returns>true if match is found</returns>
private static bool IsTargetAttribute(
MetadataReader metadataReader,
CustomAttributeHandle customAttribute,
string namespaceName,
string typeName,
out EntityHandle ctor,
bool ignoreCase)
{
Debug.Assert(namespaceName != null);
Debug.Assert(typeName != null);
EntityHandle ctorType;
StringHandle ctorTypeNamespace;
StringHandle ctorTypeName;
if (!GetTypeAndConstructor(metadataReader, customAttribute, out ctorType, out ctor))
{
return false;
}
if (!GetAttributeNamespaceAndName(metadataReader, ctorType, out ctorTypeNamespace, out ctorTypeName))
{
return false;
}
try
{
return StringEquals(metadataReader, ctorTypeName, typeName, ignoreCase)
&& StringEquals(metadataReader, ctorTypeNamespace, namespaceName, ignoreCase);
}
catch (BadImageFormatException)
{
return false;
}
}
/// <summary>
/// Returns MetadataToken for assembly ref matching name
/// </summary>
/// <param name="assemblyName">The assembly name in metadata format (case sensitive)</param>
/// <returns>Matching assembly ref token or nil (0)</returns>
internal AssemblyReferenceHandle GetAssemblyRef(string assemblyName)
{
Debug.Assert(assemblyName != null);
try
{
// Iterate over assembly ref rows
foreach (var assemblyRef in MetadataReader.AssemblyReferences)
{
// Check whether matching name
if (MetadataReader.StringComparer.Equals(MetadataReader.GetAssemblyReference(assemblyRef).Name, assemblyName))
{
// Return assembly ref token
return assemblyRef;
}
}
}
catch (BadImageFormatException)
{ }
// Not found
return default(AssemblyReferenceHandle);
}
/// <summary>
/// Returns MetadataToken for type ref matching resolution scope and name
/// </summary>
/// <param name="resolutionScope">The resolution scope token</param>
/// <param name="namespaceName">The namespace name in metadata format (case sensitive)</param>
/// <param name="typeName">The type name in metadata format (case sensitive)</param>
/// <returns>Matching type ref token or nil (0)</returns>
internal EntityHandle GetTypeRef(
EntityHandle resolutionScope,
string namespaceName,
string typeName)
{
Debug.Assert(!resolutionScope.IsNil);
Debug.Assert(namespaceName != null);
Debug.Assert(typeName != null);
try
{
// Iterate over type ref rows
foreach (var handle in MetadataReader.TypeReferences)
{
var typeRef = MetadataReader.GetTypeReference(handle);
// Check whether matching resolution scope
if (typeRef.ResolutionScope != resolutionScope)
{
continue;
}
// Check whether matching name
if (!MetadataReader.StringComparer.Equals(typeRef.Name, typeName))
{
continue;
}
if (MetadataReader.StringComparer.Equals(typeRef.Namespace, namespaceName))
{
// Return type ref token
return handle;
}
}
}
catch (BadImageFormatException)
{ }
// Not found
return default(TypeReferenceHandle);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetTypeRefPropsOrThrow(
TypeReferenceHandle handle,
out string name,
out string @namespace,
out EntityHandle resolutionScope)
{
TypeReference typeRef = MetadataReader.GetTypeReference(handle);
resolutionScope = typeRef.ResolutionScope;
name = MetadataReader.GetString(typeRef.Name);
Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name));
@namespace = MetadataReader.GetString(typeRef.Namespace);
}
/// <summary>
/// Determine if custom attribute matches the target attribute.
/// </summary>
/// <param name="customAttribute">
/// Handle of the custom attribute.
/// </param>
/// <param name="description">The attribute to match.</param>
/// <returns>
/// An index of the target constructor signature in
/// signatures array, -1 if
/// this is not the target attribute.
/// </returns>
internal int GetTargetAttributeSignatureIndex(CustomAttributeHandle customAttribute, AttributeDescription description)
{
return GetTargetAttributeSignatureIndex(MetadataReader, customAttribute, description);
}
/// <summary>
/// Determine if custom attribute matches the target attribute.
/// </summary>
/// <param name="metadataReader">
/// The metadata reader.
/// </param>
/// <param name="customAttribute">
/// Handle of the custom attribute.
/// </param>
/// <param name="description">The attribute to match.</param>
/// <returns>
/// An index of the target constructor signature in
/// signatures array, -1 if
/// this is not the target attribute.
/// </returns>
private static int GetTargetAttributeSignatureIndex(MetadataReader metadataReader, CustomAttributeHandle customAttribute, AttributeDescription description)
{
const int No = -1;
EntityHandle ctor;
// Check namespace and type name and get signature if a match is found
if (!IsTargetAttribute(metadataReader, customAttribute, description.Namespace, description.Name, out ctor, description.MatchIgnoringCase))
{
return No;
}
try
{
// Check signatures
BlobReader sig = metadataReader.GetBlobReader(GetMethodSignatureOrThrow(metadataReader, ctor));
for (int i = 0; i < description.Signatures.Length; i++)
{
var targetSignature = description.Signatures[i];
Debug.Assert(targetSignature.Length >= 3);
sig.Reset();
// Make sure the headers match.
if (sig.RemainingBytes >= 3 &&
sig.ReadByte() == targetSignature[0] &&
sig.ReadByte() == targetSignature[1] &&
sig.ReadByte() == targetSignature[2])
{
int j = 3;
for (; j < targetSignature.Length; j++)
{
if (sig.RemainingBytes == 0)
{
// No more bytes in the signature
break;
}
SignatureTypeCode b = sig.ReadSignatureTypeCode();
if ((SignatureTypeCode)targetSignature[j] == b)
{
switch (b)
{
case SignatureTypeCode.TypeHandle:
EntityHandle token = sig.ReadTypeHandle();
HandleKind tokenType = token.Kind;
StringHandle name;
StringHandle ns;
if (tokenType == HandleKind.TypeDefinition)
{
TypeDefinitionHandle typeHandle = (TypeDefinitionHandle)token;
if (IsNestedTypeDefOrThrow(metadataReader, typeHandle))
{
// At the moment, none of the well-known attributes take nested types.
break; // Signature doesn't match.
}
TypeDefinition typeDef = metadataReader.GetTypeDefinition(typeHandle);
name = typeDef.Name;
ns = typeDef.Namespace;
}
else if (tokenType == HandleKind.TypeReference)
{
TypeReference typeRef = metadataReader.GetTypeReference((TypeReferenceHandle)token);
if (typeRef.ResolutionScope.Kind == HandleKind.TypeReference)
{
// At the moment, none of the well-known attributes take nested types.
break; // Signature doesn't match.
}
name = typeRef.Name;
ns = typeRef.Namespace;
}
else
{
break; // Signature doesn't match.
}
AttributeDescription.TypeHandleTargetInfo targetInfo = AttributeDescription.TypeHandleTargets[targetSignature[j + 1]];
if (StringEquals(metadataReader, ns, targetInfo.Namespace, ignoreCase: false) &&
StringEquals(metadataReader, name, targetInfo.Name, ignoreCase: false))
{
j++;
continue;
}
break; // Signature doesn't match.
case SignatureTypeCode.SZArray:
// Verify array element type
continue;
default:
continue;
}
}
break; // Signature doesn't match.
}
if (sig.RemainingBytes == 0 && j == targetSignature.Length)
{
// We found a match
return i;
}
}
}
}
catch (BadImageFormatException)
{ }
return No;
}
/// <summary>
/// Given a token for a constructor, return the token for the constructor's type and the blob containing the
/// constructor's signature.
/// </summary>
/// <returns>True if the function successfully returns the type and signature.</returns>
internal bool GetTypeAndConstructor(
CustomAttributeHandle customAttribute,
out EntityHandle ctorType,
out EntityHandle attributeCtor)
{
return GetTypeAndConstructor(MetadataReader, customAttribute, out ctorType, out attributeCtor);
}
/// <summary>
/// Given a token for a constructor, return the token for the constructor's type and the blob containing the
/// constructor's signature.
/// </summary>
/// <returns>True if the function successfully returns the type and signature.</returns>
private static bool GetTypeAndConstructor(
MetadataReader metadataReader,
CustomAttributeHandle customAttribute,
out EntityHandle ctorType,
out EntityHandle attributeCtor)
{
try
{
ctorType = default(EntityHandle);
attributeCtor = metadataReader.GetCustomAttribute(customAttribute).Constructor;
if (attributeCtor.Kind == HandleKind.MemberReference)
{
MemberReference memberRef = metadataReader.GetMemberReference((MemberReferenceHandle)attributeCtor);
StringHandle ctorName = memberRef.Name;
if (!metadataReader.StringComparer.Equals(ctorName, WellKnownMemberNames.InstanceConstructorName))
{
// Not a constructor.
return false;
}
ctorType = memberRef.Parent;
}
else if (attributeCtor.Kind == HandleKind.MethodDefinition)
{
var methodDef = metadataReader.GetMethodDefinition((MethodDefinitionHandle)attributeCtor);
if (!metadataReader.StringComparer.Equals(methodDef.Name, WellKnownMemberNames.InstanceConstructorName))
{
// Not a constructor.
return false;
}
ctorType = methodDef.GetDeclaringType();
Debug.Assert(!ctorType.IsNil);
}
else
{
// invalid metadata
return false;
}
return true;
}
catch (BadImageFormatException)
{
ctorType = default(EntityHandle);
attributeCtor = default(EntityHandle);
return false;
}
}
/// <summary>
/// Given a token for a type, return the type's name and namespace. Only works for top level types.
/// namespaceHandle will be NamespaceDefinitionHandle for defs and StringHandle for refs.
/// </summary>
/// <returns>True if the function successfully returns the name and namespace.</returns>
internal bool GetAttributeNamespaceAndName(EntityHandle typeDefOrRef, out StringHandle namespaceHandle, out StringHandle nameHandle)
{
return GetAttributeNamespaceAndName(MetadataReader, typeDefOrRef, out namespaceHandle, out nameHandle);
}
/// <summary>
/// Given a token for a type, return the type's name and namespace. Only works for top level types.
/// namespaceHandle will be NamespaceDefinitionHandle for defs and StringHandle for refs.
/// </summary>
/// <returns>True if the function successfully returns the name and namespace.</returns>
private static bool GetAttributeNamespaceAndName(MetadataReader metadataReader, EntityHandle typeDefOrRef, out StringHandle namespaceHandle, out StringHandle nameHandle)
{
nameHandle = default(StringHandle);
namespaceHandle = default(StringHandle);
try
{
if (typeDefOrRef.Kind == HandleKind.TypeReference)
{
TypeReference typeRefRow = metadataReader.GetTypeReference((TypeReferenceHandle)typeDefOrRef);
HandleKind handleType = typeRefRow.ResolutionScope.Kind;
if (handleType == HandleKind.TypeReference || handleType == HandleKind.TypeDefinition)
{
// TODO - Support nested types.
return false;
}
nameHandle = typeRefRow.Name;
namespaceHandle = typeRefRow.Namespace;
}
else if (typeDefOrRef.Kind == HandleKind.TypeDefinition)
{
var def = metadataReader.GetTypeDefinition((TypeDefinitionHandle)typeDefOrRef);
if (IsNested(def.Attributes))
{
// TODO - Support nested types.
return false;
}
nameHandle = def.Name;
namespaceHandle = def.Namespace;
}
else
{
// unsupported metadata
return false;
}
return true;
}
catch (BadImageFormatException)
{
return false;
}
}
/// <summary>
/// For testing purposes only!!!
/// </summary>
internal void PretendThereArentNoPiaLocalTypes()
{
Debug.Assert(_lazyContainsNoPiaLocalTypes != ThreeState.True);
_lazyContainsNoPiaLocalTypes = ThreeState.False;
}
internal bool ContainsNoPiaLocalTypes()
{
if (_lazyContainsNoPiaLocalTypes == ThreeState.Unknown)
{
try
{
foreach (var attributeHandle in MetadataReader.CustomAttributes)
{
int signatureIndex = IsTypeIdentifierAttribute(attributeHandle);
if (signatureIndex != -1)
{
// We found a match
_lazyContainsNoPiaLocalTypes = ThreeState.True;
// We excluded attributes not applied on TypeDefs above:
var parent = (TypeDefinitionHandle)MetadataReader.GetCustomAttribute(attributeHandle).Parent;
RegisterNoPiaLocalType(parent, attributeHandle, signatureIndex);
return true;
}
}
}
catch (BadImageFormatException)
{ }
_lazyContainsNoPiaLocalTypes = ThreeState.False;
}
return _lazyContainsNoPiaLocalTypes == ThreeState.True;
}
internal bool HasNullableContextAttribute(EntityHandle token, out byte value)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NullableContextAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0);
if (!info.HasValue)
{
value = 0;
return false;
}
return TryExtractValueFromAttribute(info.Handle, out value, s_attributeByteValueExtractor);
}
internal bool HasNullableAttribute(EntityHandle token, out byte defaultTransform, out ImmutableArray<byte> nullableTransforms)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NullableAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
defaultTransform = 0;
nullableTransforms = default(ImmutableArray<byte>);
if (!info.HasValue)
{
return false;
}
if (info.SignatureIndex == 0)
{
return TryExtractValueFromAttribute(info.Handle, out defaultTransform, s_attributeByteValueExtractor);
}
return TryExtractByteArrayValueFromAttribute(info.Handle, out nullableTransforms);
}
#endregion
#region TypeSpec helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobReader GetTypeSpecificationSignatureReaderOrThrow(TypeSpecificationHandle typeSpec)
{
// TODO: Check validity of the typeSpec handle.
BlobHandle signature = MetadataReader.GetTypeSpecification(typeSpec).Signature;
// TODO: error checking offset in range
return MetadataReader.GetBlobReader(signature);
}
#endregion
#region MethodSpec helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetMethodSpecificationOrThrow(MethodSpecificationHandle handle, out EntityHandle method, out BlobHandle instantiation)
{
var methodSpec = MetadataReader.GetMethodSpecification(handle);
method = methodSpec.Method;
instantiation = methodSpec.Signature;
}
#endregion
#region GenericParam helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetGenericParamPropsOrThrow(
GenericParameterHandle handle,
out string name,
out GenericParameterAttributes flags)
{
GenericParameter row = MetadataReader.GetGenericParameter(handle);
name = MetadataReader.GetString(row.Name);
flags = row.Attributes;
}
#endregion
#region MethodDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetMethodDefNameOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetString(MetadataReader.GetMethodDefinition(methodDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetMethodSignatureOrThrow(MethodDefinitionHandle methodDef)
{
return GetMethodSignatureOrThrow(MetadataReader, methodDef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static BlobHandle GetMethodSignatureOrThrow(MetadataReader metadataReader, MethodDefinitionHandle methodDef)
{
return metadataReader.GetMethodDefinition(methodDef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetMethodSignatureOrThrow(EntityHandle methodDefOrRef)
{
return GetMethodSignatureOrThrow(MetadataReader, methodDefOrRef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static BlobHandle GetMethodSignatureOrThrow(MetadataReader metadataReader, EntityHandle methodDefOrRef)
{
switch (methodDefOrRef.Kind)
{
case HandleKind.MethodDefinition:
return GetMethodSignatureOrThrow(metadataReader, (MethodDefinitionHandle)methodDefOrRef);
case HandleKind.MemberReference:
return GetSignatureOrThrow(metadataReader, (MemberReferenceHandle)methodDefOrRef);
default:
throw ExceptionUtilities.UnexpectedValue(methodDefOrRef.Kind);
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public MethodAttributes GetMethodDefFlagsOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal TypeDefinitionHandle FindContainingTypeOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).GetDeclaringType();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal TypeDefinitionHandle FindContainingTypeOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetFieldDefinition(fieldDef).GetDeclaringType();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EntityHandle GetContainingTypeOrThrow(MemberReferenceHandle memberRef)
{
return MetadataReader.GetMemberReference(memberRef).Parent;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetMethodDefPropsOrThrow(
MethodDefinitionHandle methodDef,
out string name,
out MethodImplAttributes implFlags,
out MethodAttributes flags,
out int rva)
{
MethodDefinition methodRow = MetadataReader.GetMethodDefinition(methodDef);
name = MetadataReader.GetString(methodRow.Name);
implFlags = methodRow.ImplAttributes;
flags = methodRow.Attributes;
rva = methodRow.RelativeVirtualAddress;
Debug.Assert(rva >= 0);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetMethodImplPropsOrThrow(
MethodImplementationHandle methodImpl,
out EntityHandle body,
out EntityHandle declaration)
{
var impl = MetadataReader.GetMethodImplementation(methodImpl);
body = impl.MethodBody;
declaration = impl.MethodDeclaration;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal GenericParameterHandleCollection GetGenericParametersForMethodOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).GetGenericParameters();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal ParameterHandleCollection GetParametersOfMethodOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).GetParameters();
}
internal DllImportData GetDllImportData(MethodDefinitionHandle methodDef)
{
try
{
var methodImport = MetadataReader.GetMethodDefinition(methodDef).GetImport();
if (methodImport.Module.IsNil)
{
// TODO (tomat): report an error?
return null;
}
string moduleName = GetModuleRefNameOrThrow(methodImport.Module);
string entryPointName = MetadataReader.GetString(methodImport.Name);
MethodImportAttributes flags = (MethodImportAttributes)methodImport.Attributes;
return new DllImportData(moduleName, entryPointName, flags);
}
catch (BadImageFormatException)
{
return null;
}
}
#endregion
#region MemberRef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetMemberRefNameOrThrow(MemberReferenceHandle memberRef)
{
return GetMemberRefNameOrThrow(MetadataReader, memberRef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static string GetMemberRefNameOrThrow(MetadataReader metadataReader, MemberReferenceHandle memberRef)
{
return metadataReader.GetString(metadataReader.GetMemberReference(memberRef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetSignatureOrThrow(MemberReferenceHandle memberRef)
{
return GetSignatureOrThrow(MetadataReader, memberRef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static BlobHandle GetSignatureOrThrow(MetadataReader metadataReader, MemberReferenceHandle memberRef)
{
return metadataReader.GetMemberReference(memberRef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetMemberRefPropsOrThrow(
MemberReferenceHandle memberRef,
out EntityHandle @class,
out string name,
out byte[] signature)
{
MemberReference row = MetadataReader.GetMemberReference(memberRef);
@class = row.Parent;
name = MetadataReader.GetString(row.Name);
signature = MetadataReader.GetBlobBytes(row.Signature);
}
#endregion MemberRef helpers
#region ParamDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetParamPropsOrThrow(
ParameterHandle parameterDef,
out string name,
out ParameterAttributes flags)
{
Parameter parameter = MetadataReader.GetParameter(parameterDef);
name = MetadataReader.GetString(parameter.Name);
flags = parameter.Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetParamNameOrThrow(ParameterHandle parameterDef)
{
Parameter parameter = MetadataReader.GetParameter(parameterDef);
return MetadataReader.GetString(parameter.Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal int GetParameterSequenceNumberOrThrow(ParameterHandle param)
{
return MetadataReader.GetParameter(param).SequenceNumber;
}
#endregion
#region PropertyDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetPropertyDefNameOrThrow(PropertyDefinitionHandle propertyDef)
{
return MetadataReader.GetString(MetadataReader.GetPropertyDefinition(propertyDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetPropertySignatureOrThrow(PropertyDefinitionHandle propertyDef)
{
return MetadataReader.GetPropertyDefinition(propertyDef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetPropertyDefPropsOrThrow(
PropertyDefinitionHandle propertyDef,
out string name,
out PropertyAttributes flags)
{
PropertyDefinition property = MetadataReader.GetPropertyDefinition(propertyDef);
name = MetadataReader.GetString(property.Name);
flags = property.Attributes;
}
#endregion
#region EventDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetEventDefNameOrThrow(EventDefinitionHandle eventDef)
{
return MetadataReader.GetString(MetadataReader.GetEventDefinition(eventDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetEventDefPropsOrThrow(
EventDefinitionHandle eventDef,
out string name,
out EventAttributes flags,
out EntityHandle type)
{
EventDefinition eventRow = MetadataReader.GetEventDefinition(eventDef);
name = MetadataReader.GetString(eventRow.Name);
flags = eventRow.Attributes;
type = eventRow.Type;
}
#endregion
#region FieldDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetFieldDefNameOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetString(MetadataReader.GetFieldDefinition(fieldDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetFieldSignatureOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetFieldDefinition(fieldDef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public FieldAttributes GetFieldDefFlagsOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetFieldDefinition(fieldDef).Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetFieldDefPropsOrThrow(
FieldDefinitionHandle fieldDef,
out string name,
out FieldAttributes flags)
{
FieldDefinition fieldRow = MetadataReader.GetFieldDefinition(fieldDef);
name = MetadataReader.GetString(fieldRow.Name);
flags = fieldRow.Attributes;
}
internal ConstantValue GetParamDefaultValue(ParameterHandle param)
{
Debug.Assert(!param.IsNil);
try
{
var constantHandle = MetadataReader.GetParameter(param).GetDefaultValue();
// TODO: Error checking: Throw an error if the table entry cannot be found
return constantHandle.IsNil ? ConstantValue.Bad : GetConstantValueOrThrow(constantHandle);
}
catch (BadImageFormatException)
{
return ConstantValue.Bad;
}
}
internal ConstantValue GetConstantFieldValue(FieldDefinitionHandle fieldDef)
{
Debug.Assert(!fieldDef.IsNil);
try
{
var constantHandle = MetadataReader.GetFieldDefinition(fieldDef).GetDefaultValue();
// TODO: Error checking: Throw an error if the table entry cannot be found
return constantHandle.IsNil ? ConstantValue.Bad : GetConstantValueOrThrow(constantHandle);
}
catch (BadImageFormatException)
{
return ConstantValue.Bad;
}
}
#endregion
#region Attribute Helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public CustomAttributeHandleCollection GetCustomAttributesOrThrow(EntityHandle handle)
{
return MetadataReader.GetCustomAttributes(handle);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public BlobHandle GetCustomAttributeValueOrThrow(CustomAttributeHandle handle)
{
return MetadataReader.GetCustomAttribute(handle).Value;
}
#endregion
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private BlobHandle GetMarshallingDescriptorHandleOrThrow(EntityHandle fieldOrParameterToken)
{
return fieldOrParameterToken.Kind == HandleKind.FieldDefinition ?
MetadataReader.GetFieldDefinition((FieldDefinitionHandle)fieldOrParameterToken).GetMarshallingDescriptor() :
MetadataReader.GetParameter((ParameterHandle)fieldOrParameterToken).GetMarshallingDescriptor();
}
internal UnmanagedType GetMarshallingType(EntityHandle fieldOrParameterToken)
{
try
{
var blob = GetMarshallingDescriptorHandleOrThrow(fieldOrParameterToken);
if (blob.IsNil)
{
// TODO (tomat): report error:
return 0;
}
byte firstByte = MetadataReader.GetBlobReader(blob).ReadByte();
// return only valid types, other values are not interesting for the compiler:
return firstByte <= 0x50 ? (UnmanagedType)firstByte : 0;
}
catch (BadImageFormatException)
{
return 0;
}
}
internal ImmutableArray<byte> GetMarshallingDescriptor(EntityHandle fieldOrParameterToken)
{
try
{
var blob = GetMarshallingDescriptorHandleOrThrow(fieldOrParameterToken);
if (blob.IsNil)
{
// TODO (tomat): report error:
return ImmutableArray<byte>.Empty;
}
return MetadataReader.GetBlobBytes(blob).AsImmutableOrNull();
}
catch (BadImageFormatException)
{
return ImmutableArray<byte>.Empty;
}
}
internal int? GetFieldOffset(FieldDefinitionHandle fieldDef)
{
try
{
int offset = MetadataReader.GetFieldDefinition(fieldDef).GetOffset();
if (offset == -1)
{
return null;
}
return offset;
}
catch (BadImageFormatException)
{
return null;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private ConstantValue GetConstantValueOrThrow(ConstantHandle handle)
{
var constantRow = MetadataReader.GetConstant(handle);
BlobReader reader = MetadataReader.GetBlobReader(constantRow.Value);
switch (constantRow.TypeCode)
{
case ConstantTypeCode.Boolean:
return ConstantValue.Create(reader.ReadBoolean());
case ConstantTypeCode.Char:
return ConstantValue.Create(reader.ReadChar());
case ConstantTypeCode.SByte:
return ConstantValue.Create(reader.ReadSByte());
case ConstantTypeCode.Int16:
return ConstantValue.Create(reader.ReadInt16());
case ConstantTypeCode.Int32:
return ConstantValue.Create(reader.ReadInt32());
case ConstantTypeCode.Int64:
return ConstantValue.Create(reader.ReadInt64());
case ConstantTypeCode.Byte:
return ConstantValue.Create(reader.ReadByte());
case ConstantTypeCode.UInt16:
return ConstantValue.Create(reader.ReadUInt16());
case ConstantTypeCode.UInt32:
return ConstantValue.Create(reader.ReadUInt32());
case ConstantTypeCode.UInt64:
return ConstantValue.Create(reader.ReadUInt64());
case ConstantTypeCode.Single:
return ConstantValue.Create(reader.ReadSingle());
case ConstantTypeCode.Double:
return ConstantValue.Create(reader.ReadDouble());
case ConstantTypeCode.String:
return ConstantValue.Create(reader.ReadUTF16(reader.Length));
case ConstantTypeCode.NullReference:
// Partition II section 22.9:
// The encoding of Type for the nullref value is ELEMENT_TYPE_CLASS with a Value of a 4-byte zero.
// Unlike uses of ELEMENT_TYPE_CLASS in signatures, this one is not followed by a type token.
if (reader.ReadUInt32() == 0)
{
return ConstantValue.Null;
}
break;
}
return ConstantValue.Bad;
}
internal (int FirstIndex, int SecondIndex) GetAssemblyRefsForForwardedType(string fullName, bool ignoreCase, out string matchedName)
{
EnsureForwardTypeToAssemblyMap();
if (ignoreCase)
{
// This linear search is not the optimal way to use a hashmap, but we should only use
// this functionality when computing diagnostics. Note
// that we can't store the map case-insensitively, since real metadata name
// lookup has to remain case sensitive.
foreach (var pair in _lazyForwardedTypesToAssemblyIndexMap)
{
if (string.Equals(pair.Key, fullName, StringComparison.OrdinalIgnoreCase))
{
matchedName = pair.Key;
return pair.Value;
}
}
}
else
{
(int FirstIndex, int SecondIndex) assemblyIndices;
if (_lazyForwardedTypesToAssemblyIndexMap.TryGetValue(fullName, out assemblyIndices))
{
matchedName = fullName;
return assemblyIndices;
}
}
matchedName = null;
return (FirstIndex: -1, SecondIndex: -1);
}
internal IEnumerable<KeyValuePair<string, (int FirstIndex, int SecondIndex)>> GetForwardedTypes()
{
EnsureForwardTypeToAssemblyMap();
return _lazyForwardedTypesToAssemblyIndexMap;
}
private void EnsureForwardTypeToAssemblyMap()
{
if (_lazyForwardedTypesToAssemblyIndexMap == null)
{
var typesToAssemblyIndexMap = new Dictionary<string, (int FirstIndex, int SecondIndex)>();
try
{
var forwarders = MetadataReader.ExportedTypes;
foreach (var handle in forwarders)
{
ExportedType exportedType = MetadataReader.GetExportedType(handle);
if (!exportedType.IsForwarder)
{
continue;
}
AssemblyReferenceHandle refHandle = (AssemblyReferenceHandle)exportedType.Implementation;
if (refHandle.IsNil)
{
continue;
}
int referencedAssemblyIndex;
try
{
referencedAssemblyIndex = this.GetAssemblyReferenceIndexOrThrow(refHandle);
}
catch (BadImageFormatException)
{
continue;
}
if (referencedAssemblyIndex < 0 || referencedAssemblyIndex >= this.ReferencedAssemblies.Length)
{
continue;
}
string name = MetadataReader.GetString(exportedType.Name);
StringHandle ns = exportedType.Namespace;
if (!ns.IsNil)
{
string namespaceString = MetadataReader.GetString(ns);
if (namespaceString.Length > 0)
{
name = namespaceString + "." + name;
}
}
(int FirstIndex, int SecondIndex) indices;
if (typesToAssemblyIndexMap.TryGetValue(name, out indices))
{
Debug.Assert(indices.FirstIndex >= 0, "Not allowed to store a negative (non-existent) index in typesToAssemblyIndexMap");
// Store it only if it was not a duplicate
if (indices.FirstIndex != referencedAssemblyIndex && indices.SecondIndex < 0)
{
indices.SecondIndex = referencedAssemblyIndex;
typesToAssemblyIndexMap[name] = indices;
}
}
else
{
typesToAssemblyIndexMap.Add(name, (FirstIndex: referencedAssemblyIndex, SecondIndex: -1));
}
}
}
catch (BadImageFormatException)
{ }
_lazyForwardedTypesToAssemblyIndexMap = typesToAssemblyIndexMap;
}
}
internal IdentifierCollection TypeNames
{
get
{
return _lazyTypeNameCollection.Value;
}
}
internal IdentifierCollection NamespaceNames
{
get
{
return _lazyNamespaceNameCollection.Value;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal PropertyAccessors GetPropertyMethodsOrThrow(PropertyDefinitionHandle propertyDef)
{
return MetadataReader.GetPropertyDefinition(propertyDef).GetAccessors();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EventAccessors GetEventMethodsOrThrow(EventDefinitionHandle eventDef)
{
return MetadataReader.GetEventDefinition(eventDef).GetAccessors();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal int GetAssemblyReferenceIndexOrThrow(AssemblyReferenceHandle assemblyRef)
{
return MetadataReader.GetRowNumber(assemblyRef) - 1;
}
internal static bool IsNested(TypeAttributes flags)
{
return (flags & ((TypeAttributes)0x00000006)) != 0;
}
/// <summary>
/// Returns true if method IL can be retrieved from the module.
/// </summary>
internal bool HasIL
{
get { return IsEntireImageAvailable; }
}
/// <summary>
/// Returns true if the full image of the module is available.
/// </summary>
internal bool IsEntireImageAvailable
{
get { return _peReaderOpt != null && _peReaderOpt.IsEntireImageAvailable; }
}
/// <exception cref="BadImageFormatException">Invalid metadata.</exception>
internal MethodBodyBlock GetMethodBodyOrThrow(MethodDefinitionHandle methodHandle)
{
// we shouldn't ask for method IL if we don't have PE image
Debug.Assert(_peReaderOpt != null);
MethodDefinition method = MetadataReader.GetMethodDefinition(methodHandle);
if ((method.ImplAttributes & MethodImplAttributes.CodeTypeMask) != MethodImplAttributes.IL ||
method.RelativeVirtualAddress == 0)
{
return null;
}
return _peReaderOpt.GetMethodBody(method.RelativeVirtualAddress);
}
// TODO: remove, API should be provided by MetadataReader
private static bool StringEquals(MetadataReader metadataReader, StringHandle nameHandle, string name, bool ignoreCase)
{
if (ignoreCase)
{
return string.Equals(metadataReader.GetString(nameHandle), name, StringComparison.OrdinalIgnoreCase);
}
return metadataReader.StringComparer.Equals(nameHandle, name);
}
// Provides a UTF8 decoder to the MetadataReader that reuses strings from the string table
// rather than allocating on each call to MetadataReader.GetString(handle).
private sealed class StringTableDecoder : MetadataStringDecoder
{
public static readonly StringTableDecoder Instance = new StringTableDecoder();
private StringTableDecoder() : base(System.Text.Encoding.UTF8) { }
public override unsafe string GetString(byte* bytes, int byteCount)
{
return StringTable.AddSharedUTF8(new ReadOnlySpan<byte>(bytes, byteCount));
}
}
public ModuleMetadata GetNonDisposableMetadata() => _owner.Copy();
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Threading;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Symbols;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// A set of helpers for extracting elements from metadata.
/// This type is not responsible for managing the underlying storage
/// backing the PE image.
/// </summary>
internal sealed class PEModule : IDisposable
{
/// <summary>
/// We need to store reference to the module metadata to keep the metadata alive while
/// symbols have reference to PEModule.
/// </summary>
private readonly ModuleMetadata _owner;
// Either we have PEReader or we have pointer and size of the metadata blob:
private readonly PEReader _peReaderOpt;
private readonly IntPtr _metadataPointerOpt;
private readonly int _metadataSizeOpt;
private MetadataReader _lazyMetadataReader;
private ImmutableArray<AssemblyIdentity> _lazyAssemblyReferences;
/// <summary>
/// This is a tuple for optimization purposes. In valid cases, we need to store
/// only one assembly index per type. However, if we found more than one, we
/// keep a second one as well to use it for error reporting.
/// We use -1 in case there was no forward.
/// </summary>
private Dictionary<string, (int FirstIndex, int SecondIndex)> _lazyForwardedTypesToAssemblyIndexMap;
private readonly Lazy<IdentifierCollection> _lazyTypeNameCollection;
private readonly Lazy<IdentifierCollection> _lazyNamespaceNameCollection;
private string _lazyName;
private bool _isDisposed;
/// <summary>
/// Using <see cref="ThreeState"/> as a type for atomicity.
/// </summary>
private ThreeState _lazyContainsNoPiaLocalTypes;
/// <summary>
/// If bitmap is not null, each bit indicates whether a TypeDef
/// with corresponding RowId has been checked if it is a NoPia
/// local type. If the bit is 1, local type will have an entry
/// in m_lazyTypeDefToTypeIdentifierMap.
/// </summary>
private int[] _lazyNoPiaLocalTypeCheckBitMap;
/// <summary>
/// For each TypeDef that has 1 in m_lazyNoPiaLocalTypeCheckBitMap,
/// this map stores corresponding TypeIdentifier AttributeInfo.
/// </summary>
private ConcurrentDictionary<TypeDefinitionHandle, AttributeInfo> _lazyTypeDefToTypeIdentifierMap;
// The module can be used by different compilations or different versions of the "same"
// compilation, which use different hash algorithms. Let's cache result for each distinct
// algorithm.
private readonly CryptographicHashProvider _hashesOpt;
#nullable enable
private delegate bool AttributeValueExtractor<T>(out T value, ref BlobReader sigReader);
private static readonly AttributeValueExtractor<string?> s_attributeStringValueExtractor = CrackStringInAttributeValue;
private static readonly AttributeValueExtractor<StringAndInt> s_attributeStringAndIntValueExtractor = CrackStringAndIntInAttributeValue;
private static readonly AttributeValueExtractor<bool> s_attributeBooleanValueExtractor = CrackBooleanInAttributeValue;
private static readonly AttributeValueExtractor<byte> s_attributeByteValueExtractor = CrackByteInAttributeValue;
private static readonly AttributeValueExtractor<short> s_attributeShortValueExtractor = CrackShortInAttributeValue;
private static readonly AttributeValueExtractor<int> s_attributeIntValueExtractor = CrackIntInAttributeValue;
private static readonly AttributeValueExtractor<long> s_attributeLongValueExtractor = CrackLongInAttributeValue;
// Note: not a general purpose helper
private static readonly AttributeValueExtractor<decimal> s_decimalValueInDecimalConstantAttributeExtractor = CrackDecimalInDecimalConstantAttribute;
private static readonly AttributeValueExtractor<ImmutableArray<bool>> s_attributeBoolArrayValueExtractor = CrackBoolArrayInAttributeValue;
private static readonly AttributeValueExtractor<ImmutableArray<byte>> s_attributeByteArrayValueExtractor = CrackByteArrayInAttributeValue;
private static readonly AttributeValueExtractor<ImmutableArray<string?>> s_attributeStringArrayValueExtractor = CrackStringArrayInAttributeValue;
private static readonly AttributeValueExtractor<ObsoleteAttributeData?> s_attributeDeprecatedDataExtractor = CrackDeprecatedAttributeData;
private static readonly AttributeValueExtractor<BoolAndStringArrayData> s_attributeBoolAndStringArrayValueExtractor = CrackBoolAndStringArrayInAttributeValue;
private static readonly AttributeValueExtractor<BoolAndStringData> s_attributeBoolAndStringValueExtractor = CrackBoolAndStringInAttributeValue;
internal struct BoolAndStringArrayData
{
public BoolAndStringArrayData(bool sense, ImmutableArray<string?> strings)
{
Sense = sense;
Strings = strings;
}
public readonly bool Sense;
public readonly ImmutableArray<string?> Strings;
}
internal struct BoolAndStringData
{
public BoolAndStringData(bool sense, string? @string)
{
Sense = sense;
String = @string;
}
public readonly bool Sense;
public readonly string? String;
}
#nullable disable
// 'ignoreAssemblyRefs' is used by the EE only, when debugging
// .NET Native, where the corlib may have assembly references
// (see https://github.com/dotnet/roslyn/issues/13275).
internal PEModule(ModuleMetadata owner, PEReader peReader, IntPtr metadataOpt, int metadataSizeOpt, bool includeEmbeddedInteropTypes, bool ignoreAssemblyRefs)
{
// shall not throw
Debug.Assert((peReader == null) ^ (metadataOpt == IntPtr.Zero && metadataSizeOpt == 0));
Debug.Assert(metadataOpt == IntPtr.Zero || metadataSizeOpt > 0);
_owner = owner;
_peReaderOpt = peReader;
_metadataPointerOpt = metadataOpt;
_metadataSizeOpt = metadataSizeOpt;
_lazyTypeNameCollection = new Lazy<IdentifierCollection>(ComputeTypeNameCollection);
_lazyNamespaceNameCollection = new Lazy<IdentifierCollection>(ComputeNamespaceNameCollection);
_hashesOpt = (peReader != null) ? new PEHashProvider(peReader) : null;
_lazyContainsNoPiaLocalTypes = includeEmbeddedInteropTypes ? ThreeState.False : ThreeState.Unknown;
if (ignoreAssemblyRefs)
{
_lazyAssemblyReferences = ImmutableArray<AssemblyIdentity>.Empty;
}
}
private sealed class PEHashProvider : CryptographicHashProvider
{
private readonly PEReader _peReader;
public PEHashProvider(PEReader peReader)
{
Debug.Assert(peReader != null);
_peReader = peReader;
}
internal override unsafe ImmutableArray<byte> ComputeHash(HashAlgorithm algorithm)
{
PEMemoryBlock block = _peReader.GetEntireImage();
byte[] hash;
using (var stream = new ReadOnlyUnmanagedMemoryStream(_peReader, (IntPtr)block.Pointer, block.Length))
{
hash = algorithm.ComputeHash(stream);
}
return ImmutableArray.Create(hash);
}
}
internal bool IsDisposed
{
get
{
return _isDisposed;
}
}
public void Dispose()
{
_isDisposed = true;
_peReaderOpt?.Dispose();
}
// for testing
internal PEReader PEReaderOpt
{
get
{
return _peReaderOpt;
}
}
internal MetadataReader MetadataReader
{
get
{
if (_lazyMetadataReader == null)
{
InitializeMetadataReader();
}
if (_isDisposed)
{
// Without locking, which might be expensive, we can't guarantee that the underlying memory
// won't be accessed after the metadata object is disposed. However we can do a cheap check here that
// handles most cases.
ThrowMetadataDisposed();
}
return _lazyMetadataReader;
}
}
private unsafe void InitializeMetadataReader()
{
MetadataReader newReader;
// PEModule is either created with metadata memory block or a PE reader.
if (_metadataPointerOpt != IntPtr.Zero)
{
newReader = new MetadataReader((byte*)_metadataPointerOpt, _metadataSizeOpt, MetadataReaderOptions.ApplyWindowsRuntimeProjections, StringTableDecoder.Instance);
}
else
{
Debug.Assert(_peReaderOpt != null);
// A workaround for https://github.com/dotnet/corefx/issues/1815
bool hasMetadata;
try
{
hasMetadata = _peReaderOpt.HasMetadata;
}
catch
{
hasMetadata = false;
}
if (!hasMetadata)
{
throw new BadImageFormatException(CodeAnalysisResources.PEImageDoesntContainManagedMetadata);
}
newReader = _peReaderOpt.GetMetadataReader(MetadataReaderOptions.ApplyWindowsRuntimeProjections, StringTableDecoder.Instance);
}
Interlocked.CompareExchange(ref _lazyMetadataReader, newReader, null);
}
private static void ThrowMetadataDisposed()
{
throw new ObjectDisposedException(nameof(ModuleMetadata));
}
#region Module level properties and methods
internal bool IsManifestModule
{
get
{
return MetadataReader.IsAssembly;
}
}
internal bool IsLinkedModule
{
get
{
return !MetadataReader.IsAssembly;
}
}
internal bool IsCOFFOnly
{
get
{
// default value if we only have metadata
if (_peReaderOpt == null)
{
return false;
}
return _peReaderOpt.PEHeaders.IsCoffOnly;
}
}
/// <summary>
/// Target architecture of the machine.
/// </summary>
internal Machine Machine
{
get
{
// platform agnostic if we only have metadata
if (_peReaderOpt == null)
{
return Machine.I386;
}
return _peReaderOpt.PEHeaders.CoffHeader.Machine;
}
}
/// <summary>
/// Indicates that this PE file makes Win32 calls. See CorPEKind.pe32BitRequired for more information (http://msdn.microsoft.com/en-us/library/ms230275.aspx).
/// </summary>
internal bool Bit32Required
{
get
{
// platform agnostic if we only have metadata
if (_peReaderOpt == null)
{
return false;
}
return (_peReaderOpt.PEHeaders.CorHeader.Flags & CorFlags.Requires32Bit) != 0;
}
}
internal ImmutableArray<byte> GetHash(AssemblyHashAlgorithm algorithmId)
{
Debug.Assert(_hashesOpt != null);
return _hashesOpt.GetHash(algorithmId);
}
#endregion
#region ModuleDef helpers
internal string Name
{
get
{
if (_lazyName == null)
{
_lazyName = MetadataReader.GetString(MetadataReader.GetModuleDefinition().Name);
}
return _lazyName;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal Guid GetModuleVersionIdOrThrow()
{
return MetadataReader.GetModuleVersionIdOrThrow();
}
#endregion
#region ModuleRef, File helpers
/// <summary>
/// Returns the names of linked managed modules.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal ImmutableArray<string> GetMetadataModuleNamesOrThrow()
{
var builder = ArrayBuilder<string>.GetInstance();
try
{
foreach (var fileHandle in MetadataReader.AssemblyFiles)
{
var file = MetadataReader.GetAssemblyFile(fileHandle);
if (!file.ContainsMetadata)
{
continue;
}
string moduleName = MetadataReader.GetString(file.Name);
if (!MetadataHelpers.IsValidMetadataFileName(moduleName))
{
throw new BadImageFormatException(string.Format(CodeAnalysisResources.InvalidModuleName, this.Name, moduleName));
}
builder.Add(moduleName);
}
return builder.ToImmutable();
}
finally
{
builder.Free();
}
}
/// <summary>
/// Returns names of referenced modules.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal IEnumerable<string> GetReferencedManagedModulesOrThrow()
{
HashSet<EntityHandle> nameTokens = new HashSet<EntityHandle>();
foreach (var handle in MetadataReader.TypeReferences)
{
TypeReference typeRef = MetadataReader.GetTypeReference(handle);
EntityHandle scope = typeRef.ResolutionScope;
if (scope.Kind == HandleKind.ModuleReference)
{
nameTokens.Add(scope);
}
}
foreach (var token in nameTokens)
{
yield return this.GetModuleRefNameOrThrow((ModuleReferenceHandle)token);
}
}
internal ImmutableArray<EmbeddedResource> GetEmbeddedResourcesOrThrow()
{
if (MetadataReader.ManifestResources.Count == 0)
{
return ImmutableArray<EmbeddedResource>.Empty;
}
var builder = ImmutableArray.CreateBuilder<EmbeddedResource>();
foreach (var handle in MetadataReader.ManifestResources)
{
var resource = MetadataReader.GetManifestResource(handle);
if (resource.Implementation.IsNil)
{
string resourceName = MetadataReader.GetString(resource.Name);
builder.Add(new EmbeddedResource((uint)resource.Offset, resource.Attributes, resourceName));
}
}
return builder.ToImmutable();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetModuleRefNameOrThrow(ModuleReferenceHandle moduleRef)
{
return MetadataReader.GetString(MetadataReader.GetModuleReference(moduleRef).Name);
}
#endregion
#region AssemblyRef helpers
// The array is sorted by AssemblyRef RowId, starting with RowId=1 and doesn't have any RowId gaps.
public ImmutableArray<AssemblyIdentity> ReferencedAssemblies
{
get
{
if (_lazyAssemblyReferences == null)
{
_lazyAssemblyReferences = this.MetadataReader.GetReferencedAssembliesOrThrow();
}
return _lazyAssemblyReferences;
}
}
#endregion
#region PE Header helpers
internal string MetadataVersion
{
get { return MetadataReader.MetadataVersion; }
}
#endregion
#region Heaps
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobReader GetMemoryReaderOrThrow(BlobHandle blob)
{
return MetadataReader.GetBlobReader(blob);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetFullNameOrThrow(StringHandle namespaceHandle, StringHandle nameHandle)
{
var attributeTypeName = MetadataReader.GetString(nameHandle);
var attributeTypeNamespaceName = MetadataReader.GetString(namespaceHandle);
return MetadataHelpers.BuildQualifiedName(attributeTypeNamespaceName, attributeTypeName);
}
#endregion
#region AssemblyDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal AssemblyIdentity ReadAssemblyIdentityOrThrow()
{
return MetadataReader.ReadAssemblyIdentityOrThrow();
}
#endregion
#region TypeDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public TypeDefinitionHandle GetContainingTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetDeclaringType();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetTypeDefNameOrThrow(TypeDefinitionHandle typeDef)
{
TypeDefinition typeDefinition = MetadataReader.GetTypeDefinition(typeDef);
string name = MetadataReader.GetString(typeDefinition.Name);
Debug.Assert(name.Length == 0 || MetadataHelpers.IsValidMetadataIdentifier(name)); // Obfuscated assemblies can have types with empty names.
// The problem is that the mangled name for a static machine type looks like
// "<" + methodName + ">d__" + uniqueId.However, methodName will have dots in
// it for explicit interface implementations (e.g. "<I.F>d__0"). Unfortunately,
// the native compiler emits such names in a very strange way: everything before
// the last dot goes in the namespace (!!) field of the typedef.Since state
// machine types are always nested types and since nested types never have
// explicit namespaces (since they are in the same namespaces as their containing
// types), it should be safe to check for a non-empty namespace name on a nested
// type and prepend the namespace name and a dot to the type name. After that,
// debugging support falls out.
if (IsNestedTypeDefOrThrow(typeDef))
{
string namespaceName = MetadataReader.GetString(typeDefinition.Namespace);
if (namespaceName.Length > 0)
{
// As explained above, this is not really the qualified name - the namespace
// name is actually the part of the name that preceded the last dot (in bad
// metadata).
name = namespaceName + "." + name;
}
}
return name;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetTypeDefNamespaceOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetString(MetadataReader.GetTypeDefinition(typeDef).Namespace);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public EntityHandle GetTypeDefExtendsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).BaseType;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public TypeAttributes GetTypeDefFlagsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public GenericParameterHandleCollection GetTypeDefGenericParamsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetGenericParameters();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public bool HasGenericParametersOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetGenericParameters().Count > 0;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetTypeDefPropsOrThrow(
TypeDefinitionHandle typeDef,
out string name,
out string @namespace,
out TypeAttributes flags,
out EntityHandle extends)
{
TypeDefinition row = MetadataReader.GetTypeDefinition(typeDef);
name = MetadataReader.GetString(row.Name);
@namespace = MetadataReader.GetString(row.Namespace);
flags = row.Attributes;
extends = row.BaseType;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal bool IsNestedTypeDefOrThrow(TypeDefinitionHandle typeDef)
{
return IsNestedTypeDefOrThrow(MetadataReader, typeDef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static bool IsNestedTypeDefOrThrow(MetadataReader metadataReader, TypeDefinitionHandle typeDef)
{
return IsNested(metadataReader.GetTypeDefinition(typeDef).Attributes);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal bool IsInterfaceOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).Attributes.IsInterface();
}
private struct TypeDefToNamespace
{
internal readonly TypeDefinitionHandle TypeDef;
internal readonly NamespaceDefinitionHandle NamespaceHandle;
internal TypeDefToNamespace(TypeDefinitionHandle typeDef, NamespaceDefinitionHandle namespaceHandle)
{
TypeDef = typeDef;
NamespaceHandle = namespaceHandle;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private IEnumerable<TypeDefToNamespace> GetTypeDefsOrThrow(bool topLevelOnly)
{
foreach (var typeDef in MetadataReader.TypeDefinitions)
{
var row = MetadataReader.GetTypeDefinition(typeDef);
if (topLevelOnly && IsNested(row.Attributes))
{
continue;
}
yield return new TypeDefToNamespace(typeDef, row.NamespaceDefinition);
}
}
/// <summary>
/// The function groups types defined in the module by their fully-qualified namespace name.
/// The case-sensitivity of the grouping depends upon the provided StringComparer.
///
/// The sequence is sorted by name by using provided comparer. Therefore, if there are multiple
/// groups for a namespace name (e.g. because they differ in case), the groups are going to be
/// adjacent to each other.
///
/// Empty string is used as namespace name for types in the Global namespace. Therefore, all types
/// in the Global namespace, if any, should be in the first group (assuming a reasonable StringComparer).
/// </summary>
/// Comparer to sort the groups.
/// <param name="nameComparer">
/// </param>
/// <returns>A sorted list of TypeDef row ids, grouped by fully-qualified namespace name.</returns>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal IEnumerable<IGrouping<string, TypeDefinitionHandle>> GroupTypesByNamespaceOrThrow(StringComparer nameComparer)
{
// TODO: Consider if we should cache the result (not the IEnumerable, but the actual values).
// NOTE: Rather than use a sorted dictionary, we accumulate the groupings in a normal dictionary
// and then sort the list. We do this so that namespaces with distinct names are not
// merged, even if they are equal according to the provided comparer. This improves the error
// experience because types retain their exact namespaces.
Dictionary<string, ArrayBuilder<TypeDefinitionHandle>> namespaces = new Dictionary<string, ArrayBuilder<TypeDefinitionHandle>>();
GetTypeNamespaceNamesOrThrow(namespaces);
GetForwardedTypeNamespaceNamesOrThrow(namespaces);
var result = new ArrayBuilder<IGrouping<string, TypeDefinitionHandle>>(namespaces.Count);
foreach (var pair in namespaces)
{
result.Add(new Grouping<string, TypeDefinitionHandle>(pair.Key, pair.Value ?? SpecializedCollections.EmptyEnumerable<TypeDefinitionHandle>()));
}
result.Sort(new TypesByNamespaceSortComparer(nameComparer));
return result;
}
internal class TypesByNamespaceSortComparer : IComparer<IGrouping<string, TypeDefinitionHandle>>
{
private readonly StringComparer _nameComparer;
public TypesByNamespaceSortComparer(StringComparer nameComparer)
{
_nameComparer = nameComparer;
}
public int Compare(IGrouping<string, TypeDefinitionHandle> left, IGrouping<string, TypeDefinitionHandle> right)
{
if (left == right)
{
return 0;
}
int result = _nameComparer.Compare(left.Key, right.Key);
if (result == 0)
{
var fLeft = left.FirstOrDefault();
var fRight = right.FirstOrDefault();
if (fLeft.IsNil ^ fRight.IsNil)
{
result = fLeft.IsNil ? +1 : -1;
}
else
{
result = HandleComparer.Default.Compare(fLeft, fRight);
}
if (result == 0)
{
// This can only happen when both are for forwarded types.
Debug.Assert(left.IsEmpty() && right.IsEmpty());
result = string.CompareOrdinal(left.Key, right.Key);
}
}
Debug.Assert(result != 0);
return result;
}
}
/// <summary>
/// Groups together the RowIds of types in a given namespaces. The types considered are
/// those defined in this module.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private void GetTypeNamespaceNamesOrThrow(Dictionary<string, ArrayBuilder<TypeDefinitionHandle>> namespaces)
{
// PERF: Group by namespace handle so we only have to allocate one string for every namespace
var namespaceHandles = new Dictionary<NamespaceDefinitionHandle, ArrayBuilder<TypeDefinitionHandle>>(NamespaceHandleEqualityComparer.Singleton);
foreach (TypeDefToNamespace pair in GetTypeDefsOrThrow(topLevelOnly: true))
{
NamespaceDefinitionHandle nsHandle = pair.NamespaceHandle;
TypeDefinitionHandle typeDef = pair.TypeDef;
ArrayBuilder<TypeDefinitionHandle> builder;
if (namespaceHandles.TryGetValue(nsHandle, out builder))
{
builder.Add(typeDef);
}
else
{
namespaceHandles.Add(nsHandle, new ArrayBuilder<TypeDefinitionHandle> { typeDef });
}
}
foreach (var kvp in namespaceHandles)
{
string @namespace = MetadataReader.GetString(kvp.Key);
ArrayBuilder<TypeDefinitionHandle> builder;
if (namespaces.TryGetValue(@namespace, out builder))
{
builder.AddRange(kvp.Value);
}
else
{
namespaces.Add(@namespace, kvp.Value);
}
}
}
private class NamespaceHandleEqualityComparer : IEqualityComparer<NamespaceDefinitionHandle>
{
public static readonly NamespaceHandleEqualityComparer Singleton = new NamespaceHandleEqualityComparer();
private NamespaceHandleEqualityComparer()
{
}
public bool Equals(NamespaceDefinitionHandle x, NamespaceDefinitionHandle y)
{
return x == y;
}
public int GetHashCode(NamespaceDefinitionHandle obj)
{
return obj.GetHashCode();
}
}
/// <summary>
/// Supplements the namespace-to-RowIDs map with the namespaces of forwarded types.
/// These types will not have associated row IDs (represented as null, for efficiency).
/// These namespaces are important because we want lookups of missing forwarded types
/// to succeed far enough that we can actually find the type forwarder and provide
/// information about the target assembly.
///
/// For example, consider the following forwarded type:
///
/// .class extern forwarder Namespace.Type {}
///
/// If this type is referenced in source as "Namespace.Type", then dev10 reports
///
/// error CS1070: The type name 'Namespace.Name' could not be found. This type has been
/// forwarded to assembly 'pe2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
/// Consider adding a reference to that assembly.
///
/// If we did not include "Namespace" as a child of the global namespace of this module
/// (the forwarding module), then Roslyn would report that the type "Namespace" was not
/// found and say nothing about "Name" (because of the diagnostic already attached to
/// the qualifier).
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private void GetForwardedTypeNamespaceNamesOrThrow(Dictionary<string, ArrayBuilder<TypeDefinitionHandle>> namespaces)
{
EnsureForwardTypeToAssemblyMap();
foreach (var typeName in _lazyForwardedTypesToAssemblyIndexMap.Keys)
{
int index = typeName.LastIndexOf('.');
string namespaceName = index >= 0 ? typeName.Substring(0, index) : "";
if (!namespaces.ContainsKey(namespaceName))
{
namespaces.Add(namespaceName, null);
}
}
}
private IdentifierCollection ComputeTypeNameCollection()
{
try
{
var allTypeDefs = GetTypeDefsOrThrow(topLevelOnly: false);
var typeNames =
from typeDef in allTypeDefs
let metadataName = GetTypeDefNameOrThrow(typeDef.TypeDef)
let backtickIndex = metadataName.IndexOf('`')
select backtickIndex < 0 ? metadataName : metadataName.Substring(0, backtickIndex);
return new IdentifierCollection(typeNames);
}
catch (BadImageFormatException)
{
return new IdentifierCollection();
}
}
private IdentifierCollection ComputeNamespaceNameCollection()
{
try
{
var allTypeIds = GetTypeDefsOrThrow(topLevelOnly: true);
var fullNamespaceNames =
from id in allTypeIds
where !id.NamespaceHandle.IsNil
select MetadataReader.GetString(id.NamespaceHandle);
var namespaceNames =
from fullName in fullNamespaceNames.Distinct()
from name in fullName.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries)
select name;
return new IdentifierCollection(namespaceNames);
}
catch (BadImageFormatException)
{
return new IdentifierCollection();
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal ImmutableArray<TypeDefinitionHandle> GetNestedTypeDefsOrThrow(TypeDefinitionHandle container)
{
return MetadataReader.GetTypeDefinition(container).GetNestedTypes();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal MethodImplementationHandleCollection GetMethodImplementationsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetMethodImplementations();
}
/// <summary>
/// Returns a collection of interfaces implemented by given type.
/// </summary>
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal InterfaceImplementationHandleCollection GetInterfaceImplementationsOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetInterfaceImplementations();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal MethodDefinitionHandleCollection GetMethodsOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetMethods();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal PropertyDefinitionHandleCollection GetPropertiesOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetProperties();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EventDefinitionHandleCollection GetEventsOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetEvents();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal FieldDefinitionHandleCollection GetFieldsOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).GetFields();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EntityHandle GetBaseTypeOfTypeOrThrow(TypeDefinitionHandle typeDef)
{
return MetadataReader.GetTypeDefinition(typeDef).BaseType;
}
internal TypeLayout GetTypeLayout(TypeDefinitionHandle typeDef)
{
try
{
// CLI Spec 22.8.3:
// The Class or ValueType indexed by Parent shall be SequentialLayout or ExplicitLayout.
// That is, AutoLayout types shall not own any rows in the ClassLayout table.
var def = MetadataReader.GetTypeDefinition(typeDef);
LayoutKind kind;
switch (def.Attributes & TypeAttributes.LayoutMask)
{
case TypeAttributes.SequentialLayout:
kind = LayoutKind.Sequential;
break;
case TypeAttributes.ExplicitLayout:
kind = LayoutKind.Explicit;
break;
case TypeAttributes.AutoLayout:
return default(TypeLayout);
default:
// TODO (tomat) report error:
return default(TypeLayout);
}
var layout = def.GetLayout();
int size = layout.Size;
int packingSize = layout.PackingSize;
if (packingSize > byte.MaxValue)
{
// TODO (tomat) report error:
packingSize = 0;
}
if (size < 0)
{
// TODO (tomat) report error:
size = 0;
}
return new TypeLayout(kind, size, (byte)packingSize);
}
catch (BadImageFormatException)
{
return default(TypeLayout);
}
}
internal bool IsNoPiaLocalType(TypeDefinitionHandle typeDef)
{
AttributeInfo attributeInfo;
return IsNoPiaLocalType(typeDef, out attributeInfo);
}
internal bool HasParamsAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.ParamArrayAttribute).HasValue;
}
internal bool HasIsReadOnlyAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.IsReadOnlyAttribute).HasValue;
}
internal bool HasDoesNotReturnAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.DoesNotReturnAttribute).HasValue;
}
internal bool HasIsUnmanagedAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.IsUnmanagedAttribute).HasValue;
}
internal bool HasExtensionAttribute(EntityHandle token, bool ignoreCase)
{
return FindTargetAttribute(token, ignoreCase ? AttributeDescription.CaseInsensitiveExtensionAttribute : AttributeDescription.CaseSensitiveExtensionAttribute).HasValue;
}
internal bool HasVisualBasicEmbeddedAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.VisualBasicEmbeddedAttribute).HasValue;
}
internal bool HasCodeAnalysisEmbeddedAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.CodeAnalysisEmbeddedAttribute).HasValue;
}
internal bool HasInterpolatedStringHandlerAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.InterpolatedStringHandlerAttribute).HasValue;
}
internal bool HasDefaultMemberAttribute(EntityHandle token, out string memberName)
{
return HasStringValuedAttribute(token, AttributeDescription.DefaultMemberAttribute, out memberName);
}
internal bool HasGuidAttribute(EntityHandle token, out string guidValue)
{
return HasStringValuedAttribute(token, AttributeDescription.GuidAttribute, out guidValue);
}
internal bool HasFixedBufferAttribute(EntityHandle token, out string elementTypeName, out int bufferSize)
{
return HasStringAndIntValuedAttribute(token, AttributeDescription.FixedBufferAttribute, out elementTypeName, out bufferSize);
}
internal bool HasAccessedThroughPropertyAttribute(EntityHandle token, out string propertyName)
{
return HasStringValuedAttribute(token, AttributeDescription.AccessedThroughPropertyAttribute, out propertyName);
}
internal bool HasRequiredAttributeAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.RequiredAttributeAttribute).HasValue;
}
internal bool HasAttribute(EntityHandle token, AttributeDescription description)
{
return FindTargetAttribute(token, description).HasValue;
}
internal CustomAttributeHandle GetAttributeHandle(EntityHandle token, AttributeDescription description)
{
return FindTargetAttribute(token, description).Handle;
}
private static readonly ImmutableArray<bool> s_simpleTransformFlags = ImmutableArray.Create(true);
internal bool HasDynamicAttribute(EntityHandle token, out ImmutableArray<bool> transformFlags)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.DynamicAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
if (!info.HasValue)
{
transformFlags = default;
return false;
}
if (info.SignatureIndex == 0)
{
transformFlags = s_simpleTransformFlags;
return true;
}
return TryExtractBoolArrayValueFromAttribute(info.Handle, out transformFlags);
}
internal bool HasNativeIntegerAttribute(EntityHandle token, out ImmutableArray<bool> transformFlags)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NativeIntegerAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
if (!info.HasValue)
{
transformFlags = default;
return false;
}
if (info.SignatureIndex == 0)
{
transformFlags = s_simpleTransformFlags;
return true;
}
return TryExtractBoolArrayValueFromAttribute(info.Handle, out transformFlags);
}
internal bool HasTupleElementNamesAttribute(EntityHandle token, out ImmutableArray<string> tupleElementNames)
{
var info = FindTargetAttribute(token, AttributeDescription.TupleElementNamesAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
if (!info.HasValue)
{
tupleElementNames = default(ImmutableArray<string>);
return false;
}
return TryExtractStringArrayValueFromAttribute(info.Handle, out tupleElementNames);
}
internal bool HasIsByRefLikeAttribute(EntityHandle token)
{
return FindTargetAttribute(token, AttributeDescription.IsByRefLikeAttribute).HasValue;
}
internal const string ByRefLikeMarker = "Types with embedded references are not supported in this version of your compiler.";
internal ObsoleteAttributeData TryGetDeprecatedOrExperimentalOrObsoleteAttribute(
EntityHandle token,
IAttributeNamedArgumentDecoder decoder,
bool ignoreByRefLikeMarker)
{
AttributeInfo info;
info = FindTargetAttribute(token, AttributeDescription.DeprecatedAttribute);
if (info.HasValue)
{
return TryExtractDeprecatedDataFromAttribute(info);
}
info = FindTargetAttribute(token, AttributeDescription.ObsoleteAttribute);
if (info.HasValue)
{
ObsoleteAttributeData obsoleteData = TryExtractObsoleteDataFromAttribute(info, decoder);
switch (obsoleteData?.Message)
{
case ByRefLikeMarker when ignoreByRefLikeMarker:
return null;
}
return obsoleteData;
}
// [Experimental] is always a warning, not an
// error, so search for [Experimental] last.
info = FindTargetAttribute(token, AttributeDescription.ExperimentalAttribute);
if (info.HasValue)
{
return TryExtractExperimentalDataFromAttribute(info);
}
return null;
}
#nullable enable
internal UnmanagedCallersOnlyAttributeData? TryGetUnmanagedCallersOnlyAttribute(
EntityHandle token,
IAttributeNamedArgumentDecoder attributeArgumentDecoder,
Func<string, TypedConstant, bool, (bool IsCallConvs, ImmutableHashSet<INamedTypeSymbolInternal>? CallConvs)> unmanagedCallersOnlyDecoder)
{
// We don't want to load all attributes and their public data just to answer whether a PEMethodSymbol has an UnmanagedCallersOnly
// attached. It would create unnecessary memory pressure that isn't going to be needed 99% of the time, so we just crack this 1
// attribute.
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.UnmanagedCallersOnlyAttribute);
if (!info.HasValue || info.SignatureIndex != 0 || !TryGetAttributeReader(info.Handle, out BlobReader sigReader))
{
return null;
}
var unmanagedConventionTypes = ImmutableHashSet<INamedTypeSymbolInternal>.Empty;
if (sigReader.RemainingBytes > 0)
{
try
{
var numNamed = sigReader.ReadUInt16();
for (int i = 0; i < numNamed; i++)
{
var ((name, value), isProperty, typeCode, elementTypeCode) = attributeArgumentDecoder.DecodeCustomAttributeNamedArgumentOrThrow(ref sigReader);
if (typeCode != SerializationTypeCode.SZArray || elementTypeCode != SerializationTypeCode.Type)
{
continue;
}
var namedArgumentDecoded = unmanagedCallersOnlyDecoder(name, value, !isProperty);
if (namedArgumentDecoded.IsCallConvs)
{
unmanagedConventionTypes = namedArgumentDecoded.CallConvs;
break;
}
}
}
catch (Exception ex) when (ex is BadImageFormatException or UnsupportedSignatureContent)
{
}
}
return UnmanagedCallersOnlyAttributeData.Create(unmanagedConventionTypes);
}
internal (ImmutableArray<string?> Names, bool FoundAttribute) GetInterpolatedStringHandlerArgumentAttributeValues(EntityHandle token)
{
var targetAttribute = FindTargetAttribute(token, AttributeDescription.InterpolatedStringHandlerArgumentAttribute);
if (!targetAttribute.HasValue)
{
return (default, false);
}
Debug.Assert(AttributeDescription.InterpolatedStringHandlerArgumentAttribute.Signatures.Length == 2);
Debug.Assert(targetAttribute.SignatureIndex is 0 or 1);
if (targetAttribute.SignatureIndex == 0)
{
if (TryExtractStringValueFromAttribute(targetAttribute.Handle, out string? paramName))
{
return (ImmutableArray.Create(paramName), true);
}
}
else if (TryExtractStringArrayValueFromAttribute(targetAttribute.Handle, out var paramNames))
{
return (paramNames.NullToEmpty(), true);
}
return (default, true);
}
#nullable disable
internal bool HasMaybeNullWhenOrNotNullWhenOrDoesNotReturnIfAttribute(EntityHandle token, AttributeDescription description, out bool when)
{
Debug.Assert(description.Namespace == "System.Diagnostics.CodeAnalysis");
Debug.Assert(description.Name == "MaybeNullWhenAttribute" || description.Name == "NotNullWhenAttribute" || description.Name == "DoesNotReturnIfAttribute");
AttributeInfo info = FindTargetAttribute(token, description);
if (info.HasValue &&
// MaybeNullWhen(bool), NotNullWhen(bool), DoesNotReturnIf(bool)
info.SignatureIndex == 0)
{
return TryExtractValueFromAttribute(info.Handle, out when, s_attributeBooleanValueExtractor);
}
when = false;
return false;
}
internal ImmutableHashSet<string> GetStringValuesOfNotNullIfNotNullAttribute(EntityHandle token)
{
var attributeInfos = FindTargetAttributes(token, AttributeDescription.NotNullIfNotNullAttribute);
var result = ImmutableHashSet<string>.Empty;
if (attributeInfos is null)
{
return result;
}
foreach (var attributeInfo in attributeInfos)
{
if (TryExtractStringValueFromAttribute(attributeInfo.Handle, out string parameterName))
{
result = result.Add(parameterName);
}
}
return result;
}
internal CustomAttributeHandle GetAttributeUsageAttributeHandle(EntityHandle token)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.AttributeUsageAttribute);
Debug.Assert(info.SignatureIndex == 0);
return info.Handle;
}
internal bool HasInterfaceTypeAttribute(EntityHandle token, out ComInterfaceType interfaceType)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.InterfaceTypeAttribute);
if (info.HasValue && TryExtractInterfaceTypeFromAttribute(info, out interfaceType))
{
return true;
}
interfaceType = default(ComInterfaceType);
return false;
}
internal bool HasTypeLibTypeAttribute(EntityHandle token, out Cci.TypeLibTypeFlags flags)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.TypeLibTypeAttribute);
if (info.HasValue && TryExtractTypeLibTypeFromAttribute(info, out flags))
{
return true;
}
flags = default(Cci.TypeLibTypeFlags);
return false;
}
internal bool HasDateTimeConstantAttribute(EntityHandle token, out ConstantValue defaultValue)
{
long value;
AttributeInfo info = FindLastTargetAttribute(token, AttributeDescription.DateTimeConstantAttribute);
if (info.HasValue && TryExtractLongValueFromAttribute(info.Handle, out value))
{
// if value is outside this range, DateTime would throw when constructed
if (value < DateTime.MinValue.Ticks || value > DateTime.MaxValue.Ticks)
{
defaultValue = ConstantValue.Bad;
}
else
{
defaultValue = ConstantValue.Create(new DateTime(value));
}
return true;
}
defaultValue = null;
return false;
}
internal bool HasDecimalConstantAttribute(EntityHandle token, out ConstantValue defaultValue)
{
decimal value;
AttributeInfo info = FindLastTargetAttribute(token, AttributeDescription.DecimalConstantAttribute);
if (info.HasValue && TryExtractDecimalValueFromDecimalConstantAttribute(info.Handle, out value))
{
defaultValue = ConstantValue.Create(value);
return true;
}
defaultValue = null;
return false;
}
internal bool HasNullablePublicOnlyAttribute(EntityHandle token, out bool includesInternals)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NullablePublicOnlyAttribute);
if (info.HasValue)
{
Debug.Assert(info.SignatureIndex == 0);
if (TryExtractValueFromAttribute(info.Handle, out bool value, s_attributeBooleanValueExtractor))
{
includesInternals = value;
return true;
}
}
includesInternals = false;
return false;
}
internal ImmutableArray<string> GetInternalsVisibleToAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.InternalsVisibleToAttribute);
ArrayBuilder<string> result = ExtractStringValuesFromAttributes(attrInfos);
return result?.ToImmutableAndFree() ?? ImmutableArray<string>.Empty;
}
internal ImmutableArray<string> GetConditionalAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.ConditionalAttribute);
ArrayBuilder<string> result = ExtractStringValuesFromAttributes(attrInfos);
return result?.ToImmutableAndFree() ?? ImmutableArray<string>.Empty;
}
/// <summary>
/// Find the MemberNotNull attribute(s) and extract the list of referenced member names
/// </summary>
internal ImmutableArray<string> GetMemberNotNullAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.MemberNotNullAttribute);
if (attrInfos is null || attrInfos.Count == 0)
{
return ImmutableArray<string>.Empty;
}
var result = ArrayBuilder<string>.GetInstance(attrInfos.Count);
foreach (var ai in attrInfos)
{
if (ai.SignatureIndex == 0)
{
if (TryExtractStringValueFromAttribute(ai.Handle, out string extracted))
{
if (extracted is object)
{
result.Add(extracted);
}
}
}
else if (TryExtractStringArrayValueFromAttribute(ai.Handle, out ImmutableArray<string> extracted2))
{
foreach (var value in extracted2)
{
if (value is object)
{
result.Add(value);
}
}
}
}
return result.ToImmutableAndFree();
}
/// <summary>
/// Find the MemberNotNullWhen attribute(s) and extract the list of referenced member names
/// </summary>
internal (ImmutableArray<string> whenTrue, ImmutableArray<string> whenFalse) GetMemberNotNullWhenAttributeValues(EntityHandle token)
{
List<AttributeInfo> attrInfos = FindTargetAttributes(token, AttributeDescription.MemberNotNullWhenAttribute);
if (attrInfos is null || attrInfos.Count == 0)
{
return (ImmutableArray<string>.Empty, ImmutableArray<string>.Empty);
}
var whenTrue = ArrayBuilder<string>.GetInstance(attrInfos.Count);
var whenFalse = ArrayBuilder<string>.GetInstance(attrInfos.Count);
foreach (var ai in attrInfos)
{
if (ai.SignatureIndex == 0)
{
if (TryExtractValueFromAttribute(ai.Handle, out BoolAndStringData extracted, s_attributeBoolAndStringValueExtractor))
{
if (extracted.String is object)
{
var whenResult = extracted.Sense ? whenTrue : whenFalse;
whenResult.Add(extracted.String);
}
}
}
else if (TryExtractValueFromAttribute(ai.Handle, out BoolAndStringArrayData extracted2, s_attributeBoolAndStringArrayValueExtractor))
{
var whenResult = extracted2.Sense ? whenTrue : whenFalse;
foreach (var value in extracted2.Strings)
{
if (value is object)
{
whenResult.Add(value);
}
}
}
}
return (whenTrue.ToImmutableAndFree(), whenFalse.ToImmutableAndFree());
}
// This method extracts all the non-null string values from the given attributes.
private ArrayBuilder<string> ExtractStringValuesFromAttributes(List<AttributeInfo> attrInfos)
{
if (attrInfos == null)
{
return null;
}
var result = ArrayBuilder<string>.GetInstance(attrInfos.Count);
foreach (var ai in attrInfos)
{
string extractedStr;
if (TryExtractStringValueFromAttribute(ai.Handle, out extractedStr) && extractedStr != null)
{
result.Add(extractedStr);
}
}
return result;
}
#nullable enable
private ObsoleteAttributeData? TryExtractObsoleteDataFromAttribute(AttributeInfo attributeInfo, IAttributeNamedArgumentDecoder decoder)
{
Debug.Assert(attributeInfo.HasValue);
if (!TryGetAttributeReader(attributeInfo.Handle, out var sig))
{
return null;
}
string? message = null;
bool isError = false;
switch (attributeInfo.SignatureIndex)
{
case 0:
// ObsoleteAttribute()
break;
case 1:
// ObsoleteAttribute(string)
if (sig.RemainingBytes > 0 && CrackStringInAttributeValue(out message, ref sig))
{
break;
}
return null;
case 2:
// ObsoleteAttribute(string, bool)
if (sig.RemainingBytes > 0 && CrackStringInAttributeValue(out message, ref sig) &&
sig.RemainingBytes > 0 && CrackBooleanInAttributeValue(out isError, ref sig))
{
break;
}
return null;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
(string? diagnosticId, string? urlFormat) = sig.RemainingBytes > 0 ? CrackObsoleteProperties(ref sig, decoder) : default;
return new ObsoleteAttributeData(ObsoleteAttributeKind.Obsolete, message, isError, diagnosticId, urlFormat);
}
private bool TryGetAttributeReader(CustomAttributeHandle handle, out BlobReader blobReader)
{
Debug.Assert(!handle.IsNil);
try
{
var valueBlob = GetCustomAttributeValueOrThrow(handle);
if (!valueBlob.IsNil)
{
blobReader = MetadataReader.GetBlobReader(valueBlob);
if (blobReader.Length >= 4)
{
// check prolog
if (blobReader.ReadInt16() == 1)
{
return true;
}
}
}
}
catch (BadImageFormatException)
{ }
blobReader = default;
return false;
}
#nullable disable
private ObsoleteAttributeData TryExtractDeprecatedDataFromAttribute(AttributeInfo attributeInfo)
{
Debug.Assert(attributeInfo.HasValue);
switch (attributeInfo.SignatureIndex)
{
case 0: // DeprecatedAttribute(String, DeprecationType, UInt32)
case 1: // DeprecatedAttribute(String, DeprecationType, UInt32, Platform)
case 2: // DeprecatedAttribute(String, DeprecationType, UInt32, Type)
case 3: // DeprecatedAttribute(String, DeprecationType, UInt32, String)
return TryExtractValueFromAttribute(attributeInfo.Handle, out var obsoleteData, s_attributeDeprecatedDataExtractor) ?
obsoleteData :
null;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
}
private ObsoleteAttributeData TryExtractExperimentalDataFromAttribute(AttributeInfo attributeInfo)
{
Debug.Assert(attributeInfo.HasValue);
switch (attributeInfo.SignatureIndex)
{
case 0: // ExperimentalAttribute()
return ObsoleteAttributeData.Experimental;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
}
private bool TryExtractInterfaceTypeFromAttribute(AttributeInfo attributeInfo, out ComInterfaceType interfaceType)
{
Debug.Assert(attributeInfo.HasValue);
switch (attributeInfo.SignatureIndex)
{
case 0:
// InterfaceTypeAttribute(Int16)
short shortValue;
if (TryExtractValueFromAttribute(attributeInfo.Handle, out shortValue, s_attributeShortValueExtractor) &&
IsValidComInterfaceType(shortValue))
{
interfaceType = (ComInterfaceType)shortValue;
return true;
}
break;
case 1:
// InterfaceTypeAttribute(ComInterfaceType)
int intValue;
if (TryExtractValueFromAttribute(attributeInfo.Handle, out intValue, s_attributeIntValueExtractor) &&
IsValidComInterfaceType(intValue))
{
interfaceType = (ComInterfaceType)intValue;
return true;
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
}
interfaceType = default(ComInterfaceType);
return false;
}
private static bool IsValidComInterfaceType(int comInterfaceType)
{
switch (comInterfaceType)
{
case (int)Cci.Constants.ComInterfaceType_InterfaceIsDual:
case (int)Cci.Constants.ComInterfaceType_InterfaceIsIDispatch:
case (int)ComInterfaceType.InterfaceIsIInspectable:
case (int)ComInterfaceType.InterfaceIsIUnknown:
return true;
default:
return false;
}
}
private bool TryExtractTypeLibTypeFromAttribute(AttributeInfo info, out Cci.TypeLibTypeFlags flags)
{
Debug.Assert(info.HasValue);
switch (info.SignatureIndex)
{
case 0:
// TypeLibTypeAttribute(Int16)
short shortValue;
if (TryExtractValueFromAttribute(info.Handle, out shortValue, s_attributeShortValueExtractor))
{
flags = (Cci.TypeLibTypeFlags)shortValue;
return true;
}
break;
case 1:
// TypeLibTypeAttribute(TypeLibTypeFlags)
int intValue;
if (TryExtractValueFromAttribute(info.Handle, out intValue, s_attributeIntValueExtractor))
{
flags = (Cci.TypeLibTypeFlags)intValue;
return true;
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(info.SignatureIndex);
}
flags = default(Cci.TypeLibTypeFlags);
return false;
}
#nullable enable
internal bool TryExtractStringValueFromAttribute(CustomAttributeHandle handle, out string? value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeStringValueExtractor);
}
internal bool TryExtractLongValueFromAttribute(CustomAttributeHandle handle, out long value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeLongValueExtractor);
}
// Note: not a general purpose helper
private bool TryExtractDecimalValueFromDecimalConstantAttribute(CustomAttributeHandle handle, out decimal value)
{
return TryExtractValueFromAttribute(handle, out value, s_decimalValueInDecimalConstantAttributeExtractor);
}
private struct StringAndInt
{
public string? StringValue;
public int IntValue;
}
private bool TryExtractStringAndIntValueFromAttribute(CustomAttributeHandle handle, out string? stringValue, out int intValue)
{
StringAndInt data;
var result = TryExtractValueFromAttribute(handle, out data, s_attributeStringAndIntValueExtractor);
stringValue = data.StringValue;
intValue = data.IntValue;
return result;
}
private bool TryExtractBoolArrayValueFromAttribute(CustomAttributeHandle handle, out ImmutableArray<bool> value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeBoolArrayValueExtractor);
}
private bool TryExtractByteArrayValueFromAttribute(CustomAttributeHandle handle, out ImmutableArray<byte> value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeByteArrayValueExtractor);
}
private bool TryExtractStringArrayValueFromAttribute(CustomAttributeHandle handle, out ImmutableArray<string?> value)
{
return TryExtractValueFromAttribute(handle, out value, s_attributeStringArrayValueExtractor);
}
private bool TryExtractValueFromAttribute<T>(CustomAttributeHandle handle, out T? value, AttributeValueExtractor<T?> valueExtractor)
{
Debug.Assert(!handle.IsNil);
// extract the value
try
{
BlobHandle valueBlob = GetCustomAttributeValueOrThrow(handle);
if (!valueBlob.IsNil)
{
// TODO: error checking offset in range
BlobReader reader = MetadataReader.GetBlobReader(valueBlob);
if (reader.Length > 4)
{
// check prolog
if (reader.ReadByte() == 1 && reader.ReadByte() == 0)
{
return valueExtractor(out value, ref reader);
}
}
}
}
catch (BadImageFormatException)
{ }
value = default(T);
return false;
}
#nullable disable
internal bool HasStringValuedAttribute(EntityHandle token, AttributeDescription description, out string value)
{
AttributeInfo info = FindTargetAttribute(token, description);
if (info.HasValue)
{
return TryExtractStringValueFromAttribute(info.Handle, out value);
}
value = null;
return false;
}
private bool HasStringAndIntValuedAttribute(EntityHandle token, AttributeDescription description, out string stringValue, out int intValue)
{
AttributeInfo info = FindTargetAttribute(token, description);
if (info.HasValue)
{
return TryExtractStringAndIntValueFromAttribute(info.Handle, out stringValue, out intValue);
}
stringValue = null;
intValue = 0;
return false;
}
internal bool IsNoPiaLocalType(
TypeDefinitionHandle typeDef,
out string interfaceGuid,
out string scope,
out string identifier)
{
AttributeInfo typeIdentifierInfo;
if (!IsNoPiaLocalType(typeDef, out typeIdentifierInfo))
{
interfaceGuid = null;
scope = null;
identifier = null;
return false;
}
interfaceGuid = null;
scope = null;
identifier = null;
try
{
if (GetTypeDefFlagsOrThrow(typeDef).IsInterface())
{
HasGuidAttribute(typeDef, out interfaceGuid);
}
if (typeIdentifierInfo.SignatureIndex == 1)
{
// extract the value
BlobHandle valueBlob = GetCustomAttributeValueOrThrow(typeIdentifierInfo.Handle);
if (!valueBlob.IsNil)
{
BlobReader reader = MetadataReader.GetBlobReader(valueBlob);
if (reader.Length > 4)
{
// check prolog
if (reader.ReadInt16() == 1)
{
if (!CrackStringInAttributeValue(out scope, ref reader) ||
!CrackStringInAttributeValue(out identifier, ref reader))
{
return false;
}
}
}
}
}
return true;
}
catch (BadImageFormatException)
{
return false;
}
}
#nullable enable
/// <summary>
/// Gets the well-known optional named properties on ObsoleteAttribute, if present.
/// Both 'diagnosticId' and 'urlFormat' may be present, or only one, or neither.
/// </summary>
/// <remarks>
/// Failure to find any of these properties does not imply failure to decode the ObsoleteAttribute,
/// so we don't return a value indicating success or failure.
/// </remarks>
private static (string? diagnosticId, string? urlFormat) CrackObsoleteProperties(ref BlobReader sig, IAttributeNamedArgumentDecoder decoder)
{
string? diagnosticId = null;
string? urlFormat = null;
try
{
// See CIL spec section II.23.3 Custom attributes
//
// Next is a description of the optional “named” fields and properties.
// This starts with NumNamed– an unsigned int16 giving the number of “named” properties or fields that follow.
var numNamed = sig.ReadUInt16();
for (int i = 0; i < numNamed && (diagnosticId is null || urlFormat is null); i++)
{
var ((name, value), isProperty, typeCode, /* elementTypeCode */ _) = decoder.DecodeCustomAttributeNamedArgumentOrThrow(ref sig);
if (typeCode == SerializationTypeCode.String && isProperty && value.ValueInternal is string stringValue)
{
if (diagnosticId is null && name == ObsoleteAttributeData.DiagnosticIdPropertyName)
{
diagnosticId = stringValue;
}
else if (urlFormat is null && name == ObsoleteAttributeData.UrlFormatPropertyName)
{
urlFormat = stringValue;
}
}
}
}
catch (BadImageFormatException) { }
catch (UnsupportedSignatureContent) { }
return (diagnosticId, urlFormat);
}
private static bool CrackDeprecatedAttributeData([NotNullWhen(true)] out ObsoleteAttributeData? value, ref BlobReader sig)
{
StringAndInt args;
if (CrackStringAndIntInAttributeValue(out args, ref sig))
{
value = new ObsoleteAttributeData(ObsoleteAttributeKind.Deprecated, args.StringValue, args.IntValue == 1, diagnosticId: null, urlFormat: null);
return true;
}
value = null;
return false;
}
private static bool CrackStringAndIntInAttributeValue(out StringAndInt value, ref BlobReader sig)
{
value = default(StringAndInt);
return
CrackStringInAttributeValue(out value.StringValue, ref sig) &&
CrackIntInAttributeValue(out value.IntValue, ref sig);
}
internal static bool CrackStringInAttributeValue(out string? value, ref BlobReader sig)
{
try
{
int strLen;
if (sig.TryReadCompressedInteger(out strLen) && sig.RemainingBytes >= strLen)
{
value = sig.ReadUTF8(strLen);
// Trim null characters at the end to mimic native compiler behavior.
// There are libraries that have them and leaving them in breaks tests.
value = value.TrimEnd('\0');
return true;
}
value = null;
// Strings are stored as UTF8, but 0xFF means NULL string.
return sig.RemainingBytes >= 1 && sig.ReadByte() == 0xFF;
}
catch (BadImageFormatException)
{
value = null;
return false;
}
}
internal static bool CrackStringArrayInAttributeValue(out ImmutableArray<string?> value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
uint arrayLen = sig.ReadUInt32();
var stringArray = new string?[arrayLen];
for (int i = 0; i < arrayLen; i++)
{
if (!CrackStringInAttributeValue(out stringArray[i], ref sig))
{
value = stringArray.AsImmutableOrNull();
return false;
}
}
value = stringArray.AsImmutableOrNull();
return true;
}
value = default;
return false;
}
internal static bool CrackBoolAndStringArrayInAttributeValue(out BoolAndStringArrayData value, ref BlobReader sig)
{
if (CrackBooleanInAttributeValue(out bool sense, ref sig) &&
CrackStringArrayInAttributeValue(out ImmutableArray<string?> strings, ref sig))
{
value = new BoolAndStringArrayData(sense, strings);
return true;
}
value = default;
return false;
}
internal static bool CrackBoolAndStringInAttributeValue(out BoolAndStringData value, ref BlobReader sig)
{
if (CrackBooleanInAttributeValue(out bool sense, ref sig) &&
CrackStringInAttributeValue(out string? @string, ref sig))
{
value = new BoolAndStringData(sense, @string);
return true;
}
value = default;
return false;
}
internal static bool CrackBooleanInAttributeValue(out bool value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 1)
{
value = sig.ReadBoolean();
return true;
}
value = false;
return false;
}
internal static bool CrackByteInAttributeValue(out byte value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 1)
{
value = sig.ReadByte();
return true;
}
value = 0xff;
return false;
}
internal static bool CrackShortInAttributeValue(out short value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 2)
{
value = sig.ReadInt16();
return true;
}
value = -1;
return false;
}
internal static bool CrackIntInAttributeValue(out int value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
value = sig.ReadInt32();
return true;
}
value = -1;
return false;
}
internal static bool CrackLongInAttributeValue(out long value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 8)
{
value = sig.ReadInt64();
return true;
}
value = -1;
return false;
}
// Note: not a general purpose helper
private static bool CrackDecimalInDecimalConstantAttribute(out decimal value, ref BlobReader sig)
{
byte scale;
byte sign;
int high;
int mid;
int low;
if (CrackByteInAttributeValue(out scale, ref sig) &&
CrackByteInAttributeValue(out sign, ref sig) &&
CrackIntInAttributeValue(out high, ref sig) &&
CrackIntInAttributeValue(out mid, ref sig) &&
CrackIntInAttributeValue(out low, ref sig))
{
value = new decimal(low, mid, high, sign != 0, scale);
return true;
}
value = -1;
return false;
}
internal static bool CrackBoolArrayInAttributeValue(out ImmutableArray<bool> value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
uint arrayLen = sig.ReadUInt32();
if (sig.RemainingBytes >= arrayLen)
{
var boolArrayBuilder = ArrayBuilder<bool>.GetInstance((int)arrayLen);
for (int i = 0; i < arrayLen; i++)
{
boolArrayBuilder.Add(sig.ReadByte() == 1);
}
value = boolArrayBuilder.ToImmutableAndFree();
return true;
}
}
value = default(ImmutableArray<bool>);
return false;
}
internal static bool CrackByteArrayInAttributeValue(out ImmutableArray<byte> value, ref BlobReader sig)
{
if (sig.RemainingBytes >= 4)
{
uint arrayLen = sig.ReadUInt32();
if (sig.RemainingBytes >= arrayLen)
{
var byteArrayBuilder = ArrayBuilder<byte>.GetInstance((int)arrayLen);
for (int i = 0; i < arrayLen; i++)
{
byteArrayBuilder.Add(sig.ReadByte());
}
value = byteArrayBuilder.ToImmutableAndFree();
return true;
}
}
value = default(ImmutableArray<byte>);
return false;
}
#nullable disable
internal struct AttributeInfo
{
public readonly CustomAttributeHandle Handle;
public readonly byte SignatureIndex;
public AttributeInfo(CustomAttributeHandle handle, int signatureIndex)
{
Debug.Assert(signatureIndex >= 0 && signatureIndex <= byte.MaxValue);
this.Handle = handle;
this.SignatureIndex = (byte)signatureIndex;
}
public bool HasValue
{
get { return !Handle.IsNil; }
}
}
internal List<AttributeInfo> FindTargetAttributes(EntityHandle hasAttribute, AttributeDescription description)
{
List<AttributeInfo> result = null;
try
{
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(hasAttribute))
{
int signatureIndex = GetTargetAttributeSignatureIndex(attributeHandle, description);
if (signatureIndex != -1)
{
if (result == null)
{
result = new List<AttributeInfo>();
}
// We found a match
result.Add(new AttributeInfo(attributeHandle, signatureIndex));
}
}
}
catch (BadImageFormatException)
{ }
return result;
}
internal AttributeInfo FindTargetAttribute(EntityHandle hasAttribute, AttributeDescription description)
{
return FindTargetAttribute(MetadataReader, hasAttribute, description);
}
internal static AttributeInfo FindTargetAttribute(MetadataReader metadataReader, EntityHandle hasAttribute, AttributeDescription description)
{
try
{
foreach (var attributeHandle in metadataReader.GetCustomAttributes(hasAttribute))
{
int signatureIndex = GetTargetAttributeSignatureIndex(metadataReader, attributeHandle, description);
if (signatureIndex != -1)
{
// We found a match
return new AttributeInfo(attributeHandle, signatureIndex);
}
}
}
catch (BadImageFormatException)
{ }
return default(AttributeInfo);
}
internal AttributeInfo FindLastTargetAttribute(EntityHandle hasAttribute, AttributeDescription description)
{
try
{
AttributeInfo attrInfo = default(AttributeInfo);
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(hasAttribute))
{
int signatureIndex = GetTargetAttributeSignatureIndex(attributeHandle, description);
if (signatureIndex != -1)
{
// We found a match
attrInfo = new AttributeInfo(attributeHandle, signatureIndex);
}
}
return attrInfo;
}
catch (BadImageFormatException)
{ }
return default(AttributeInfo);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal int GetParamArrayCountOrThrow(EntityHandle hasAttribute)
{
int count = 0;
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(hasAttribute))
{
if (GetTargetAttributeSignatureIndex(attributeHandle,
AttributeDescription.ParamArrayAttribute) != -1)
{
count++;
}
}
return count;
}
private bool IsNoPiaLocalType(TypeDefinitionHandle typeDef, out AttributeInfo attributeInfo)
{
if (_lazyContainsNoPiaLocalTypes == ThreeState.False)
{
attributeInfo = default(AttributeInfo);
return false;
}
if (_lazyNoPiaLocalTypeCheckBitMap != null &&
_lazyTypeDefToTypeIdentifierMap != null)
{
int rid = MetadataReader.GetRowNumber(typeDef);
Debug.Assert(rid > 0);
int item = rid / 32;
int bit = 1 << (rid % 32);
if ((_lazyNoPiaLocalTypeCheckBitMap[item] & bit) != 0)
{
return _lazyTypeDefToTypeIdentifierMap.TryGetValue(typeDef, out attributeInfo);
}
}
try
{
foreach (var attributeHandle in MetadataReader.GetCustomAttributes(typeDef))
{
int signatureIndex = IsTypeIdentifierAttribute(attributeHandle);
if (signatureIndex != -1)
{
// We found a match
_lazyContainsNoPiaLocalTypes = ThreeState.True;
RegisterNoPiaLocalType(typeDef, attributeHandle, signatureIndex);
attributeInfo = new AttributeInfo(attributeHandle, signatureIndex);
return true;
}
}
}
catch (BadImageFormatException)
{ }
RecordNoPiaLocalTypeCheck(typeDef);
attributeInfo = default(AttributeInfo);
return false;
}
private void RegisterNoPiaLocalType(TypeDefinitionHandle typeDef, CustomAttributeHandle customAttribute, int signatureIndex)
{
if (_lazyNoPiaLocalTypeCheckBitMap == null)
{
Interlocked.CompareExchange(
ref _lazyNoPiaLocalTypeCheckBitMap,
new int[(MetadataReader.TypeDefinitions.Count + 32) / 32],
null);
}
if (_lazyTypeDefToTypeIdentifierMap == null)
{
Interlocked.CompareExchange(
ref _lazyTypeDefToTypeIdentifierMap,
new ConcurrentDictionary<TypeDefinitionHandle, AttributeInfo>(),
null);
}
_lazyTypeDefToTypeIdentifierMap.TryAdd(typeDef, new AttributeInfo(customAttribute, signatureIndex));
RecordNoPiaLocalTypeCheck(typeDef);
}
private void RecordNoPiaLocalTypeCheck(TypeDefinitionHandle typeDef)
{
if (_lazyNoPiaLocalTypeCheckBitMap == null)
{
return;
}
int rid = MetadataTokens.GetRowNumber(typeDef);
Debug.Assert(rid > 0);
int item = rid / 32;
int bit = 1 << (rid % 32);
int oldValue;
do
{
oldValue = _lazyNoPiaLocalTypeCheckBitMap[item];
}
while (Interlocked.CompareExchange(
ref _lazyNoPiaLocalTypeCheckBitMap[item],
oldValue | bit,
oldValue) != oldValue);
}
/// <summary>
/// Determine if custom attribute application is
/// NoPia TypeIdentifier.
/// </summary>
/// <returns>
/// An index of the target constructor signature in
/// signaturesOfTypeIdentifierAttribute array, -1 if
/// this is not NoPia TypeIdentifier.
/// </returns>
private int IsTypeIdentifierAttribute(CustomAttributeHandle customAttribute)
{
const int No = -1;
try
{
if (MetadataReader.GetCustomAttribute(customAttribute).Parent.Kind != HandleKind.TypeDefinition)
{
// Ignore attributes attached to anything, but type definitions.
return No;
}
return GetTargetAttributeSignatureIndex(customAttribute, AttributeDescription.TypeIdentifierAttribute);
}
catch (BadImageFormatException)
{
return No;
}
}
/// <summary>
/// Determines if a custom attribute matches a namespace and name.
/// </summary>
/// <param name="customAttribute">Handle of the custom attribute.</param>
/// <param name="namespaceName">The custom attribute's namespace in metadata format (case sensitive)</param>
/// <param name="typeName">The custom attribute's type name in metadata format (case sensitive)</param>
/// <param name="ctor">Constructor of the custom attribute.</param>
/// <param name="ignoreCase">Should case be ignored for name comparison?</param>
/// <returns>true if match is found</returns>
internal bool IsTargetAttribute(
CustomAttributeHandle customAttribute,
string namespaceName,
string typeName,
out EntityHandle ctor,
bool ignoreCase = false)
{
return IsTargetAttribute(MetadataReader, customAttribute, namespaceName, typeName, out ctor, ignoreCase);
}
/// <summary>
/// Determines if a custom attribute matches a namespace and name.
/// </summary>
/// <param name="metadataReader">The metadata reader.</param>
/// <param name="customAttribute">Handle of the custom attribute.</param>
/// <param name="namespaceName">The custom attribute's namespace in metadata format (case sensitive)</param>
/// <param name="typeName">The custom attribute's type name in metadata format (case sensitive)</param>
/// <param name="ctor">Constructor of the custom attribute.</param>
/// <param name="ignoreCase">Should case be ignored for name comparison?</param>
/// <returns>true if match is found</returns>
private static bool IsTargetAttribute(
MetadataReader metadataReader,
CustomAttributeHandle customAttribute,
string namespaceName,
string typeName,
out EntityHandle ctor,
bool ignoreCase)
{
Debug.Assert(namespaceName != null);
Debug.Assert(typeName != null);
EntityHandle ctorType;
StringHandle ctorTypeNamespace;
StringHandle ctorTypeName;
if (!GetTypeAndConstructor(metadataReader, customAttribute, out ctorType, out ctor))
{
return false;
}
if (!GetAttributeNamespaceAndName(metadataReader, ctorType, out ctorTypeNamespace, out ctorTypeName))
{
return false;
}
try
{
return StringEquals(metadataReader, ctorTypeName, typeName, ignoreCase)
&& StringEquals(metadataReader, ctorTypeNamespace, namespaceName, ignoreCase);
}
catch (BadImageFormatException)
{
return false;
}
}
/// <summary>
/// Returns MetadataToken for assembly ref matching name
/// </summary>
/// <param name="assemblyName">The assembly name in metadata format (case sensitive)</param>
/// <returns>Matching assembly ref token or nil (0)</returns>
internal AssemblyReferenceHandle GetAssemblyRef(string assemblyName)
{
Debug.Assert(assemblyName != null);
try
{
// Iterate over assembly ref rows
foreach (var assemblyRef in MetadataReader.AssemblyReferences)
{
// Check whether matching name
if (MetadataReader.StringComparer.Equals(MetadataReader.GetAssemblyReference(assemblyRef).Name, assemblyName))
{
// Return assembly ref token
return assemblyRef;
}
}
}
catch (BadImageFormatException)
{ }
// Not found
return default(AssemblyReferenceHandle);
}
/// <summary>
/// Returns MetadataToken for type ref matching resolution scope and name
/// </summary>
/// <param name="resolutionScope">The resolution scope token</param>
/// <param name="namespaceName">The namespace name in metadata format (case sensitive)</param>
/// <param name="typeName">The type name in metadata format (case sensitive)</param>
/// <returns>Matching type ref token or nil (0)</returns>
internal EntityHandle GetTypeRef(
EntityHandle resolutionScope,
string namespaceName,
string typeName)
{
Debug.Assert(!resolutionScope.IsNil);
Debug.Assert(namespaceName != null);
Debug.Assert(typeName != null);
try
{
// Iterate over type ref rows
foreach (var handle in MetadataReader.TypeReferences)
{
var typeRef = MetadataReader.GetTypeReference(handle);
// Check whether matching resolution scope
if (typeRef.ResolutionScope != resolutionScope)
{
continue;
}
// Check whether matching name
if (!MetadataReader.StringComparer.Equals(typeRef.Name, typeName))
{
continue;
}
if (MetadataReader.StringComparer.Equals(typeRef.Namespace, namespaceName))
{
// Return type ref token
return handle;
}
}
}
catch (BadImageFormatException)
{ }
// Not found
return default(TypeReferenceHandle);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetTypeRefPropsOrThrow(
TypeReferenceHandle handle,
out string name,
out string @namespace,
out EntityHandle resolutionScope)
{
TypeReference typeRef = MetadataReader.GetTypeReference(handle);
resolutionScope = typeRef.ResolutionScope;
name = MetadataReader.GetString(typeRef.Name);
Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name));
@namespace = MetadataReader.GetString(typeRef.Namespace);
}
/// <summary>
/// Determine if custom attribute matches the target attribute.
/// </summary>
/// <param name="customAttribute">
/// Handle of the custom attribute.
/// </param>
/// <param name="description">The attribute to match.</param>
/// <returns>
/// An index of the target constructor signature in
/// signatures array, -1 if
/// this is not the target attribute.
/// </returns>
internal int GetTargetAttributeSignatureIndex(CustomAttributeHandle customAttribute, AttributeDescription description)
{
return GetTargetAttributeSignatureIndex(MetadataReader, customAttribute, description);
}
/// <summary>
/// Determine if custom attribute matches the target attribute.
/// </summary>
/// <param name="metadataReader">
/// The metadata reader.
/// </param>
/// <param name="customAttribute">
/// Handle of the custom attribute.
/// </param>
/// <param name="description">The attribute to match.</param>
/// <returns>
/// An index of the target constructor signature in
/// signatures array, -1 if
/// this is not the target attribute.
/// </returns>
private static int GetTargetAttributeSignatureIndex(MetadataReader metadataReader, CustomAttributeHandle customAttribute, AttributeDescription description)
{
const int No = -1;
EntityHandle ctor;
// Check namespace and type name and get signature if a match is found
if (!IsTargetAttribute(metadataReader, customAttribute, description.Namespace, description.Name, out ctor, description.MatchIgnoringCase))
{
return No;
}
try
{
// Check signatures
BlobReader sig = metadataReader.GetBlobReader(GetMethodSignatureOrThrow(metadataReader, ctor));
for (int i = 0; i < description.Signatures.Length; i++)
{
var targetSignature = description.Signatures[i];
Debug.Assert(targetSignature.Length >= 3);
sig.Reset();
// Make sure the headers match.
if (sig.RemainingBytes >= 3 &&
sig.ReadByte() == targetSignature[0] &&
sig.ReadByte() == targetSignature[1] &&
sig.ReadByte() == targetSignature[2])
{
int j = 3;
for (; j < targetSignature.Length; j++)
{
if (sig.RemainingBytes == 0)
{
// No more bytes in the signature
break;
}
SignatureTypeCode b = sig.ReadSignatureTypeCode();
if ((SignatureTypeCode)targetSignature[j] == b)
{
switch (b)
{
case SignatureTypeCode.TypeHandle:
EntityHandle token = sig.ReadTypeHandle();
HandleKind tokenType = token.Kind;
StringHandle name;
StringHandle ns;
if (tokenType == HandleKind.TypeDefinition)
{
TypeDefinitionHandle typeHandle = (TypeDefinitionHandle)token;
if (IsNestedTypeDefOrThrow(metadataReader, typeHandle))
{
// At the moment, none of the well-known attributes take nested types.
break; // Signature doesn't match.
}
TypeDefinition typeDef = metadataReader.GetTypeDefinition(typeHandle);
name = typeDef.Name;
ns = typeDef.Namespace;
}
else if (tokenType == HandleKind.TypeReference)
{
TypeReference typeRef = metadataReader.GetTypeReference((TypeReferenceHandle)token);
if (typeRef.ResolutionScope.Kind == HandleKind.TypeReference)
{
// At the moment, none of the well-known attributes take nested types.
break; // Signature doesn't match.
}
name = typeRef.Name;
ns = typeRef.Namespace;
}
else
{
break; // Signature doesn't match.
}
AttributeDescription.TypeHandleTargetInfo targetInfo = AttributeDescription.TypeHandleTargets[targetSignature[j + 1]];
if (StringEquals(metadataReader, ns, targetInfo.Namespace, ignoreCase: false) &&
StringEquals(metadataReader, name, targetInfo.Name, ignoreCase: false))
{
j++;
continue;
}
break; // Signature doesn't match.
case SignatureTypeCode.SZArray:
// Verify array element type
continue;
default:
continue;
}
}
break; // Signature doesn't match.
}
if (sig.RemainingBytes == 0 && j == targetSignature.Length)
{
// We found a match
return i;
}
}
}
}
catch (BadImageFormatException)
{ }
return No;
}
/// <summary>
/// Given a token for a constructor, return the token for the constructor's type and the blob containing the
/// constructor's signature.
/// </summary>
/// <returns>True if the function successfully returns the type and signature.</returns>
internal bool GetTypeAndConstructor(
CustomAttributeHandle customAttribute,
out EntityHandle ctorType,
out EntityHandle attributeCtor)
{
return GetTypeAndConstructor(MetadataReader, customAttribute, out ctorType, out attributeCtor);
}
/// <summary>
/// Given a token for a constructor, return the token for the constructor's type and the blob containing the
/// constructor's signature.
/// </summary>
/// <returns>True if the function successfully returns the type and signature.</returns>
private static bool GetTypeAndConstructor(
MetadataReader metadataReader,
CustomAttributeHandle customAttribute,
out EntityHandle ctorType,
out EntityHandle attributeCtor)
{
try
{
ctorType = default(EntityHandle);
attributeCtor = metadataReader.GetCustomAttribute(customAttribute).Constructor;
if (attributeCtor.Kind == HandleKind.MemberReference)
{
MemberReference memberRef = metadataReader.GetMemberReference((MemberReferenceHandle)attributeCtor);
StringHandle ctorName = memberRef.Name;
if (!metadataReader.StringComparer.Equals(ctorName, WellKnownMemberNames.InstanceConstructorName))
{
// Not a constructor.
return false;
}
ctorType = memberRef.Parent;
}
else if (attributeCtor.Kind == HandleKind.MethodDefinition)
{
var methodDef = metadataReader.GetMethodDefinition((MethodDefinitionHandle)attributeCtor);
if (!metadataReader.StringComparer.Equals(methodDef.Name, WellKnownMemberNames.InstanceConstructorName))
{
// Not a constructor.
return false;
}
ctorType = methodDef.GetDeclaringType();
Debug.Assert(!ctorType.IsNil);
}
else
{
// invalid metadata
return false;
}
return true;
}
catch (BadImageFormatException)
{
ctorType = default(EntityHandle);
attributeCtor = default(EntityHandle);
return false;
}
}
/// <summary>
/// Given a token for a type, return the type's name and namespace. Only works for top level types.
/// namespaceHandle will be NamespaceDefinitionHandle for defs and StringHandle for refs.
/// </summary>
/// <returns>True if the function successfully returns the name and namespace.</returns>
internal bool GetAttributeNamespaceAndName(EntityHandle typeDefOrRef, out StringHandle namespaceHandle, out StringHandle nameHandle)
{
return GetAttributeNamespaceAndName(MetadataReader, typeDefOrRef, out namespaceHandle, out nameHandle);
}
/// <summary>
/// Given a token for a type, return the type's name and namespace. Only works for top level types.
/// namespaceHandle will be NamespaceDefinitionHandle for defs and StringHandle for refs.
/// </summary>
/// <returns>True if the function successfully returns the name and namespace.</returns>
private static bool GetAttributeNamespaceAndName(MetadataReader metadataReader, EntityHandle typeDefOrRef, out StringHandle namespaceHandle, out StringHandle nameHandle)
{
nameHandle = default(StringHandle);
namespaceHandle = default(StringHandle);
try
{
if (typeDefOrRef.Kind == HandleKind.TypeReference)
{
TypeReference typeRefRow = metadataReader.GetTypeReference((TypeReferenceHandle)typeDefOrRef);
HandleKind handleType = typeRefRow.ResolutionScope.Kind;
if (handleType == HandleKind.TypeReference || handleType == HandleKind.TypeDefinition)
{
// TODO - Support nested types.
return false;
}
nameHandle = typeRefRow.Name;
namespaceHandle = typeRefRow.Namespace;
}
else if (typeDefOrRef.Kind == HandleKind.TypeDefinition)
{
var def = metadataReader.GetTypeDefinition((TypeDefinitionHandle)typeDefOrRef);
if (IsNested(def.Attributes))
{
// TODO - Support nested types.
return false;
}
nameHandle = def.Name;
namespaceHandle = def.Namespace;
}
else
{
// unsupported metadata
return false;
}
return true;
}
catch (BadImageFormatException)
{
return false;
}
}
/// <summary>
/// For testing purposes only!!!
/// </summary>
internal void PretendThereArentNoPiaLocalTypes()
{
Debug.Assert(_lazyContainsNoPiaLocalTypes != ThreeState.True);
_lazyContainsNoPiaLocalTypes = ThreeState.False;
}
internal bool ContainsNoPiaLocalTypes()
{
if (_lazyContainsNoPiaLocalTypes == ThreeState.Unknown)
{
try
{
foreach (var attributeHandle in MetadataReader.CustomAttributes)
{
int signatureIndex = IsTypeIdentifierAttribute(attributeHandle);
if (signatureIndex != -1)
{
// We found a match
_lazyContainsNoPiaLocalTypes = ThreeState.True;
// We excluded attributes not applied on TypeDefs above:
var parent = (TypeDefinitionHandle)MetadataReader.GetCustomAttribute(attributeHandle).Parent;
RegisterNoPiaLocalType(parent, attributeHandle, signatureIndex);
return true;
}
}
}
catch (BadImageFormatException)
{ }
_lazyContainsNoPiaLocalTypes = ThreeState.False;
}
return _lazyContainsNoPiaLocalTypes == ThreeState.True;
}
internal bool HasNullableContextAttribute(EntityHandle token, out byte value)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NullableContextAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0);
if (!info.HasValue)
{
value = 0;
return false;
}
return TryExtractValueFromAttribute(info.Handle, out value, s_attributeByteValueExtractor);
}
internal bool HasNullableAttribute(EntityHandle token, out byte defaultTransform, out ImmutableArray<byte> nullableTransforms)
{
AttributeInfo info = FindTargetAttribute(token, AttributeDescription.NullableAttribute);
Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1);
defaultTransform = 0;
nullableTransforms = default(ImmutableArray<byte>);
if (!info.HasValue)
{
return false;
}
if (info.SignatureIndex == 0)
{
return TryExtractValueFromAttribute(info.Handle, out defaultTransform, s_attributeByteValueExtractor);
}
return TryExtractByteArrayValueFromAttribute(info.Handle, out nullableTransforms);
}
#endregion
#region TypeSpec helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobReader GetTypeSpecificationSignatureReaderOrThrow(TypeSpecificationHandle typeSpec)
{
// TODO: Check validity of the typeSpec handle.
BlobHandle signature = MetadataReader.GetTypeSpecification(typeSpec).Signature;
// TODO: error checking offset in range
return MetadataReader.GetBlobReader(signature);
}
#endregion
#region MethodSpec helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetMethodSpecificationOrThrow(MethodSpecificationHandle handle, out EntityHandle method, out BlobHandle instantiation)
{
var methodSpec = MetadataReader.GetMethodSpecification(handle);
method = methodSpec.Method;
instantiation = methodSpec.Signature;
}
#endregion
#region GenericParam helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetGenericParamPropsOrThrow(
GenericParameterHandle handle,
out string name,
out GenericParameterAttributes flags)
{
GenericParameter row = MetadataReader.GetGenericParameter(handle);
name = MetadataReader.GetString(row.Name);
flags = row.Attributes;
}
#endregion
#region MethodDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetMethodDefNameOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetString(MetadataReader.GetMethodDefinition(methodDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetMethodSignatureOrThrow(MethodDefinitionHandle methodDef)
{
return GetMethodSignatureOrThrow(MetadataReader, methodDef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static BlobHandle GetMethodSignatureOrThrow(MetadataReader metadataReader, MethodDefinitionHandle methodDef)
{
return metadataReader.GetMethodDefinition(methodDef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetMethodSignatureOrThrow(EntityHandle methodDefOrRef)
{
return GetMethodSignatureOrThrow(MetadataReader, methodDefOrRef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static BlobHandle GetMethodSignatureOrThrow(MetadataReader metadataReader, EntityHandle methodDefOrRef)
{
switch (methodDefOrRef.Kind)
{
case HandleKind.MethodDefinition:
return GetMethodSignatureOrThrow(metadataReader, (MethodDefinitionHandle)methodDefOrRef);
case HandleKind.MemberReference:
return GetSignatureOrThrow(metadataReader, (MemberReferenceHandle)methodDefOrRef);
default:
throw ExceptionUtilities.UnexpectedValue(methodDefOrRef.Kind);
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public MethodAttributes GetMethodDefFlagsOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal TypeDefinitionHandle FindContainingTypeOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).GetDeclaringType();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal TypeDefinitionHandle FindContainingTypeOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetFieldDefinition(fieldDef).GetDeclaringType();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EntityHandle GetContainingTypeOrThrow(MemberReferenceHandle memberRef)
{
return MetadataReader.GetMemberReference(memberRef).Parent;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetMethodDefPropsOrThrow(
MethodDefinitionHandle methodDef,
out string name,
out MethodImplAttributes implFlags,
out MethodAttributes flags,
out int rva)
{
MethodDefinition methodRow = MetadataReader.GetMethodDefinition(methodDef);
name = MetadataReader.GetString(methodRow.Name);
implFlags = methodRow.ImplAttributes;
flags = methodRow.Attributes;
rva = methodRow.RelativeVirtualAddress;
Debug.Assert(rva >= 0);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetMethodImplPropsOrThrow(
MethodImplementationHandle methodImpl,
out EntityHandle body,
out EntityHandle declaration)
{
var impl = MetadataReader.GetMethodImplementation(methodImpl);
body = impl.MethodBody;
declaration = impl.MethodDeclaration;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal GenericParameterHandleCollection GetGenericParametersForMethodOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).GetGenericParameters();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal ParameterHandleCollection GetParametersOfMethodOrThrow(MethodDefinitionHandle methodDef)
{
return MetadataReader.GetMethodDefinition(methodDef).GetParameters();
}
internal DllImportData GetDllImportData(MethodDefinitionHandle methodDef)
{
try
{
var methodImport = MetadataReader.GetMethodDefinition(methodDef).GetImport();
if (methodImport.Module.IsNil)
{
// TODO (tomat): report an error?
return null;
}
string moduleName = GetModuleRefNameOrThrow(methodImport.Module);
string entryPointName = MetadataReader.GetString(methodImport.Name);
MethodImportAttributes flags = (MethodImportAttributes)methodImport.Attributes;
return new DllImportData(moduleName, entryPointName, flags);
}
catch (BadImageFormatException)
{
return null;
}
}
#endregion
#region MemberRef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetMemberRefNameOrThrow(MemberReferenceHandle memberRef)
{
return GetMemberRefNameOrThrow(MetadataReader, memberRef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static string GetMemberRefNameOrThrow(MetadataReader metadataReader, MemberReferenceHandle memberRef)
{
return metadataReader.GetString(metadataReader.GetMemberReference(memberRef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetSignatureOrThrow(MemberReferenceHandle memberRef)
{
return GetSignatureOrThrow(MetadataReader, memberRef);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private static BlobHandle GetSignatureOrThrow(MetadataReader metadataReader, MemberReferenceHandle memberRef)
{
return metadataReader.GetMemberReference(memberRef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetMemberRefPropsOrThrow(
MemberReferenceHandle memberRef,
out EntityHandle @class,
out string name,
out byte[] signature)
{
MemberReference row = MetadataReader.GetMemberReference(memberRef);
@class = row.Parent;
name = MetadataReader.GetString(row.Name);
signature = MetadataReader.GetBlobBytes(row.Signature);
}
#endregion MemberRef helpers
#region ParamDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetParamPropsOrThrow(
ParameterHandle parameterDef,
out string name,
out ParameterAttributes flags)
{
Parameter parameter = MetadataReader.GetParameter(parameterDef);
name = MetadataReader.GetString(parameter.Name);
flags = parameter.Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetParamNameOrThrow(ParameterHandle parameterDef)
{
Parameter parameter = MetadataReader.GetParameter(parameterDef);
return MetadataReader.GetString(parameter.Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal int GetParameterSequenceNumberOrThrow(ParameterHandle param)
{
return MetadataReader.GetParameter(param).SequenceNumber;
}
#endregion
#region PropertyDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetPropertyDefNameOrThrow(PropertyDefinitionHandle propertyDef)
{
return MetadataReader.GetString(MetadataReader.GetPropertyDefinition(propertyDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetPropertySignatureOrThrow(PropertyDefinitionHandle propertyDef)
{
return MetadataReader.GetPropertyDefinition(propertyDef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetPropertyDefPropsOrThrow(
PropertyDefinitionHandle propertyDef,
out string name,
out PropertyAttributes flags)
{
PropertyDefinition property = MetadataReader.GetPropertyDefinition(propertyDef);
name = MetadataReader.GetString(property.Name);
flags = property.Attributes;
}
#endregion
#region EventDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal string GetEventDefNameOrThrow(EventDefinitionHandle eventDef)
{
return MetadataReader.GetString(MetadataReader.GetEventDefinition(eventDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal void GetEventDefPropsOrThrow(
EventDefinitionHandle eventDef,
out string name,
out EventAttributes flags,
out EntityHandle type)
{
EventDefinition eventRow = MetadataReader.GetEventDefinition(eventDef);
name = MetadataReader.GetString(eventRow.Name);
flags = eventRow.Attributes;
type = eventRow.Type;
}
#endregion
#region FieldDef helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public string GetFieldDefNameOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetString(MetadataReader.GetFieldDefinition(fieldDef).Name);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal BlobHandle GetFieldSignatureOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetFieldDefinition(fieldDef).Signature;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public FieldAttributes GetFieldDefFlagsOrThrow(FieldDefinitionHandle fieldDef)
{
return MetadataReader.GetFieldDefinition(fieldDef).Attributes;
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public void GetFieldDefPropsOrThrow(
FieldDefinitionHandle fieldDef,
out string name,
out FieldAttributes flags)
{
FieldDefinition fieldRow = MetadataReader.GetFieldDefinition(fieldDef);
name = MetadataReader.GetString(fieldRow.Name);
flags = fieldRow.Attributes;
}
internal ConstantValue GetParamDefaultValue(ParameterHandle param)
{
Debug.Assert(!param.IsNil);
try
{
var constantHandle = MetadataReader.GetParameter(param).GetDefaultValue();
// TODO: Error checking: Throw an error if the table entry cannot be found
return constantHandle.IsNil ? ConstantValue.Bad : GetConstantValueOrThrow(constantHandle);
}
catch (BadImageFormatException)
{
return ConstantValue.Bad;
}
}
internal ConstantValue GetConstantFieldValue(FieldDefinitionHandle fieldDef)
{
Debug.Assert(!fieldDef.IsNil);
try
{
var constantHandle = MetadataReader.GetFieldDefinition(fieldDef).GetDefaultValue();
// TODO: Error checking: Throw an error if the table entry cannot be found
return constantHandle.IsNil ? ConstantValue.Bad : GetConstantValueOrThrow(constantHandle);
}
catch (BadImageFormatException)
{
return ConstantValue.Bad;
}
}
#endregion
#region Attribute Helpers
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public CustomAttributeHandleCollection GetCustomAttributesOrThrow(EntityHandle handle)
{
return MetadataReader.GetCustomAttributes(handle);
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
public BlobHandle GetCustomAttributeValueOrThrow(CustomAttributeHandle handle)
{
return MetadataReader.GetCustomAttribute(handle).Value;
}
#endregion
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private BlobHandle GetMarshallingDescriptorHandleOrThrow(EntityHandle fieldOrParameterToken)
{
return fieldOrParameterToken.Kind == HandleKind.FieldDefinition ?
MetadataReader.GetFieldDefinition((FieldDefinitionHandle)fieldOrParameterToken).GetMarshallingDescriptor() :
MetadataReader.GetParameter((ParameterHandle)fieldOrParameterToken).GetMarshallingDescriptor();
}
internal UnmanagedType GetMarshallingType(EntityHandle fieldOrParameterToken)
{
try
{
var blob = GetMarshallingDescriptorHandleOrThrow(fieldOrParameterToken);
if (blob.IsNil)
{
// TODO (tomat): report error:
return 0;
}
byte firstByte = MetadataReader.GetBlobReader(blob).ReadByte();
// return only valid types, other values are not interesting for the compiler:
return firstByte <= 0x50 ? (UnmanagedType)firstByte : 0;
}
catch (BadImageFormatException)
{
return 0;
}
}
internal ImmutableArray<byte> GetMarshallingDescriptor(EntityHandle fieldOrParameterToken)
{
try
{
var blob = GetMarshallingDescriptorHandleOrThrow(fieldOrParameterToken);
if (blob.IsNil)
{
// TODO (tomat): report error:
return ImmutableArray<byte>.Empty;
}
return MetadataReader.GetBlobBytes(blob).AsImmutableOrNull();
}
catch (BadImageFormatException)
{
return ImmutableArray<byte>.Empty;
}
}
internal int? GetFieldOffset(FieldDefinitionHandle fieldDef)
{
try
{
int offset = MetadataReader.GetFieldDefinition(fieldDef).GetOffset();
if (offset == -1)
{
return null;
}
return offset;
}
catch (BadImageFormatException)
{
return null;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
private ConstantValue GetConstantValueOrThrow(ConstantHandle handle)
{
var constantRow = MetadataReader.GetConstant(handle);
BlobReader reader = MetadataReader.GetBlobReader(constantRow.Value);
switch (constantRow.TypeCode)
{
case ConstantTypeCode.Boolean:
return ConstantValue.Create(reader.ReadBoolean());
case ConstantTypeCode.Char:
return ConstantValue.Create(reader.ReadChar());
case ConstantTypeCode.SByte:
return ConstantValue.Create(reader.ReadSByte());
case ConstantTypeCode.Int16:
return ConstantValue.Create(reader.ReadInt16());
case ConstantTypeCode.Int32:
return ConstantValue.Create(reader.ReadInt32());
case ConstantTypeCode.Int64:
return ConstantValue.Create(reader.ReadInt64());
case ConstantTypeCode.Byte:
return ConstantValue.Create(reader.ReadByte());
case ConstantTypeCode.UInt16:
return ConstantValue.Create(reader.ReadUInt16());
case ConstantTypeCode.UInt32:
return ConstantValue.Create(reader.ReadUInt32());
case ConstantTypeCode.UInt64:
return ConstantValue.Create(reader.ReadUInt64());
case ConstantTypeCode.Single:
return ConstantValue.Create(reader.ReadSingle());
case ConstantTypeCode.Double:
return ConstantValue.Create(reader.ReadDouble());
case ConstantTypeCode.String:
return ConstantValue.Create(reader.ReadUTF16(reader.Length));
case ConstantTypeCode.NullReference:
// Partition II section 22.9:
// The encoding of Type for the nullref value is ELEMENT_TYPE_CLASS with a Value of a 4-byte zero.
// Unlike uses of ELEMENT_TYPE_CLASS in signatures, this one is not followed by a type token.
if (reader.ReadUInt32() == 0)
{
return ConstantValue.Null;
}
break;
}
return ConstantValue.Bad;
}
internal (int FirstIndex, int SecondIndex) GetAssemblyRefsForForwardedType(string fullName, bool ignoreCase, out string matchedName)
{
EnsureForwardTypeToAssemblyMap();
if (ignoreCase)
{
// This linear search is not the optimal way to use a hashmap, but we should only use
// this functionality when computing diagnostics. Note
// that we can't store the map case-insensitively, since real metadata name
// lookup has to remain case sensitive.
foreach (var pair in _lazyForwardedTypesToAssemblyIndexMap)
{
if (string.Equals(pair.Key, fullName, StringComparison.OrdinalIgnoreCase))
{
matchedName = pair.Key;
return pair.Value;
}
}
}
else
{
(int FirstIndex, int SecondIndex) assemblyIndices;
if (_lazyForwardedTypesToAssemblyIndexMap.TryGetValue(fullName, out assemblyIndices))
{
matchedName = fullName;
return assemblyIndices;
}
}
matchedName = null;
return (FirstIndex: -1, SecondIndex: -1);
}
internal IEnumerable<KeyValuePair<string, (int FirstIndex, int SecondIndex)>> GetForwardedTypes()
{
EnsureForwardTypeToAssemblyMap();
return _lazyForwardedTypesToAssemblyIndexMap;
}
private void EnsureForwardTypeToAssemblyMap()
{
if (_lazyForwardedTypesToAssemblyIndexMap == null)
{
var typesToAssemblyIndexMap = new Dictionary<string, (int FirstIndex, int SecondIndex)>();
try
{
var forwarders = MetadataReader.ExportedTypes;
foreach (var handle in forwarders)
{
ExportedType exportedType = MetadataReader.GetExportedType(handle);
if (!exportedType.IsForwarder)
{
continue;
}
AssemblyReferenceHandle refHandle = (AssemblyReferenceHandle)exportedType.Implementation;
if (refHandle.IsNil)
{
continue;
}
int referencedAssemblyIndex;
try
{
referencedAssemblyIndex = this.GetAssemblyReferenceIndexOrThrow(refHandle);
}
catch (BadImageFormatException)
{
continue;
}
if (referencedAssemblyIndex < 0 || referencedAssemblyIndex >= this.ReferencedAssemblies.Length)
{
continue;
}
string name = MetadataReader.GetString(exportedType.Name);
StringHandle ns = exportedType.Namespace;
if (!ns.IsNil)
{
string namespaceString = MetadataReader.GetString(ns);
if (namespaceString.Length > 0)
{
name = namespaceString + "." + name;
}
}
(int FirstIndex, int SecondIndex) indices;
if (typesToAssemblyIndexMap.TryGetValue(name, out indices))
{
Debug.Assert(indices.FirstIndex >= 0, "Not allowed to store a negative (non-existent) index in typesToAssemblyIndexMap");
// Store it only if it was not a duplicate
if (indices.FirstIndex != referencedAssemblyIndex && indices.SecondIndex < 0)
{
indices.SecondIndex = referencedAssemblyIndex;
typesToAssemblyIndexMap[name] = indices;
}
}
else
{
typesToAssemblyIndexMap.Add(name, (FirstIndex: referencedAssemblyIndex, SecondIndex: -1));
}
}
}
catch (BadImageFormatException)
{ }
_lazyForwardedTypesToAssemblyIndexMap = typesToAssemblyIndexMap;
}
}
internal IdentifierCollection TypeNames
{
get
{
return _lazyTypeNameCollection.Value;
}
}
internal IdentifierCollection NamespaceNames
{
get
{
return _lazyNamespaceNameCollection.Value;
}
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal PropertyAccessors GetPropertyMethodsOrThrow(PropertyDefinitionHandle propertyDef)
{
return MetadataReader.GetPropertyDefinition(propertyDef).GetAccessors();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal EventAccessors GetEventMethodsOrThrow(EventDefinitionHandle eventDef)
{
return MetadataReader.GetEventDefinition(eventDef).GetAccessors();
}
/// <exception cref="BadImageFormatException">An exception from metadata reader.</exception>
internal int GetAssemblyReferenceIndexOrThrow(AssemblyReferenceHandle assemblyRef)
{
return MetadataReader.GetRowNumber(assemblyRef) - 1;
}
internal static bool IsNested(TypeAttributes flags)
{
return (flags & ((TypeAttributes)0x00000006)) != 0;
}
/// <summary>
/// Returns true if method IL can be retrieved from the module.
/// </summary>
internal bool HasIL
{
get { return IsEntireImageAvailable; }
}
/// <summary>
/// Returns true if the full image of the module is available.
/// </summary>
internal bool IsEntireImageAvailable
{
get { return _peReaderOpt != null && _peReaderOpt.IsEntireImageAvailable; }
}
/// <exception cref="BadImageFormatException">Invalid metadata.</exception>
internal MethodBodyBlock GetMethodBodyOrThrow(MethodDefinitionHandle methodHandle)
{
// we shouldn't ask for method IL if we don't have PE image
Debug.Assert(_peReaderOpt != null);
MethodDefinition method = MetadataReader.GetMethodDefinition(methodHandle);
if ((method.ImplAttributes & MethodImplAttributes.CodeTypeMask) != MethodImplAttributes.IL ||
method.RelativeVirtualAddress == 0)
{
return null;
}
return _peReaderOpt.GetMethodBody(method.RelativeVirtualAddress);
}
// TODO: remove, API should be provided by MetadataReader
private static bool StringEquals(MetadataReader metadataReader, StringHandle nameHandle, string name, bool ignoreCase)
{
if (ignoreCase)
{
return string.Equals(metadataReader.GetString(nameHandle), name, StringComparison.OrdinalIgnoreCase);
}
return metadataReader.StringComparer.Equals(nameHandle, name);
}
// Provides a UTF8 decoder to the MetadataReader that reuses strings from the string table
// rather than allocating on each call to MetadataReader.GetString(handle).
private sealed class StringTableDecoder : MetadataStringDecoder
{
public static readonly StringTableDecoder Instance = new StringTableDecoder();
private StringTableDecoder() : base(System.Text.Encoding.UTF8) { }
public override unsafe string GetString(byte* bytes, int byteCount)
{
return StringTable.AddSharedUTF8(new ReadOnlySpan<byte>(bytes, byteCount));
}
}
public ModuleMetadata GetNonDisposableMetadata() => _owner.Copy();
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Tools/BuildValidator/LocalSourceResolver.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Rebuild;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Extensions.Logging;
namespace BuildValidator
{
internal class LocalSourceResolver
{
internal Options Options { get; }
internal ImmutableArray<SourceLinkEntry> SourceLinkEntries { get; }
internal ILogger Logger { get; }
public LocalSourceResolver(Options options, ImmutableArray<SourceLinkEntry> sourceLinkEntries, ILogger logger)
{
Options = options;
SourceLinkEntries = sourceLinkEntries;
Logger = logger;
}
public SourceText ResolveSource(SourceTextInfo sourceTextInfo)
{
var originalFilePath = sourceTextInfo.OriginalSourceFilePath;
string? onDiskPath = null;
foreach (var link in SourceLinkEntries)
{
if (originalFilePath.StartsWith(link.Prefix, FileNameEqualityComparer.StringComparison))
{
onDiskPath = Path.GetFullPath(Path.Combine(Options.SourcePath, originalFilePath.Substring(link.Prefix.Length)));
if (File.Exists(onDiskPath))
{
break;
}
}
}
// if no source links exist to let us prefix the source path,
// then assume the file path in the pdb points to the on-disk location of the file.
onDiskPath ??= originalFilePath;
using var fileStream = File.OpenRead(onDiskPath);
var sourceText = SourceText.From(fileStream, encoding: sourceTextInfo.SourceTextEncoding, checksumAlgorithm: SourceHashAlgorithm.Sha256, canBeEmbedded: false);
if (!sourceText.GetChecksum().SequenceEqual(sourceTextInfo.Hash))
{
throw new Exception($@"File ""{onDiskPath}"" has incorrect hash");
}
return sourceText;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Rebuild;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Extensions.Logging;
namespace BuildValidator
{
internal class LocalSourceResolver
{
internal Options Options { get; }
internal ImmutableArray<SourceLinkEntry> SourceLinkEntries { get; }
internal ILogger Logger { get; }
public LocalSourceResolver(Options options, ImmutableArray<SourceLinkEntry> sourceLinkEntries, ILogger logger)
{
Options = options;
SourceLinkEntries = sourceLinkEntries;
Logger = logger;
}
public SourceText ResolveSource(SourceTextInfo sourceTextInfo)
{
var originalFilePath = sourceTextInfo.OriginalSourceFilePath;
string? onDiskPath = null;
foreach (var link in SourceLinkEntries)
{
if (originalFilePath.StartsWith(link.Prefix, FileNameEqualityComparer.StringComparison))
{
onDiskPath = Path.GetFullPath(Path.Combine(Options.SourcePath, originalFilePath.Substring(link.Prefix.Length)));
if (File.Exists(onDiskPath))
{
break;
}
}
}
// if no source links exist to let us prefix the source path,
// then assume the file path in the pdb points to the on-disk location of the file.
onDiskPath ??= originalFilePath;
using var fileStream = File.OpenRead(onDiskPath);
var sourceText = SourceText.From(fileStream, encoding: sourceTextInfo.SourceTextEncoding, checksumAlgorithm: SourceHashAlgorithm.Sha256, canBeEmbedded: false);
if (!sourceText.GetChecksum().SequenceEqual(sourceTextInfo.Hash))
{
throw new Exception($@"File ""{onDiskPath}"" has incorrect hash");
}
return sourceText;
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.DocumentationComments
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.SignatureHelp
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
<ExportSignatureHelpProvider("RaiseEventSignatureHelpProvider", LanguageNames.VisualBasic), [Shared]>
Friend Class RaiseEventStatementSignatureHelpProvider
Inherits AbstractVisualBasicSignatureHelpProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean
Return ch = "("c OrElse ch = ","c
End Function
Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean
Return False
End Function
Public Overrides Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
Dim statement As RaiseEventStatementSyntax = Nothing
If TryGetRaiseEventStatement(root, position, syntaxFacts, SignatureHelpTriggerReason.InvokeSignatureHelpCommand, cancellationToken, statement) AndAlso
currentSpan.Start = statement.Name.SpanStart Then
Return SignatureHelpUtilities.GetSignatureHelpState(statement.ArgumentList, position)
End If
Return Nothing
End Function
Private Shared Function TryGetRaiseEventStatement(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, triggerReason As SignatureHelpTriggerReason, cancellationToken As CancellationToken, ByRef statement As RaiseEventStatementSyntax) As Boolean
If Not CommonSignatureHelpUtilities.TryGetSyntax(root, position, syntaxFacts, triggerReason, AddressOf IsTriggerToken, AddressOf IsArgumentListToken, cancellationToken, statement) Then
Return False
End If
Return statement.ArgumentList IsNot Nothing
End Function
Private Shared Function IsTriggerToken(token As SyntaxToken) As Boolean
Return (token.Kind = SyntaxKind.OpenParenToken OrElse token.Kind = SyntaxKind.CommaToken) AndAlso
TypeOf token.Parent Is ArgumentListSyntax AndAlso
TypeOf token.Parent.Parent Is RaiseEventStatementSyntax
End Function
Private Shared Function IsArgumentListToken(statement As RaiseEventStatementSyntax, token As SyntaxToken) As Boolean
Return statement.ArgumentList IsNot Nothing AndAlso
statement.ArgumentList.Span.Contains(token.SpanStart) AndAlso
statement.ArgumentList.CloseParenToken <> token
End Function
Protected Overrides Async Function GetItemsWorkerAsync(
document As Document,
position As Integer,
triggerInfo As SignatureHelpTriggerInfo,
cancellationToken As CancellationToken
) As Task(Of SignatureHelpItems)
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim raiseEventStatement As RaiseEventStatementSyntax = Nothing
If Not TryGetRaiseEventStatement(root, position, document.GetLanguageService(Of ISyntaxFactsService), triggerInfo.TriggerReason, cancellationToken, raiseEventStatement) Then
Return Nothing
End If
Dim semanticModel = Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
Dim containingType = semanticModel.GetEnclosingSymbol(position, cancellationToken).ContainingType
Dim syntaxFactsService = document.GetLanguageService(Of ISyntaxFactsService)()
Dim events = If(syntaxFactsService.IsInStaticContext(raiseEventStatement),
semanticModel.LookupStaticMembers(raiseEventStatement.SpanStart, containingType, raiseEventStatement.Name.Identifier.ValueText),
semanticModel.LookupSymbols(raiseEventStatement.SpanStart, containingType, raiseEventStatement.Name.Identifier.ValueText))
Dim allowedEvents = events.WhereAsArray(Function(s) s.Kind = SymbolKind.Event AndAlso Equals(s.ContainingType, containingType)).
OfType(Of IEventSymbol)().
ToImmutableArrayOrEmpty().
FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(document.ShouldHideAdvancedMembers(), semanticModel.Compilation).
Sort(semanticModel, raiseEventStatement.SpanStart)
Dim anonymousTypeDisplayService = document.GetLanguageService(Of IAnonymousTypeDisplayService)()
Dim documentationCommentFormattingService = document.GetLanguageService(Of IDocumentationCommentFormattingService)()
Dim textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(raiseEventStatement.ArgumentList, raiseEventStatement.Name.SpanStart)
Dim syntaxFacts = document.GetLanguageService(Of ISyntaxFactsService)
Return CreateSignatureHelpItems(
allowedEvents.Select(Function(e) Convert(e, raiseEventStatement, semanticModel, anonymousTypeDisplayService, documentationCommentFormattingService)).ToList(),
textSpan, GetCurrentArgumentState(root, position, syntaxFacts, textSpan, cancellationToken), selectedItem:=Nothing)
End Function
Private Overloads Shared Function Convert(
eventSymbol As IEventSymbol,
raiseEventStatement As RaiseEventStatementSyntax,
semanticModel As SemanticModel,
anonymousTypeDisplayService As IAnonymousTypeDisplayService,
documentationCommentFormattingService As IDocumentationCommentFormattingService
) As SignatureHelpItem
Dim position = raiseEventStatement.SpanStart
Dim type = DirectCast(eventSymbol.Type, INamedTypeSymbol)
Dim item = CreateItem(
eventSymbol, semanticModel, position,
anonymousTypeDisplayService,
False,
eventSymbol.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(eventSymbol, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(),
type.DelegateInvokeMethod.GetParameters().Select(Function(p) Convert(p, semanticModel, position, documentationCommentFormattingService)).ToList())
Return item
End Function
Private Shared Function GetPreambleParts(
eventSymbol As IEventSymbol,
semanticModel As SemanticModel,
position As Integer
) As IList(Of SymbolDisplayPart)
Dim result = New List(Of SymbolDisplayPart)()
result.AddRange(eventSymbol.ContainingType.ToMinimalDisplayParts(semanticModel, position))
result.Add(Punctuation(SyntaxKind.DotToken))
Dim format = MinimallyQualifiedWithoutParametersFormat
format = format.RemoveMemberOptions(SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType)
format = format.RemoveKindOptions(SymbolDisplayKindOptions.IncludeMemberKeyword)
result.AddRange(eventSymbol.ToMinimalDisplayParts(semanticModel, position, format))
result.Add(Punctuation(SyntaxKind.OpenParenToken))
Return result
End Function
Private Shared Function GetPostambleParts() As IList(Of SymbolDisplayPart)
Return {Punctuation(SyntaxKind.CloseParenToken)}
End Function
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.DocumentationComments
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.SignatureHelp
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
<ExportSignatureHelpProvider("RaiseEventSignatureHelpProvider", LanguageNames.VisualBasic), [Shared]>
Friend Class RaiseEventStatementSignatureHelpProvider
Inherits AbstractVisualBasicSignatureHelpProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean
Return ch = "("c OrElse ch = ","c
End Function
Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean
Return False
End Function
Public Overrides Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
Dim statement As RaiseEventStatementSyntax = Nothing
If TryGetRaiseEventStatement(root, position, syntaxFacts, SignatureHelpTriggerReason.InvokeSignatureHelpCommand, cancellationToken, statement) AndAlso
currentSpan.Start = statement.Name.SpanStart Then
Return SignatureHelpUtilities.GetSignatureHelpState(statement.ArgumentList, position)
End If
Return Nothing
End Function
Private Shared Function TryGetRaiseEventStatement(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, triggerReason As SignatureHelpTriggerReason, cancellationToken As CancellationToken, ByRef statement As RaiseEventStatementSyntax) As Boolean
If Not CommonSignatureHelpUtilities.TryGetSyntax(root, position, syntaxFacts, triggerReason, AddressOf IsTriggerToken, AddressOf IsArgumentListToken, cancellationToken, statement) Then
Return False
End If
Return statement.ArgumentList IsNot Nothing
End Function
Private Shared Function IsTriggerToken(token As SyntaxToken) As Boolean
Return (token.Kind = SyntaxKind.OpenParenToken OrElse token.Kind = SyntaxKind.CommaToken) AndAlso
TypeOf token.Parent Is ArgumentListSyntax AndAlso
TypeOf token.Parent.Parent Is RaiseEventStatementSyntax
End Function
Private Shared Function IsArgumentListToken(statement As RaiseEventStatementSyntax, token As SyntaxToken) As Boolean
Return statement.ArgumentList IsNot Nothing AndAlso
statement.ArgumentList.Span.Contains(token.SpanStart) AndAlso
statement.ArgumentList.CloseParenToken <> token
End Function
Protected Overrides Async Function GetItemsWorkerAsync(
document As Document,
position As Integer,
triggerInfo As SignatureHelpTriggerInfo,
cancellationToken As CancellationToken
) As Task(Of SignatureHelpItems)
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim raiseEventStatement As RaiseEventStatementSyntax = Nothing
If Not TryGetRaiseEventStatement(root, position, document.GetLanguageService(Of ISyntaxFactsService), triggerInfo.TriggerReason, cancellationToken, raiseEventStatement) Then
Return Nothing
End If
Dim semanticModel = Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
Dim containingType = semanticModel.GetEnclosingSymbol(position, cancellationToken).ContainingType
Dim syntaxFactsService = document.GetLanguageService(Of ISyntaxFactsService)()
Dim events = If(syntaxFactsService.IsInStaticContext(raiseEventStatement),
semanticModel.LookupStaticMembers(raiseEventStatement.SpanStart, containingType, raiseEventStatement.Name.Identifier.ValueText),
semanticModel.LookupSymbols(raiseEventStatement.SpanStart, containingType, raiseEventStatement.Name.Identifier.ValueText))
Dim allowedEvents = events.WhereAsArray(Function(s) s.Kind = SymbolKind.Event AndAlso Equals(s.ContainingType, containingType)).
OfType(Of IEventSymbol)().
ToImmutableArrayOrEmpty().
FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(document.ShouldHideAdvancedMembers(), semanticModel.Compilation).
Sort(semanticModel, raiseEventStatement.SpanStart)
Dim anonymousTypeDisplayService = document.GetLanguageService(Of IAnonymousTypeDisplayService)()
Dim documentationCommentFormattingService = document.GetLanguageService(Of IDocumentationCommentFormattingService)()
Dim textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(raiseEventStatement.ArgumentList, raiseEventStatement.Name.SpanStart)
Dim syntaxFacts = document.GetLanguageService(Of ISyntaxFactsService)
Return CreateSignatureHelpItems(
allowedEvents.Select(Function(e) Convert(e, raiseEventStatement, semanticModel, anonymousTypeDisplayService, documentationCommentFormattingService)).ToList(),
textSpan, GetCurrentArgumentState(root, position, syntaxFacts, textSpan, cancellationToken), selectedItem:=Nothing)
End Function
Private Overloads Shared Function Convert(
eventSymbol As IEventSymbol,
raiseEventStatement As RaiseEventStatementSyntax,
semanticModel As SemanticModel,
anonymousTypeDisplayService As IAnonymousTypeDisplayService,
documentationCommentFormattingService As IDocumentationCommentFormattingService
) As SignatureHelpItem
Dim position = raiseEventStatement.SpanStart
Dim type = DirectCast(eventSymbol.Type, INamedTypeSymbol)
Dim item = CreateItem(
eventSymbol, semanticModel, position,
anonymousTypeDisplayService,
False,
eventSymbol.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(eventSymbol, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(),
type.DelegateInvokeMethod.GetParameters().Select(Function(p) Convert(p, semanticModel, position, documentationCommentFormattingService)).ToList())
Return item
End Function
Private Shared Function GetPreambleParts(
eventSymbol As IEventSymbol,
semanticModel As SemanticModel,
position As Integer
) As IList(Of SymbolDisplayPart)
Dim result = New List(Of SymbolDisplayPart)()
result.AddRange(eventSymbol.ContainingType.ToMinimalDisplayParts(semanticModel, position))
result.Add(Punctuation(SyntaxKind.DotToken))
Dim format = MinimallyQualifiedWithoutParametersFormat
format = format.RemoveMemberOptions(SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType)
format = format.RemoveKindOptions(SymbolDisplayKindOptions.IncludeMemberKeyword)
result.AddRange(eventSymbol.ToMinimalDisplayParts(semanticModel, position, format))
result.Add(Punctuation(SyntaxKind.OpenParenToken))
Return result
End Function
Private Shared Function GetPostambleParts() As IList(Of SymbolDisplayPart)
Return {Punctuation(SyntaxKind.CloseParenToken)}
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/VisualBasic/Portable/Analysis/ForLoopVerification.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Class ForLoopVerification
''' <summary>
''' A BoundForLoopStatement node has a list of control variables (from the attached next statement).
''' When binding the control variable of a for/for each loop that is nested in another for/for each loop, it must be
''' checked that the control variable has not been used by a containing for/for each loop. Because bound nodes do not
''' know their parents and we try to avoid passing around a stack of variables, we just walk the bound tree after the
''' initial binding to report this error.
''' In addition, it must be checked that the control variables of the next statement match the loop. Because the inner
''' most loop contains the next with control variables from outer binders, checking this here is also convenient.
'''
''' There are two diagnostics reported by this walker:
''' 1. BC30069: For loop control variable '{0}' already in use by an enclosing For loop.
''' 2. BC30070: Next control variable does not match For loop control variable '{0}'.
''' </summary>
Public Shared Sub VerifyForLoops(block As BoundBlock, diagnostics As DiagnosticBag)
Try
Dim verifier As New ForLoopVerificationWalker(diagnostics)
verifier.Visit(block)
Catch ex As BoundTreeVisitor.CancelledByStackGuardException
ex.AddAnError(diagnostics)
End Try
End Sub
Private NotInheritable Class ForLoopVerificationWalker
Inherits BoundTreeWalkerWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
Private ReadOnly _diagnostics As DiagnosticBag
Private ReadOnly _controlVariables As Stack(Of BoundExpression)
Public Sub New(diagnostics As DiagnosticBag)
_diagnostics = diagnostics
_controlVariables = New Stack(Of BoundExpression)
End Sub
Public Overrides Function VisitForToStatement(node As BoundForToStatement) As BoundNode
PreVisitForAndForEachStatement(node)
MyBase.VisitForToStatement(node)
PostVisitForAndForEachStatement(node)
Return Nothing
End Function
Public Overrides Function VisitForEachStatement(node As BoundForEachStatement) As BoundNode
PreVisitForAndForEachStatement(node)
MyBase.VisitForEachStatement(node)
PostVisitForAndForEachStatement(node)
Return Nothing
End Function
''' <summary>
''' Checks if the control variable was already used in an enclosing for loop
''' </summary>
Private Sub PreVisitForAndForEachStatement(boundForStatement As BoundForStatement)
' check if the control variable is used previously in enclosing for loop blocks
' because the ExpressionSymbol is coming from the symbol declaration, the check cannot distinguish
' a member access to a field from different or the same instance.
' This is consistent with VB6 and Dev10.
Dim controlVariable = boundForStatement.ControlVariable
Dim controlVariableSymbol = ForLoopVerification.ReferencedSymbol(controlVariable)
Debug.Assert(controlVariableSymbol IsNot Nothing OrElse
controlVariable.Kind = BoundKind.BadExpression OrElse
controlVariable.HasErrors)
' Symbol may be Nothing for BadExpression.
If controlVariableSymbol IsNot Nothing Then
For Each boundVariable In _controlVariables
If ForLoopVerification.ReferencedSymbol(boundVariable) = controlVariableSymbol Then
_diagnostics.Add(ERRID.ERR_ForIndexInUse1,
controlVariable.Syntax.GetLocation(),
CustomSymbolDisplayFormatter.ShortErrorName(controlVariableSymbol))
Exit For
End If
Next
End If
_controlVariables.Push(controlVariable)
End Sub
''' <summary>
''' Checks if the control variables from the next statement match the control variable of the enclosing
''' for loop.
''' Some loops may contain a next with multiple variables.
''' </summary>
Private Sub PostVisitForAndForEachStatement(boundForStatement As BoundForStatement)
' do nothing if the array is nothing
If Not boundForStatement.NextVariablesOpt.IsDefault Then
' if it's empty we just have to adjust the index for one variable
If boundForStatement.NextVariablesOpt.IsEmpty Then
_controlVariables.Pop()
Else
For Each nextVariable In boundForStatement.NextVariablesOpt
' m_controlVariables will not contain too much or too few elements because
' 1. parser will fill up with missing next statements
' 2. binding will not bind spare control variables (see binding of next statement
' in BindForBlockParts)
Dim controlVariable = _controlVariables.Pop()
If Not controlVariable.HasErrors AndAlso
Not nextVariable.HasErrors AndAlso
ForLoopVerification.ReferencedSymbol(nextVariable) <> ForLoopVerification.ReferencedSymbol(controlVariable) Then
_diagnostics.Add(ERRID.ERR_NextForMismatch1,
nextVariable.Syntax.GetLocation(),
CustomSymbolDisplayFormatter.ShortErrorName(ForLoopVerification.ReferencedSymbol(controlVariable)))
End If
Next
End If
End If
End Sub
End Class
''' <summary>
''' Gets the referenced symbol of the bound expression.
''' Used for matching variables between For and Next statements.
''' </summary>
''' <param name="expression">The bound expression.</param>
Friend Shared Function ReferencedSymbol(expression As BoundExpression) As Symbol
Select Case expression.Kind
Case BoundKind.ArrayAccess
Return ReferencedSymbol(DirectCast(expression, BoundArrayAccess).Expression)
Case BoundKind.PropertyAccess
Return DirectCast(expression, BoundPropertyAccess).PropertySymbol
Case BoundKind.Call
Return DirectCast(expression, BoundCall).Method
Case BoundKind.Local
Return DirectCast(expression, BoundLocal).LocalSymbol
Case BoundKind.RangeVariable
Return DirectCast(expression, BoundRangeVariable).RangeVariable
Case BoundKind.FieldAccess
Return DirectCast(expression, BoundFieldAccess).FieldSymbol
Case BoundKind.Parameter
Return DirectCast(expression, BoundParameter).ParameterSymbol
Case BoundKind.Parenthesized
Return ReferencedSymbol(DirectCast(expression, BoundParenthesized).Expression)
End Select
Return Nothing
End Function
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Class ForLoopVerification
''' <summary>
''' A BoundForLoopStatement node has a list of control variables (from the attached next statement).
''' When binding the control variable of a for/for each loop that is nested in another for/for each loop, it must be
''' checked that the control variable has not been used by a containing for/for each loop. Because bound nodes do not
''' know their parents and we try to avoid passing around a stack of variables, we just walk the bound tree after the
''' initial binding to report this error.
''' In addition, it must be checked that the control variables of the next statement match the loop. Because the inner
''' most loop contains the next with control variables from outer binders, checking this here is also convenient.
'''
''' There are two diagnostics reported by this walker:
''' 1. BC30069: For loop control variable '{0}' already in use by an enclosing For loop.
''' 2. BC30070: Next control variable does not match For loop control variable '{0}'.
''' </summary>
Public Shared Sub VerifyForLoops(block As BoundBlock, diagnostics As DiagnosticBag)
Try
Dim verifier As New ForLoopVerificationWalker(diagnostics)
verifier.Visit(block)
Catch ex As BoundTreeVisitor.CancelledByStackGuardException
ex.AddAnError(diagnostics)
End Try
End Sub
Private NotInheritable Class ForLoopVerificationWalker
Inherits BoundTreeWalkerWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
Private ReadOnly _diagnostics As DiagnosticBag
Private ReadOnly _controlVariables As Stack(Of BoundExpression)
Public Sub New(diagnostics As DiagnosticBag)
_diagnostics = diagnostics
_controlVariables = New Stack(Of BoundExpression)
End Sub
Public Overrides Function VisitForToStatement(node As BoundForToStatement) As BoundNode
PreVisitForAndForEachStatement(node)
MyBase.VisitForToStatement(node)
PostVisitForAndForEachStatement(node)
Return Nothing
End Function
Public Overrides Function VisitForEachStatement(node As BoundForEachStatement) As BoundNode
PreVisitForAndForEachStatement(node)
MyBase.VisitForEachStatement(node)
PostVisitForAndForEachStatement(node)
Return Nothing
End Function
''' <summary>
''' Checks if the control variable was already used in an enclosing for loop
''' </summary>
Private Sub PreVisitForAndForEachStatement(boundForStatement As BoundForStatement)
' check if the control variable is used previously in enclosing for loop blocks
' because the ExpressionSymbol is coming from the symbol declaration, the check cannot distinguish
' a member access to a field from different or the same instance.
' This is consistent with VB6 and Dev10.
Dim controlVariable = boundForStatement.ControlVariable
Dim controlVariableSymbol = ForLoopVerification.ReferencedSymbol(controlVariable)
Debug.Assert(controlVariableSymbol IsNot Nothing OrElse
controlVariable.Kind = BoundKind.BadExpression OrElse
controlVariable.HasErrors)
' Symbol may be Nothing for BadExpression.
If controlVariableSymbol IsNot Nothing Then
For Each boundVariable In _controlVariables
If ForLoopVerification.ReferencedSymbol(boundVariable) = controlVariableSymbol Then
_diagnostics.Add(ERRID.ERR_ForIndexInUse1,
controlVariable.Syntax.GetLocation(),
CustomSymbolDisplayFormatter.ShortErrorName(controlVariableSymbol))
Exit For
End If
Next
End If
_controlVariables.Push(controlVariable)
End Sub
''' <summary>
''' Checks if the control variables from the next statement match the control variable of the enclosing
''' for loop.
''' Some loops may contain a next with multiple variables.
''' </summary>
Private Sub PostVisitForAndForEachStatement(boundForStatement As BoundForStatement)
' do nothing if the array is nothing
If Not boundForStatement.NextVariablesOpt.IsDefault Then
' if it's empty we just have to adjust the index for one variable
If boundForStatement.NextVariablesOpt.IsEmpty Then
_controlVariables.Pop()
Else
For Each nextVariable In boundForStatement.NextVariablesOpt
' m_controlVariables will not contain too much or too few elements because
' 1. parser will fill up with missing next statements
' 2. binding will not bind spare control variables (see binding of next statement
' in BindForBlockParts)
Dim controlVariable = _controlVariables.Pop()
If Not controlVariable.HasErrors AndAlso
Not nextVariable.HasErrors AndAlso
ForLoopVerification.ReferencedSymbol(nextVariable) <> ForLoopVerification.ReferencedSymbol(controlVariable) Then
_diagnostics.Add(ERRID.ERR_NextForMismatch1,
nextVariable.Syntax.GetLocation(),
CustomSymbolDisplayFormatter.ShortErrorName(ForLoopVerification.ReferencedSymbol(controlVariable)))
End If
Next
End If
End If
End Sub
End Class
''' <summary>
''' Gets the referenced symbol of the bound expression.
''' Used for matching variables between For and Next statements.
''' </summary>
''' <param name="expression">The bound expression.</param>
Friend Shared Function ReferencedSymbol(expression As BoundExpression) As Symbol
Select Case expression.Kind
Case BoundKind.ArrayAccess
Return ReferencedSymbol(DirectCast(expression, BoundArrayAccess).Expression)
Case BoundKind.PropertyAccess
Return DirectCast(expression, BoundPropertyAccess).PropertySymbol
Case BoundKind.Call
Return DirectCast(expression, BoundCall).Method
Case BoundKind.Local
Return DirectCast(expression, BoundLocal).LocalSymbol
Case BoundKind.RangeVariable
Return DirectCast(expression, BoundRangeVariable).RangeVariable
Case BoundKind.FieldAccess
Return DirectCast(expression, BoundFieldAccess).FieldSymbol
Case BoundKind.Parameter
Return DirectCast(expression, BoundParameter).ParameterSymbol
Case BoundKind.Parenthesized
Return ReferencedSymbol(DirectCast(expression, BoundParenthesized).Expression)
End Select
Return Nothing
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/Core/Portable/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
using KnownTypes = Microsoft.CodeAnalysis.MakeMethodAsynchronous.AbstractMakeMethodAsynchronousCodeFixProvider.KnownTypes;
namespace Microsoft.CodeAnalysis.RemoveAsyncModifier
{
internal abstract class AbstractRemoveAsyncModifierCodeFixProvider<TReturnStatementSyntax, TExpressionSyntax> : SyntaxEditorBasedCodeFixProvider
where TReturnStatementSyntax : SyntaxNode
where TExpressionSyntax : SyntaxNode
{
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile;
protected abstract bool IsAsyncSupportingFunctionSyntax(SyntaxNode node);
protected abstract SyntaxNode RemoveAsyncModifier(SyntaxGenerator generator, SyntaxNode methodLikeNode);
protected abstract SyntaxNode? ConvertToBlockBody(SyntaxNode node, TExpressionSyntax expressionBody);
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var cancellationToken = context.CancellationToken;
var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var knownTypes = new KnownTypes(compilation);
var diagnostic = context.Diagnostics.First();
var token = diagnostic.Location.FindToken(cancellationToken);
var node = token.GetAncestor(IsAsyncSupportingFunctionSyntax);
if (node == null)
{
return;
}
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken);
if (methodSymbol == null)
{
return;
}
if (ShouldOfferFix(methodSymbol.ReturnType, knownTypes))
{
context.RegisterCodeFix(
new MyCodeAction(c => FixAsync(document, diagnostic, c)),
context.Diagnostics);
}
}
protected sealed override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
var generator = editor.Generator;
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var compilation = semanticModel.Compilation;
var knownTypes = new KnownTypes(compilation);
// For fix all we need to do nested locals or lambdas first, so order the diagnostics by location descending
foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
{
var token = diagnostic.Location.FindToken(cancellationToken);
var node = token.GetAncestor(IsAsyncSupportingFunctionSyntax);
if (node == null)
{
Debug.Fail("We should always be able to find the node from the diagnostic.");
continue;
}
var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken);
if (methodSymbol == null)
{
Debug.Fail("We should always be able to find the method symbol for the diagnostic.");
continue;
}
// We might need to perform control flow analysis as part of the fix, so we need to do it on the original node
// so do it up front. Nothing in the fixer changes the reachability of the end of the method so this is safe
var controlFlow = GetControlFlowAnalysis(generator, semanticModel, node);
// If control flow couldn't be computed then its probably an empty block, which means we need to add a return anyway
var needsReturnStatementAdded = controlFlow == null || controlFlow.EndPointIsReachable;
editor.ReplaceNode(node,
(updatedNode, generator) => RemoveAsyncModifier(generator, updatedNode, methodSymbol.ReturnType, knownTypes, needsReturnStatementAdded));
}
}
private static IMethodSymbol? GetMethodSymbol(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
=> semanticModel.GetSymbolInfo(node, cancellationToken).Symbol as IMethodSymbol ??
semanticModel.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
private static bool ShouldOfferFix(ITypeSymbol returnType, KnownTypes knownTypes)
=> IsTaskType(returnType, knownTypes)
|| returnType.OriginalDefinition.Equals(knownTypes._taskOfTType)
|| returnType.OriginalDefinition.Equals(knownTypes._valueTaskOfTTypeOpt);
private static bool IsTaskType(ITypeSymbol returnType, KnownTypes knownTypes)
=> returnType.OriginalDefinition.Equals(knownTypes._taskType)
|| returnType.OriginalDefinition.Equals(knownTypes._valueTaskType);
private SyntaxNode RemoveAsyncModifier(SyntaxGenerator generator, SyntaxNode node, ITypeSymbol returnType, KnownTypes knownTypes, bool needsReturnStatementAdded)
{
node = RemoveAsyncModifier(generator, node);
var expression = generator.GetExpression(node);
if (expression is TExpressionSyntax expressionBody)
{
if (IsTaskType(returnType, knownTypes))
{
// We need to add a `return Task.CompletedTask;` so we have to convert to a block body
var blockBodiedNode = ConvertToBlockBody(node, expressionBody);
// Expression bodied members can't have return statements so if we can't convert to a block
// body then we've done all we can
if (blockBodiedNode != null)
{
node = AddReturnStatement(generator, blockBodiedNode);
}
}
else
{
// For Task<T> returning expression bodied methods we can just wrap the whole expression
var newExpressionBody = WrapExpressionWithTaskFromResult(generator, expressionBody, returnType, knownTypes);
node = generator.WithExpression(node, newExpressionBody);
}
}
else
{
if (IsTaskType(returnType, knownTypes))
{
// If the end of the method isn't reachable, or there were no statements to analyze, then we
// need to add an explicit return
if (needsReturnStatementAdded)
{
node = AddReturnStatement(generator, node);
}
}
}
node = ChangeReturnStatements(generator, node, returnType, knownTypes);
return node;
}
private static ControlFlowAnalysis? GetControlFlowAnalysis(SyntaxGenerator generator, SemanticModel semanticModel, SyntaxNode node)
{
var statements = generator.GetStatements(node);
if (statements.Count > 0)
{
return semanticModel.AnalyzeControlFlow(statements[0], statements[statements.Count - 1]);
}
return null;
}
private static SyntaxNode AddReturnStatement(SyntaxGenerator generator, SyntaxNode node)
=> generator.WithStatements(node, generator.GetStatements(node).Concat(generator.ReturnStatement()));
private SyntaxNode ChangeReturnStatements(SyntaxGenerator generator, SyntaxNode node, ITypeSymbol returnType, KnownTypes knownTypes)
{
var editor = new SyntaxEditor(node, generator);
// Look for all return statements, but if we find a new node that can have the async modifier we stop
// because that will have its own diagnostic and fix, if applicable
var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n)).OfType<TReturnStatementSyntax>();
foreach (var returnSyntax in returns)
{
var returnExpression = generator.SyntaxFacts.GetExpressionOfReturnStatement(returnSyntax);
if (returnExpression is null)
{
// Convert return; into return Task.CompletedTask;
var returnTaskCompletedTask = GetReturnTaskCompletedTaskStatement(generator, returnType, knownTypes);
editor.ReplaceNode(returnSyntax, returnTaskCompletedTask);
}
else
{
// Convert return <expr>; into return Task.FromResult(<expr>);
var newExpression = WrapExpressionWithTaskFromResult(generator, returnExpression, returnType, knownTypes);
editor.ReplaceNode(returnExpression, newExpression);
}
}
return editor.GetChangedRoot();
}
private static SyntaxNode GetReturnTaskCompletedTaskStatement(SyntaxGenerator generator, ITypeSymbol returnType, KnownTypes knownTypes)
{
SyntaxNode invocation;
if (returnType.OriginalDefinition.Equals(knownTypes._taskType))
{
var taskTypeExpression = TypeExpressionForStaticMemberAccess(generator, knownTypes._taskType);
invocation = generator.MemberAccessExpression(taskTypeExpression, nameof(Task.CompletedTask));
}
else
{
invocation = generator.ObjectCreationExpression(knownTypes._valueTaskType);
}
var statement = generator.ReturnStatement(invocation);
return statement;
}
private static SyntaxNode WrapExpressionWithTaskFromResult(SyntaxGenerator generator, SyntaxNode expression, ITypeSymbol returnType, KnownTypes knownTypes)
{
if (returnType.OriginalDefinition.Equals(knownTypes._taskOfTType))
{
var taskTypeExpression = TypeExpressionForStaticMemberAccess(generator, knownTypes._taskType);
var taskFromResult = generator.MemberAccessExpression(taskTypeExpression, nameof(Task.FromResult));
return generator.InvocationExpression(taskFromResult, expression.WithoutTrivia()).WithTriviaFrom(expression);
}
else
{
return generator.ObjectCreationExpression(returnType, expression);
}
}
// Workaround for https://github.com/dotnet/roslyn/issues/43950
// Copied from https://github.com/dotnet/roslyn-analyzers/blob/f24a5b42c85be6ee572f3a93bef223767fbefd75/src/Utilities/Workspaces/SyntaxGeneratorExtensions.cs#L68-L74
private static SyntaxNode TypeExpressionForStaticMemberAccess(SyntaxGenerator generator, INamedTypeSymbol typeSymbol)
{
var qualifiedNameSyntaxKind = generator.QualifiedName(generator.IdentifierName("ignored"), generator.IdentifierName("ignored")).RawKind;
var memberAccessExpressionSyntaxKind = generator.MemberAccessExpression(generator.IdentifierName("ignored"), "ignored").RawKind;
var typeExpression = generator.TypeExpression(typeSymbol);
return QualifiedNameToMemberAccess(qualifiedNameSyntaxKind, memberAccessExpressionSyntaxKind, typeExpression, generator);
// Local function
static SyntaxNode QualifiedNameToMemberAccess(int qualifiedNameSyntaxKind, int memberAccessExpressionSyntaxKind, SyntaxNode expression, SyntaxGenerator generator)
{
if (expression.RawKind == qualifiedNameSyntaxKind)
{
var left = QualifiedNameToMemberAccess(qualifiedNameSyntaxKind, memberAccessExpressionSyntaxKind, expression.ChildNodes().First(), generator);
var right = expression.ChildNodes().Last();
return generator.MemberAccessExpression(left, right);
}
return expression;
}
}
private class MyCodeAction : CodeAction.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(FeaturesResources.Remove_async_modifier, createChangedDocument, FeaturesResources.Remove_async_modifier)
{
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
using KnownTypes = Microsoft.CodeAnalysis.MakeMethodAsynchronous.AbstractMakeMethodAsynchronousCodeFixProvider.KnownTypes;
namespace Microsoft.CodeAnalysis.RemoveAsyncModifier
{
internal abstract class AbstractRemoveAsyncModifierCodeFixProvider<TReturnStatementSyntax, TExpressionSyntax> : SyntaxEditorBasedCodeFixProvider
where TReturnStatementSyntax : SyntaxNode
where TExpressionSyntax : SyntaxNode
{
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile;
protected abstract bool IsAsyncSupportingFunctionSyntax(SyntaxNode node);
protected abstract SyntaxNode RemoveAsyncModifier(SyntaxGenerator generator, SyntaxNode methodLikeNode);
protected abstract SyntaxNode? ConvertToBlockBody(SyntaxNode node, TExpressionSyntax expressionBody);
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var cancellationToken = context.CancellationToken;
var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var knownTypes = new KnownTypes(compilation);
var diagnostic = context.Diagnostics.First();
var token = diagnostic.Location.FindToken(cancellationToken);
var node = token.GetAncestor(IsAsyncSupportingFunctionSyntax);
if (node == null)
{
return;
}
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken);
if (methodSymbol == null)
{
return;
}
if (ShouldOfferFix(methodSymbol.ReturnType, knownTypes))
{
context.RegisterCodeFix(
new MyCodeAction(c => FixAsync(document, diagnostic, c)),
context.Diagnostics);
}
}
protected sealed override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
var generator = editor.Generator;
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var compilation = semanticModel.Compilation;
var knownTypes = new KnownTypes(compilation);
// For fix all we need to do nested locals or lambdas first, so order the diagnostics by location descending
foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
{
var token = diagnostic.Location.FindToken(cancellationToken);
var node = token.GetAncestor(IsAsyncSupportingFunctionSyntax);
if (node == null)
{
Debug.Fail("We should always be able to find the node from the diagnostic.");
continue;
}
var methodSymbol = GetMethodSymbol(node, semanticModel, cancellationToken);
if (methodSymbol == null)
{
Debug.Fail("We should always be able to find the method symbol for the diagnostic.");
continue;
}
// We might need to perform control flow analysis as part of the fix, so we need to do it on the original node
// so do it up front. Nothing in the fixer changes the reachability of the end of the method so this is safe
var controlFlow = GetControlFlowAnalysis(generator, semanticModel, node);
// If control flow couldn't be computed then its probably an empty block, which means we need to add a return anyway
var needsReturnStatementAdded = controlFlow == null || controlFlow.EndPointIsReachable;
editor.ReplaceNode(node,
(updatedNode, generator) => RemoveAsyncModifier(generator, updatedNode, methodSymbol.ReturnType, knownTypes, needsReturnStatementAdded));
}
}
private static IMethodSymbol? GetMethodSymbol(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
=> semanticModel.GetSymbolInfo(node, cancellationToken).Symbol as IMethodSymbol ??
semanticModel.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
private static bool ShouldOfferFix(ITypeSymbol returnType, KnownTypes knownTypes)
=> IsTaskType(returnType, knownTypes)
|| returnType.OriginalDefinition.Equals(knownTypes._taskOfTType)
|| returnType.OriginalDefinition.Equals(knownTypes._valueTaskOfTTypeOpt);
private static bool IsTaskType(ITypeSymbol returnType, KnownTypes knownTypes)
=> returnType.OriginalDefinition.Equals(knownTypes._taskType)
|| returnType.OriginalDefinition.Equals(knownTypes._valueTaskType);
private SyntaxNode RemoveAsyncModifier(SyntaxGenerator generator, SyntaxNode node, ITypeSymbol returnType, KnownTypes knownTypes, bool needsReturnStatementAdded)
{
node = RemoveAsyncModifier(generator, node);
var expression = generator.GetExpression(node);
if (expression is TExpressionSyntax expressionBody)
{
if (IsTaskType(returnType, knownTypes))
{
// We need to add a `return Task.CompletedTask;` so we have to convert to a block body
var blockBodiedNode = ConvertToBlockBody(node, expressionBody);
// Expression bodied members can't have return statements so if we can't convert to a block
// body then we've done all we can
if (blockBodiedNode != null)
{
node = AddReturnStatement(generator, blockBodiedNode);
}
}
else
{
// For Task<T> returning expression bodied methods we can just wrap the whole expression
var newExpressionBody = WrapExpressionWithTaskFromResult(generator, expressionBody, returnType, knownTypes);
node = generator.WithExpression(node, newExpressionBody);
}
}
else
{
if (IsTaskType(returnType, knownTypes))
{
// If the end of the method isn't reachable, or there were no statements to analyze, then we
// need to add an explicit return
if (needsReturnStatementAdded)
{
node = AddReturnStatement(generator, node);
}
}
}
node = ChangeReturnStatements(generator, node, returnType, knownTypes);
return node;
}
private static ControlFlowAnalysis? GetControlFlowAnalysis(SyntaxGenerator generator, SemanticModel semanticModel, SyntaxNode node)
{
var statements = generator.GetStatements(node);
if (statements.Count > 0)
{
return semanticModel.AnalyzeControlFlow(statements[0], statements[statements.Count - 1]);
}
return null;
}
private static SyntaxNode AddReturnStatement(SyntaxGenerator generator, SyntaxNode node)
=> generator.WithStatements(node, generator.GetStatements(node).Concat(generator.ReturnStatement()));
private SyntaxNode ChangeReturnStatements(SyntaxGenerator generator, SyntaxNode node, ITypeSymbol returnType, KnownTypes knownTypes)
{
var editor = new SyntaxEditor(node, generator);
// Look for all return statements, but if we find a new node that can have the async modifier we stop
// because that will have its own diagnostic and fix, if applicable
var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n)).OfType<TReturnStatementSyntax>();
foreach (var returnSyntax in returns)
{
var returnExpression = generator.SyntaxFacts.GetExpressionOfReturnStatement(returnSyntax);
if (returnExpression is null)
{
// Convert return; into return Task.CompletedTask;
var returnTaskCompletedTask = GetReturnTaskCompletedTaskStatement(generator, returnType, knownTypes);
editor.ReplaceNode(returnSyntax, returnTaskCompletedTask);
}
else
{
// Convert return <expr>; into return Task.FromResult(<expr>);
var newExpression = WrapExpressionWithTaskFromResult(generator, returnExpression, returnType, knownTypes);
editor.ReplaceNode(returnExpression, newExpression);
}
}
return editor.GetChangedRoot();
}
private static SyntaxNode GetReturnTaskCompletedTaskStatement(SyntaxGenerator generator, ITypeSymbol returnType, KnownTypes knownTypes)
{
SyntaxNode invocation;
if (returnType.OriginalDefinition.Equals(knownTypes._taskType))
{
var taskTypeExpression = TypeExpressionForStaticMemberAccess(generator, knownTypes._taskType);
invocation = generator.MemberAccessExpression(taskTypeExpression, nameof(Task.CompletedTask));
}
else
{
invocation = generator.ObjectCreationExpression(knownTypes._valueTaskType);
}
var statement = generator.ReturnStatement(invocation);
return statement;
}
private static SyntaxNode WrapExpressionWithTaskFromResult(SyntaxGenerator generator, SyntaxNode expression, ITypeSymbol returnType, KnownTypes knownTypes)
{
if (returnType.OriginalDefinition.Equals(knownTypes._taskOfTType))
{
var taskTypeExpression = TypeExpressionForStaticMemberAccess(generator, knownTypes._taskType);
var taskFromResult = generator.MemberAccessExpression(taskTypeExpression, nameof(Task.FromResult));
return generator.InvocationExpression(taskFromResult, expression.WithoutTrivia()).WithTriviaFrom(expression);
}
else
{
return generator.ObjectCreationExpression(returnType, expression);
}
}
// Workaround for https://github.com/dotnet/roslyn/issues/43950
// Copied from https://github.com/dotnet/roslyn-analyzers/blob/f24a5b42c85be6ee572f3a93bef223767fbefd75/src/Utilities/Workspaces/SyntaxGeneratorExtensions.cs#L68-L74
private static SyntaxNode TypeExpressionForStaticMemberAccess(SyntaxGenerator generator, INamedTypeSymbol typeSymbol)
{
var qualifiedNameSyntaxKind = generator.QualifiedName(generator.IdentifierName("ignored"), generator.IdentifierName("ignored")).RawKind;
var memberAccessExpressionSyntaxKind = generator.MemberAccessExpression(generator.IdentifierName("ignored"), "ignored").RawKind;
var typeExpression = generator.TypeExpression(typeSymbol);
return QualifiedNameToMemberAccess(qualifiedNameSyntaxKind, memberAccessExpressionSyntaxKind, typeExpression, generator);
// Local function
static SyntaxNode QualifiedNameToMemberAccess(int qualifiedNameSyntaxKind, int memberAccessExpressionSyntaxKind, SyntaxNode expression, SyntaxGenerator generator)
{
if (expression.RawKind == qualifiedNameSyntaxKind)
{
var left = QualifiedNameToMemberAccess(qualifiedNameSyntaxKind, memberAccessExpressionSyntaxKind, expression.ChildNodes().First(), generator);
var right = expression.ChildNodes().Last();
return generator.MemberAccessExpression(left, right);
}
return expression;
}
}
private class MyCodeAction : CodeAction.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(FeaturesResources.Remove_async_modifier, createChangedDocument, FeaturesResources.Remove_async_modifier)
{
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/CSharpTest/ImplementInterface/ImplementExplicitlyTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp.ImplementInterface;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ImplementInterface
{
public class ImplementExplicitlyTests : AbstractCSharpCodeActionTest
{
private const int SingleMember = 0;
private const int SameInterface = 1;
private const int AllInterfaces = 2;
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters)
=> new CSharpImplementExplicitlyCodeRefactoringProvider();
protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
=> FlattenActions(actions);
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestSingleMember()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
public void [||]Goo1() { }
public void Goo2() { }
public void Bar() { }
}",
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
void IGoo.Goo1() { }
public void Goo2() { }
public void Bar() { }
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestSameInterface()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
public void [||]Goo1() { }
public void Goo2() { }
public void Bar() { }
}",
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
void IGoo.Goo1() { }
void IGoo.Goo2() { }
public void Bar() { }
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestAllInterfaces()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
public void [||]Goo1() { }
public void Goo2() { }
public void Bar() { }
}",
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
void IGoo.Goo1() { }
void IGoo.Goo2() { }
void IBar.Bar() { }
}", index: AllInterfaces);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestProperty()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { int Goo1 { get; } }
class C : IGoo
{
public int [||]Goo1 { get { } }
}",
@"
interface IGoo { int Goo1 { get; } }
class C : IGoo
{
int IGoo.Goo1 { get { } }
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestEvent()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { event Action E; }
class C : IGoo
{
public event Action [||]E { add { } remove { } }
}",
@"
interface IGoo { event Action E; }
class C : IGoo
{
event Action IGoo.E { add { } remove { } }
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestNotOnExplicitMember()
{
await TestMissingAsync(
@"
interface IGoo { void Goo1(); }
class C : IGoo
{
void IGoo.[||]Goo1() { }
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestNotOnUnboundImplicitImpl()
{
await TestMissingAsync(
@"
interface IGoo { void Goo1(); }
class C
{
public void [||]Goo1() { }
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InsideDeclarations_Explicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { return this.Prop; } set { this.Prop = value; } }
public int M(int i) { return this.M(i); }
public event Action Ev { add { this.Ev += value; } remove { this.Ev -= value; } }
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { return ((IGoo)this).Prop; } set { ((IGoo)this).Prop = value; } }
int IGoo.M(int i) { return ((IGoo)this).M(i); }
event Action IGoo.Ev { add { ((IGoo)this).Ev += value; } remove { ((IGoo)this).Ev -= value; } }
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InsideDeclarations_Implicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { return Prop; } set { Prop = value; } }
public int M(int i) { return M(i); }
public event Action Ev { add { Ev += value; } remove { Ev -= value; } }
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { return ((IGoo)this).Prop; } set { ((IGoo)this).Prop = value; } }
int IGoo.M(int i) { return ((IGoo)this).M(i); }
event Action IGoo.Ev { add { ((IGoo)this).Ev += value; } remove { ((IGoo)this).Ev -= value; } }
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InternalImplicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
void InternalImplicit()
{
var v = Prop;
Prop = 1;
Prop++;
++Prop;
M(0);
M(M(0));
Ev += () => {};
var v1 = nameof(Prop);
}
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
void InternalImplicit()
{
var v = ((IGoo)this).Prop;
((IGoo)this).Prop = 1;
((IGoo)this).Prop++;
++((IGoo)this).Prop;
((IGoo)this).M(0);
((IGoo)this).M(((IGoo)this).M(0));
((IGoo)this).Ev += () => {};
var v1 = nameof(((IGoo)this).Prop);
}
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InternalExplicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
void InternalExplicit()
{
var v = this.Prop;
this.Prop = 1;
this.Prop++;
++this.Prop;
this.M(0);
this.M(this.M(0));
this.Ev += () => {};
var v1 = nameof(this.Prop);
}
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
void InternalExplicit()
{
var v = ((IGoo)this).Prop;
((IGoo)this).Prop = 1;
((IGoo)this).Prop++;
++((IGoo)this).Prop;
((IGoo)this).M(0);
((IGoo)this).M(((IGoo)this).M(0));
((IGoo)this).Ev += () => {};
var v1 = nameof(((IGoo)this).Prop);
}
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_External()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
}
class T
{
void External(C c)
{
var v = c.Prop;
c.Prop = 1;
c.Prop++;
++c.Prop;
c.M(0);
c.M(c.M(0));
c.Ev += () => {};
new C
{
Prop = 1
};
var v1 = nameof(c.Prop);
}
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
}
class T
{
void External(C c)
{
var v = ((IGoo)c).Prop;
((IGoo)c).Prop = 1;
((IGoo)c).Prop++;
++((IGoo)c).Prop;
((IGoo)c).M(0);
((IGoo)c).M(((IGoo)c).M(0));
((IGoo)c).Ev += () => {};
new C
{
Prop = 1
};
var v1 = nameof(((IGoo)c).Prop);
}
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_CrossLanguage()
{
await TestInRegularAndScriptAsync(
@"
<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""A1"">
<Document FilePath=""File.cs"">
using System;
public interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
public class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
}
</Document>
</Project>
<Project Language=""Visual Basic"" CommonReferences=""true"" AssemblyName=""A2"">
<ProjectReference>A1</ProjectReference>
<Document>
class T
sub External(c1 as C)
dim v = c1.Prop
c1.Prop = 1
c1.M(0)
c1.M(c1.M(0))
dim x = new C() with {
.Prop = 1
}
dim v1 = nameof(c1.Prop)
end sub
end class
</Document>
</Project>
</Workspace>
",
@"
<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""A1"">
<Document FilePath=""File.cs"">
using System;
public interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
public class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
}
</Document>
</Project>
<Project Language=""Visual Basic"" CommonReferences=""true"" AssemblyName=""A2"">
<ProjectReference>A1</ProjectReference>
<Document>
class T
sub External(c1 as C)
dim v = DirectCast(c1, IGoo).Prop
DirectCast(c1, IGoo).Prop = 1
DirectCast(c1, IGoo).M(0)
DirectCast(c1, IGoo).M(DirectCast(c1, IGoo).M(0))
dim x = new C() with {
.Prop = 1
}
dim v1 = nameof(c1.Prop)
end sub
end class
</Document>
</Project>
</Workspace>
", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestMemberWhichImplementsMultipleMembers()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
public int [||]M(int i)
{
throw new System.Exception();
}
}",
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
int IGoo.M(int i)
{
throw new System.Exception();
}
int IBar.M(int i)
{
throw new System.Exception();
}
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestMemberWhichImplementsMultipleMembers2()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
public int [||]M(int i)
{
return this.M(1);
}
}",
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
int IGoo.M(int i)
{
return ((IGoo)this).M(1);
}
int IBar.M(int i)
{
return ((IGoo)this).M(1);
}
}", index: SingleMember);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp.ImplementInterface;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ImplementInterface
{
public class ImplementExplicitlyTests : AbstractCSharpCodeActionTest
{
private const int SingleMember = 0;
private const int SameInterface = 1;
private const int AllInterfaces = 2;
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters)
=> new CSharpImplementExplicitlyCodeRefactoringProvider();
protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
=> FlattenActions(actions);
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestSingleMember()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
public void [||]Goo1() { }
public void Goo2() { }
public void Bar() { }
}",
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
void IGoo.Goo1() { }
public void Goo2() { }
public void Bar() { }
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestSameInterface()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
public void [||]Goo1() { }
public void Goo2() { }
public void Bar() { }
}",
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
void IGoo.Goo1() { }
void IGoo.Goo2() { }
public void Bar() { }
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestAllInterfaces()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
public void [||]Goo1() { }
public void Goo2() { }
public void Bar() { }
}",
@"
interface IGoo { void Goo1(); void Goo2(); }
interface IBar { void Bar(); }
class C : IGoo, IBar
{
void IGoo.Goo1() { }
void IGoo.Goo2() { }
void IBar.Bar() { }
}", index: AllInterfaces);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestProperty()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { int Goo1 { get; } }
class C : IGoo
{
public int [||]Goo1 { get { } }
}",
@"
interface IGoo { int Goo1 { get; } }
class C : IGoo
{
int IGoo.Goo1 { get { } }
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestEvent()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { event Action E; }
class C : IGoo
{
public event Action [||]E { add { } remove { } }
}",
@"
interface IGoo { event Action E; }
class C : IGoo
{
event Action IGoo.E { add { } remove { } }
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestNotOnExplicitMember()
{
await TestMissingAsync(
@"
interface IGoo { void Goo1(); }
class C : IGoo
{
void IGoo.[||]Goo1() { }
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestNotOnUnboundImplicitImpl()
{
await TestMissingAsync(
@"
interface IGoo { void Goo1(); }
class C
{
public void [||]Goo1() { }
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InsideDeclarations_Explicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { return this.Prop; } set { this.Prop = value; } }
public int M(int i) { return this.M(i); }
public event Action Ev { add { this.Ev += value; } remove { this.Ev -= value; } }
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { return ((IGoo)this).Prop; } set { ((IGoo)this).Prop = value; } }
int IGoo.M(int i) { return ((IGoo)this).M(i); }
event Action IGoo.Ev { add { ((IGoo)this).Ev += value; } remove { ((IGoo)this).Ev -= value; } }
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InsideDeclarations_Implicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { return Prop; } set { Prop = value; } }
public int M(int i) { return M(i); }
public event Action Ev { add { Ev += value; } remove { Ev -= value; } }
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { return ((IGoo)this).Prop; } set { ((IGoo)this).Prop = value; } }
int IGoo.M(int i) { return ((IGoo)this).M(i); }
event Action IGoo.Ev { add { ((IGoo)this).Ev += value; } remove { ((IGoo)this).Ev -= value; } }
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InternalImplicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
void InternalImplicit()
{
var v = Prop;
Prop = 1;
Prop++;
++Prop;
M(0);
M(M(0));
Ev += () => {};
var v1 = nameof(Prop);
}
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
void InternalImplicit()
{
var v = ((IGoo)this).Prop;
((IGoo)this).Prop = 1;
((IGoo)this).Prop++;
++((IGoo)this).Prop;
((IGoo)this).M(0);
((IGoo)this).M(((IGoo)this).M(0));
((IGoo)this).Ev += () => {};
var v1 = nameof(((IGoo)this).Prop);
}
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_InternalExplicit()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
void InternalExplicit()
{
var v = this.Prop;
this.Prop = 1;
this.Prop++;
++this.Prop;
this.M(0);
this.M(this.M(0));
this.Ev += () => {};
var v1 = nameof(this.Prop);
}
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
void InternalExplicit()
{
var v = ((IGoo)this).Prop;
((IGoo)this).Prop = 1;
((IGoo)this).Prop++;
++((IGoo)this).Prop;
((IGoo)this).M(0);
((IGoo)this).M(((IGoo)this).M(0));
((IGoo)this).Ev += () => {};
var v1 = nameof(((IGoo)this).Prop);
}
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_External()
{
await TestInRegularAndScriptAsync(
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
}
class T
{
void External(C c)
{
var v = c.Prop;
c.Prop = 1;
c.Prop++;
++c.Prop;
c.M(0);
c.M(c.M(0));
c.Ev += () => {};
new C
{
Prop = 1
};
var v1 = nameof(c.Prop);
}
}",
@"
using System;
interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
}
class T
{
void External(C c)
{
var v = ((IGoo)c).Prop;
((IGoo)c).Prop = 1;
((IGoo)c).Prop++;
++((IGoo)c).Prop;
((IGoo)c).M(0);
((IGoo)c).M(((IGoo)c).M(0));
((IGoo)c).Ev += () => {};
new C
{
Prop = 1
};
var v1 = nameof(((IGoo)c).Prop);
}
}", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestUpdateReferences_CrossLanguage()
{
await TestInRegularAndScriptAsync(
@"
<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""A1"">
<Document FilePath=""File.cs"">
using System;
public interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
public class C : IGoo
{
public int [||]Prop { get { } set { } }
public int M(int i) { }
public event Action Ev { add { } remove { } }
}
</Document>
</Project>
<Project Language=""Visual Basic"" CommonReferences=""true"" AssemblyName=""A2"">
<ProjectReference>A1</ProjectReference>
<Document>
class T
sub External(c1 as C)
dim v = c1.Prop
c1.Prop = 1
c1.M(0)
c1.M(c1.M(0))
dim x = new C() with {
.Prop = 1
}
dim v1 = nameof(c1.Prop)
end sub
end class
</Document>
</Project>
</Workspace>
",
@"
<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""A1"">
<Document FilePath=""File.cs"">
using System;
public interface IGoo { int Prop { get; set; } int M(int i); event Action Ev; }
public class C : IGoo
{
int IGoo.Prop { get { } set { } }
int IGoo.M(int i) { }
event Action IGoo.Ev { add { } remove { } }
}
</Document>
</Project>
<Project Language=""Visual Basic"" CommonReferences=""true"" AssemblyName=""A2"">
<ProjectReference>A1</ProjectReference>
<Document>
class T
sub External(c1 as C)
dim v = DirectCast(c1, IGoo).Prop
DirectCast(c1, IGoo).Prop = 1
DirectCast(c1, IGoo).M(0)
DirectCast(c1, IGoo).M(DirectCast(c1, IGoo).M(0))
dim x = new C() with {
.Prop = 1
}
dim v1 = nameof(c1.Prop)
end sub
end class
</Document>
</Project>
</Workspace>
", index: SameInterface);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestMemberWhichImplementsMultipleMembers()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
public int [||]M(int i)
{
throw new System.Exception();
}
}",
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
int IGoo.M(int i)
{
throw new System.Exception();
}
int IBar.M(int i)
{
throw new System.Exception();
}
}", index: SingleMember);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestMemberWhichImplementsMultipleMembers2()
{
await TestInRegularAndScriptAsync(
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
public int [||]M(int i)
{
return this.M(1);
}
}",
@"
interface IGoo { int M(int i); }
interface IBar { int M(int i); }
class C : IGoo, IBar
{
int IGoo.M(int i)
{
return ((IGoo)this).M(1);
}
int IBar.M(int i)
{
return ((IGoo)this).M(1);
}
}", index: SingleMember);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Core/CodeAnalysisTest/Emit/CustomDebugInfoTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
extern alias PDB;
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Emit;
using PDB::Microsoft.CodeAnalysis;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.Emit
{
public class CustomDebugInfoTests
{
[Fact]
public void TryGetCustomDebugInfoRecord1()
{
byte[] cdi;
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[0], CustomDebugInfoKind.EditAndContinueLocalSlotMap));
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[] { 1 }, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[] { 1, 2 }, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// unknown version
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[] { 5, 1, 0, 0 }, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// incomplete record header
cdi = new byte[]
{
4, 1, 0, 0, // global header
4, (byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap,
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// record size too small
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0, 0, 0, 0,
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// invalid record size = Int32.MinValue
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x00, 0x00, 0x00, 0x80,
0, 0, 0, 0
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// empty record
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x08, 0x00, 0x00, 0x00,
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsEmpty);
// record size too big
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x0a, 0x00, 0x00, 0x00,
0xab
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// valid record
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab
};
AssertEx.Equal(new byte[] { 0xab }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// record not matching
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.DynamicLocals, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// unknown record kind
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/0xff, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// multiple records (number in global header is ignored, the first matching record is returned)
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab,
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xcd
};
AssertEx.Equal(new byte[] { 0xab }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// multiple records (number in global header is ignored, the first record is returned)
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.DynamicLocals, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab,
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xcd
};
AssertEx.Equal(new byte[] { 0xcd }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// multiple records (number in global header is ignored, the first record is returned)
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.DynamicLocals, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab,
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xcd
};
AssertEx.Equal(new byte[] { 0xab }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.DynamicLocals));
}
[Fact]
public void UncompressSlotMap1()
{
using (new EnsureEnglishUICulture())
{
var e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff }), ImmutableArray<byte>.Empty));
Assert.Equal("Invalid data at offset 3: 01-68-FF*", e.Message);
e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty));
Assert.Equal("Invalid data at offset 3: 01-68-FF*FF-FF-FF", e.Message);
e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty));
Assert.Equal("Invalid data at offset 1: FF*FF-FF-FF", e.Message);
byte[] largeData = new byte[10000];
largeData[400] = 0xff;
largeData[401] = 0xff;
largeData[402] = 0xff;
largeData[403] = 0xff;
largeData[404] = 0xff;
largeData[405] = 0xff;
e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(largeData), ImmutableArray<byte>.Empty));
Assert.Equal(
"Invalid data at offset 401: 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-FF*FF-FF-FF-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00...", e.Message);
}
}
[Fact]
public void EditAndContinueLocalSlotMap_NegativeSyntaxOffsets()
{
var slots = ImmutableArray.Create(
new LocalSlotDebugInfo(SynthesizedLocalKind.UserDefined, new LocalDebugId(-1, 10)),
new LocalSlotDebugInfo(SynthesizedLocalKind.TryAwaitPendingCaughtException, new LocalDebugId(-20000, 10)));
var closures = ImmutableArray<ClosureDebugInfo>.Empty;
var lambdas = ImmutableArray<LambdaDebugInfo>.Empty;
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(123, slots, closures, lambdas).SerializeLocalSlots(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0xFF, 0xC0, 0x00, 0x4E, 0x20, 0x81, 0xC0, 0x00, 0x4E, 0x1F, 0x0A, 0x9A, 0x00, 0x0A }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(bytes, default(ImmutableArray<byte>)).LocalSlots;
AssertEx.Equal(slots, deserialized);
}
[Fact]
public void EditAndContinueLambdaAndClosureMap_NegativeSyntaxOffsets()
{
var slots = ImmutableArray<LocalSlotDebugInfo>.Empty;
var closures = ImmutableArray.Create(
new ClosureDebugInfo(-100, new DebugId(0, 0)),
new ClosureDebugInfo(10, new DebugId(1, 0)),
new ClosureDebugInfo(-200, new DebugId(2, 0)));
var lambdas = ImmutableArray.Create(
new LambdaDebugInfo(20, new DebugId(0, 0), 1),
new LambdaDebugInfo(-50, new DebugId(1, 0), 0),
new LambdaDebugInfo(-180, new DebugId(2, 0), LambdaDebugInfo.StaticClosureOrdinal));
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(0x7b, slots, closures, lambdas).SerializeLambdaMap(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0x7C, 0x80, 0xC8, 0x03, 0x64, 0x80, 0xD2, 0x00, 0x80, 0xDC, 0x03, 0x80, 0x96, 0x02, 0x14, 0x01 }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(default(ImmutableArray<byte>), bytes);
AssertEx.Equal(closures, deserialized.Closures);
AssertEx.Equal(lambdas, deserialized.Lambdas);
}
[Fact]
public void EditAndContinueLambdaAndClosureMap_NoClosures()
{
var slots = ImmutableArray<LocalSlotDebugInfo>.Empty;
var closures = ImmutableArray<ClosureDebugInfo>.Empty;
var lambdas = ImmutableArray.Create(new LambdaDebugInfo(20, new DebugId(0, 0), LambdaDebugInfo.StaticClosureOrdinal));
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(-1, slots, closures, lambdas).SerializeLambdaMap(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0x00, 0x01, 0x00, 0x15, 0x01 }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(default(ImmutableArray<byte>), bytes);
AssertEx.Equal(closures, deserialized.Closures);
AssertEx.Equal(lambdas, deserialized.Lambdas);
}
[Fact]
public void EditAndContinueLambdaAndClosureMap_NoLambdas()
{
// should not happen in practice, but EditAndContinueMethodDebugInformation should handle it just fine
var slots = ImmutableArray<LocalSlotDebugInfo>.Empty;
var closures = ImmutableArray<ClosureDebugInfo>.Empty;
var lambdas = ImmutableArray<LambdaDebugInfo>.Empty;
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(10, slots, closures, lambdas).SerializeLambdaMap(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0x0B, 0x01, 0x00 }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(default(ImmutableArray<byte>), bytes);
AssertEx.Equal(closures, deserialized.Closures);
AssertEx.Equal(lambdas, deserialized.Lambdas);
}
[Fact]
public void EncCdiAlignment()
{
var slots = ImmutableArray.Create(
new LocalSlotDebugInfo(SynthesizedLocalKind.UserDefined, new LocalDebugId(-1, 10)),
new LocalSlotDebugInfo(SynthesizedLocalKind.TryAwaitPendingCaughtException, new LocalDebugId(-20000, 10)));
var closures = ImmutableArray.Create(
new ClosureDebugInfo(-100, new DebugId(0, 0)),
new ClosureDebugInfo(10, new DebugId(1, 0)),
new ClosureDebugInfo(-200, new DebugId(2, 0)));
var lambdas = ImmutableArray.Create(
new LambdaDebugInfo(20, new DebugId(0, 0), 1),
new LambdaDebugInfo(-50, new DebugId(1, 0), 0),
new LambdaDebugInfo(-180, new DebugId(2, 0), LambdaDebugInfo.StaticClosureOrdinal));
var debugInfo = new EditAndContinueMethodDebugInformation(1, slots, closures, lambdas);
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
Cci.CustomDebugInfoWriter.SerializeCustomDebugInformation(ref cdiEncoder, debugInfo);
var cdi = cdiEncoder.ToArray();
Assert.Equal(2, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x02, // record count
0x00, 0x00, // alignment
0x04, // version
0x06, // record kind
0x00,
0x02, // alignment size
// aligned record size
0x18, 0x00, 0x00, 0x00,
// payload (4B aligned)
0xFF, 0xC0, 0x00, 0x4E,
0x20, 0x81, 0xC0, 0x00,
0x4E, 0x1F, 0x0A, 0x9A,
0x00, 0x0A, 0x00, 0x00,
0x04, // version
0x07, // record kind
0x00,
0x00, // alignment size
// aligned record size
0x18, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x02, 0x80, 0xC8, 0x03,
0x64, 0x80, 0xD2, 0x00,
0x80, 0xDC, 0x03, 0x80,
0x96, 0x02, 0x14, 0x01
}, cdi);
var deserialized = CustomDebugInfoReader.GetCustomDebugInfoRecords(cdi).ToArray();
Assert.Equal(CustomDebugInfoKind.EditAndContinueLocalSlotMap, deserialized[0].Kind);
Assert.Equal(4, deserialized[0].Version);
Assert.Equal(new byte[]
{
0xFF, 0xC0, 0x00, 0x4E,
0x20, 0x81, 0xC0, 0x00,
0x4E, 0x1F, 0x0A, 0x9A,
0x00, 0x0A
}, deserialized[0].Data);
Assert.Equal(CustomDebugInfoKind.EditAndContinueLambdaMap, deserialized[1].Kind);
Assert.Equal(4, deserialized[1].Version);
Assert.Equal(new byte[]
{
0x02, 0x80, 0xC8, 0x03,
0x64, 0x80, 0xD2, 0x00,
0x80, 0xDC, 0x03, 0x80,
0x96, 0x02, 0x14, 0x01
}, deserialized[1].Data);
}
[Fact]
public void UsingInfo1()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddUsingGroups(new int[0]);
var cdi = cdiEncoder.ToArray();
Assert.Equal(0, cdiEncoder.RecordCount);
Assert.Null(cdi);
}
[Fact]
public void UsingInfo2()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddUsingGroups(new[] { 1, 2, 3, 4 });
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x00, // record kind
0x00,
0x00,
// aligned record size
0x14, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x04, 0x00, // bucket count
0x01, 0x00, // using count #1
0x02, 0x00, // using count #2
0x03, 0x00, // using count #3
0x04, 0x00, // using count #4
0x00, 0x00 // alignment
}, cdi);
}
[Fact]
public void UsingInfo3()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddUsingGroups(new[] { 1, 2, 3 });
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x00, // record kind
0x00,
0x00,
// aligned record size
0x10, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x03, 0x00, // bucket count
0x01, 0x00, // using count #1
0x02, 0x00, // using count #2
0x03, 0x00, // using count #3
}, cdi);
}
[Fact]
public void ForwardToModuleInfo()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddForwardModuleInfo(MetadataTokens.MethodDefinitionHandle(0x123456));
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x02, // record kind
0x00,
0x00,
// aligned record size
0x0C, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x56, 0x34, 0x12, 0x06,
}, cdi);
}
[Fact]
public void ForwardInfo()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddForwardMethodInfo(MetadataTokens.MethodDefinitionHandle(0x123456));
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x01, // record kind
0x00,
0x00,
// aligned record size
0x0C, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x56, 0x34, 0x12, 0x06,
}, cdi);
}
private static byte[] Pad(int length, byte[] array)
{
var result = new byte[length];
Array.Copy(array, 0, result, 0, array.Length);
return result;
}
[Fact]
public void DynamicLocals()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddDynamicLocals(new[]
{
("a", Pad(64, new byte[] { 0x01, 0x02 }), 10, 1),
("b", Pad(64, new byte[] { 0xFF }), 1, 2),
});
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x05, // record kind
0x00,
0x00,
// aligned record size
0x9C, 0x01, 0x00, 0x00,
// payload (4B aligned)
// locals count
0x02, 0x00, 0x00, 0x00,
// #1
// flags (64B):
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// length
0x0A, 0x00, 0x00, 0x00,
// slot index
0x01, 0x00, 0x00, 0x00,
// name (64 UTF16 characters)
0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// #2
// flags
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// length
0x01, 0x00, 0x00, 0x00,
// slot index
0x02, 0x00, 0x00, 0x00,
// name (64 UTF16 characters)
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}, cdi);
}
[Fact]
public void TupleElementNames()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddTupleElementNames(new[]
{
(LocalName: "a", SlotIndex: 1, ScopeStart: 0, ScopeEnd: 0, Names: ImmutableArray.Create("e")),
(LocalName: "b", SlotIndex: -1, ScopeStart: 0, ScopeEnd: 10, Names: ImmutableArray.Create("u", null, "v")),
});
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x08, // record kind
0x00,
0x01, // alignment size
// aligned record size
0x38, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x02, 0x00, 0x00, 0x00, // number of entries
// entry #1
0x01, 0x00, 0x00, 0x00, // element name count
(byte)'e', 0x00, // element name 1
0x01, 0x00, 0x00, 0x00, // slot index
0x00, 0x00, 0x00, 0x00, // scope start
0x00, 0x00, 0x00, 0x00, // scope end
(byte)'a', 0x00, // local name
// entry #2
0x03, 0x00, 0x00, 0x00, // element name count
(byte)'u', 0x00, // element name 1
0x00, // element name 2
(byte)'v', 0x00, // element name 3
0xFF, 0xFF, 0xFF, 0xFF, // slot index
0x00, 0x00, 0x00, 0x00, // scope start
0x0A, 0x00, 0x00, 0x00, // scope end
(byte)'b', 0x00, 0x00 // local name
}, cdi);
}
[Fact]
public void InvalidAlignment1()
{
// CDIs that don't support alignment:
var bytes = new byte[]
{
0x04, // version
0x01, // count
0x00,
0x00,
0x04, // version
0x06, // kind
0x00,
0x03, // bad alignment
// body size
0x0a, 0x00, 0x00, 0x00,
// payload
0x01, 0x00
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.GetCustomDebugInfoRecords(bytes).ToArray());
}
[Fact]
public void InvalidAlignment2()
{
// CDIs that don't support alignment:
var bytes = new byte[]
{
0x04, // version
0x01, // count
0x00,
0x00,
0x04, // version
0x06, // kind
0x00,
0x03, // bad alignment
// body size
0x02, 0x00, 0x00, 0x00,
// payload
0x01, 0x00, 0x00, 0x06
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.GetCustomDebugInfoRecords(bytes).ToArray());
}
[Fact]
public void InvalidAlignment_KindDoesntSupportAlignment()
{
// CDIs that don't support alignment:
var bytes = new byte[]
{
0x04, // version
0x01, // count
0x00,
0x00,
0x04, // version
0x01, // kind
0x11, // invalid data
0x14, // invalid data
// body size
0x0c, 0x00, 0x00, 0x00,
// payload
0x01, 0x00, 0x00, 0x06
};
var records = CustomDebugInfoReader.GetCustomDebugInfoRecords(bytes).ToArray();
Assert.Equal(1, records.Length);
Assert.Equal(CustomDebugInfoKind.ForwardMethodInfo, records[0].Kind);
Assert.Equal(4, records[0].Version);
AssertEx.Equal(new byte[] { 0x01, 0x00, 0x00, 0x06 }, records[0].Data);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
extern alias PDB;
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Emit;
using PDB::Microsoft.CodeAnalysis;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.Emit
{
public class CustomDebugInfoTests
{
[Fact]
public void TryGetCustomDebugInfoRecord1()
{
byte[] cdi;
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[0], CustomDebugInfoKind.EditAndContinueLocalSlotMap));
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[] { 1 }, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[] { 1, 2 }, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// unknown version
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(new byte[] { 5, 1, 0, 0 }, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// incomplete record header
cdi = new byte[]
{
4, 1, 0, 0, // global header
4, (byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap,
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// record size too small
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0, 0, 0, 0,
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// invalid record size = Int32.MinValue
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x00, 0x00, 0x00, 0x80,
0, 0, 0, 0
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// empty record
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x08, 0x00, 0x00, 0x00,
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsEmpty);
// record size too big
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x0a, 0x00, 0x00, 0x00,
0xab
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// valid record
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab
};
AssertEx.Equal(new byte[] { 0xab }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// record not matching
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.DynamicLocals, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// unknown record kind
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/0xff, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab
};
Assert.True(CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap).IsDefault);
// multiple records (number in global header is ignored, the first matching record is returned)
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab,
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xcd
};
AssertEx.Equal(new byte[] { 0xab }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// multiple records (number in global header is ignored, the first record is returned)
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.DynamicLocals, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab,
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xcd
};
AssertEx.Equal(new byte[] { 0xcd }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.EditAndContinueLocalSlotMap));
// multiple records (number in global header is ignored, the first record is returned)
cdi = new byte[]
{
4, 1, 0, 0, // global header
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.DynamicLocals, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xab,
/*version*/4, /*kind*/(byte)CustomDebugInfoKind.EditAndContinueLocalSlotMap, /*padding*/0, 0, /*size:*/ 0x09, 0x00, 0x00, 0x00,
0xcd
};
AssertEx.Equal(new byte[] { 0xab }, CustomDebugInfoReader.TryGetCustomDebugInfoRecord(cdi, CustomDebugInfoKind.DynamicLocals));
}
[Fact]
public void UncompressSlotMap1()
{
using (new EnsureEnglishUICulture())
{
var e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff }), ImmutableArray<byte>.Empty));
Assert.Equal("Invalid data at offset 3: 01-68-FF*", e.Message);
e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0x01, 0x68, 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty));
Assert.Equal("Invalid data at offset 3: 01-68-FF*FF-FF-FF", e.Message);
e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(new byte[] { 0xff, 0xff, 0xff, 0xff }), ImmutableArray<byte>.Empty));
Assert.Equal("Invalid data at offset 1: FF*FF-FF-FF", e.Message);
byte[] largeData = new byte[10000];
largeData[400] = 0xff;
largeData[401] = 0xff;
largeData[402] = 0xff;
largeData[403] = 0xff;
largeData[404] = 0xff;
largeData[405] = 0xff;
e = Assert.Throws<InvalidDataException>(() => EditAndContinueMethodDebugInformation.Create(ImmutableArray.Create(largeData), ImmutableArray<byte>.Empty));
Assert.Equal(
"Invalid data at offset 401: 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-FF*FF-FF-FF-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" +
"00-00-00-00-00-00-00-00-00-00-00...", e.Message);
}
}
[Fact]
public void EditAndContinueLocalSlotMap_NegativeSyntaxOffsets()
{
var slots = ImmutableArray.Create(
new LocalSlotDebugInfo(SynthesizedLocalKind.UserDefined, new LocalDebugId(-1, 10)),
new LocalSlotDebugInfo(SynthesizedLocalKind.TryAwaitPendingCaughtException, new LocalDebugId(-20000, 10)));
var closures = ImmutableArray<ClosureDebugInfo>.Empty;
var lambdas = ImmutableArray<LambdaDebugInfo>.Empty;
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(123, slots, closures, lambdas).SerializeLocalSlots(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0xFF, 0xC0, 0x00, 0x4E, 0x20, 0x81, 0xC0, 0x00, 0x4E, 0x1F, 0x0A, 0x9A, 0x00, 0x0A }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(bytes, default(ImmutableArray<byte>)).LocalSlots;
AssertEx.Equal(slots, deserialized);
}
[Fact]
public void EditAndContinueLambdaAndClosureMap_NegativeSyntaxOffsets()
{
var slots = ImmutableArray<LocalSlotDebugInfo>.Empty;
var closures = ImmutableArray.Create(
new ClosureDebugInfo(-100, new DebugId(0, 0)),
new ClosureDebugInfo(10, new DebugId(1, 0)),
new ClosureDebugInfo(-200, new DebugId(2, 0)));
var lambdas = ImmutableArray.Create(
new LambdaDebugInfo(20, new DebugId(0, 0), 1),
new LambdaDebugInfo(-50, new DebugId(1, 0), 0),
new LambdaDebugInfo(-180, new DebugId(2, 0), LambdaDebugInfo.StaticClosureOrdinal));
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(0x7b, slots, closures, lambdas).SerializeLambdaMap(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0x7C, 0x80, 0xC8, 0x03, 0x64, 0x80, 0xD2, 0x00, 0x80, 0xDC, 0x03, 0x80, 0x96, 0x02, 0x14, 0x01 }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(default(ImmutableArray<byte>), bytes);
AssertEx.Equal(closures, deserialized.Closures);
AssertEx.Equal(lambdas, deserialized.Lambdas);
}
[Fact]
public void EditAndContinueLambdaAndClosureMap_NoClosures()
{
var slots = ImmutableArray<LocalSlotDebugInfo>.Empty;
var closures = ImmutableArray<ClosureDebugInfo>.Empty;
var lambdas = ImmutableArray.Create(new LambdaDebugInfo(20, new DebugId(0, 0), LambdaDebugInfo.StaticClosureOrdinal));
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(-1, slots, closures, lambdas).SerializeLambdaMap(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0x00, 0x01, 0x00, 0x15, 0x01 }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(default(ImmutableArray<byte>), bytes);
AssertEx.Equal(closures, deserialized.Closures);
AssertEx.Equal(lambdas, deserialized.Lambdas);
}
[Fact]
public void EditAndContinueLambdaAndClosureMap_NoLambdas()
{
// should not happen in practice, but EditAndContinueMethodDebugInformation should handle it just fine
var slots = ImmutableArray<LocalSlotDebugInfo>.Empty;
var closures = ImmutableArray<ClosureDebugInfo>.Empty;
var lambdas = ImmutableArray<LambdaDebugInfo>.Empty;
var cmw = new BlobBuilder();
new EditAndContinueMethodDebugInformation(10, slots, closures, lambdas).SerializeLambdaMap(cmw);
var bytes = cmw.ToImmutableArray();
AssertEx.Equal(new byte[] { 0x0B, 0x01, 0x00 }, bytes);
var deserialized = EditAndContinueMethodDebugInformation.Create(default(ImmutableArray<byte>), bytes);
AssertEx.Equal(closures, deserialized.Closures);
AssertEx.Equal(lambdas, deserialized.Lambdas);
}
[Fact]
public void EncCdiAlignment()
{
var slots = ImmutableArray.Create(
new LocalSlotDebugInfo(SynthesizedLocalKind.UserDefined, new LocalDebugId(-1, 10)),
new LocalSlotDebugInfo(SynthesizedLocalKind.TryAwaitPendingCaughtException, new LocalDebugId(-20000, 10)));
var closures = ImmutableArray.Create(
new ClosureDebugInfo(-100, new DebugId(0, 0)),
new ClosureDebugInfo(10, new DebugId(1, 0)),
new ClosureDebugInfo(-200, new DebugId(2, 0)));
var lambdas = ImmutableArray.Create(
new LambdaDebugInfo(20, new DebugId(0, 0), 1),
new LambdaDebugInfo(-50, new DebugId(1, 0), 0),
new LambdaDebugInfo(-180, new DebugId(2, 0), LambdaDebugInfo.StaticClosureOrdinal));
var debugInfo = new EditAndContinueMethodDebugInformation(1, slots, closures, lambdas);
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
Cci.CustomDebugInfoWriter.SerializeCustomDebugInformation(ref cdiEncoder, debugInfo);
var cdi = cdiEncoder.ToArray();
Assert.Equal(2, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x02, // record count
0x00, 0x00, // alignment
0x04, // version
0x06, // record kind
0x00,
0x02, // alignment size
// aligned record size
0x18, 0x00, 0x00, 0x00,
// payload (4B aligned)
0xFF, 0xC0, 0x00, 0x4E,
0x20, 0x81, 0xC0, 0x00,
0x4E, 0x1F, 0x0A, 0x9A,
0x00, 0x0A, 0x00, 0x00,
0x04, // version
0x07, // record kind
0x00,
0x00, // alignment size
// aligned record size
0x18, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x02, 0x80, 0xC8, 0x03,
0x64, 0x80, 0xD2, 0x00,
0x80, 0xDC, 0x03, 0x80,
0x96, 0x02, 0x14, 0x01
}, cdi);
var deserialized = CustomDebugInfoReader.GetCustomDebugInfoRecords(cdi).ToArray();
Assert.Equal(CustomDebugInfoKind.EditAndContinueLocalSlotMap, deserialized[0].Kind);
Assert.Equal(4, deserialized[0].Version);
Assert.Equal(new byte[]
{
0xFF, 0xC0, 0x00, 0x4E,
0x20, 0x81, 0xC0, 0x00,
0x4E, 0x1F, 0x0A, 0x9A,
0x00, 0x0A
}, deserialized[0].Data);
Assert.Equal(CustomDebugInfoKind.EditAndContinueLambdaMap, deserialized[1].Kind);
Assert.Equal(4, deserialized[1].Version);
Assert.Equal(new byte[]
{
0x02, 0x80, 0xC8, 0x03,
0x64, 0x80, 0xD2, 0x00,
0x80, 0xDC, 0x03, 0x80,
0x96, 0x02, 0x14, 0x01
}, deserialized[1].Data);
}
[Fact]
public void UsingInfo1()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddUsingGroups(new int[0]);
var cdi = cdiEncoder.ToArray();
Assert.Equal(0, cdiEncoder.RecordCount);
Assert.Null(cdi);
}
[Fact]
public void UsingInfo2()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddUsingGroups(new[] { 1, 2, 3, 4 });
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x00, // record kind
0x00,
0x00,
// aligned record size
0x14, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x04, 0x00, // bucket count
0x01, 0x00, // using count #1
0x02, 0x00, // using count #2
0x03, 0x00, // using count #3
0x04, 0x00, // using count #4
0x00, 0x00 // alignment
}, cdi);
}
[Fact]
public void UsingInfo3()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddUsingGroups(new[] { 1, 2, 3 });
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x00, // record kind
0x00,
0x00,
// aligned record size
0x10, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x03, 0x00, // bucket count
0x01, 0x00, // using count #1
0x02, 0x00, // using count #2
0x03, 0x00, // using count #3
}, cdi);
}
[Fact]
public void ForwardToModuleInfo()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddForwardModuleInfo(MetadataTokens.MethodDefinitionHandle(0x123456));
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x02, // record kind
0x00,
0x00,
// aligned record size
0x0C, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x56, 0x34, 0x12, 0x06,
}, cdi);
}
[Fact]
public void ForwardInfo()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddForwardMethodInfo(MetadataTokens.MethodDefinitionHandle(0x123456));
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x01, // record kind
0x00,
0x00,
// aligned record size
0x0C, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x56, 0x34, 0x12, 0x06,
}, cdi);
}
private static byte[] Pad(int length, byte[] array)
{
var result = new byte[length];
Array.Copy(array, 0, result, 0, array.Length);
return result;
}
[Fact]
public void DynamicLocals()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddDynamicLocals(new[]
{
("a", Pad(64, new byte[] { 0x01, 0x02 }), 10, 1),
("b", Pad(64, new byte[] { 0xFF }), 1, 2),
});
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x05, // record kind
0x00,
0x00,
// aligned record size
0x9C, 0x01, 0x00, 0x00,
// payload (4B aligned)
// locals count
0x02, 0x00, 0x00, 0x00,
// #1
// flags (64B):
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// length
0x0A, 0x00, 0x00, 0x00,
// slot index
0x01, 0x00, 0x00, 0x00,
// name (64 UTF16 characters)
0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// #2
// flags
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// length
0x01, 0x00, 0x00, 0x00,
// slot index
0x02, 0x00, 0x00, 0x00,
// name (64 UTF16 characters)
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}, cdi);
}
[Fact]
public void TupleElementNames()
{
var builder = new BlobBuilder();
var cdiEncoder = new CustomDebugInfoEncoder(builder);
cdiEncoder.AddTupleElementNames(new[]
{
(LocalName: "a", SlotIndex: 1, ScopeStart: 0, ScopeEnd: 0, Names: ImmutableArray.Create("e")),
(LocalName: "b", SlotIndex: -1, ScopeStart: 0, ScopeEnd: 10, Names: ImmutableArray.Create("u", null, "v")),
});
var cdi = cdiEncoder.ToArray();
Assert.Equal(1, cdiEncoder.RecordCount);
AssertEx.Equal(new byte[]
{
0x04, // version
0x01, // record count
0x00, 0x00, // alignment
0x04, // version
0x08, // record kind
0x00,
0x01, // alignment size
// aligned record size
0x38, 0x00, 0x00, 0x00,
// payload (4B aligned)
0x02, 0x00, 0x00, 0x00, // number of entries
// entry #1
0x01, 0x00, 0x00, 0x00, // element name count
(byte)'e', 0x00, // element name 1
0x01, 0x00, 0x00, 0x00, // slot index
0x00, 0x00, 0x00, 0x00, // scope start
0x00, 0x00, 0x00, 0x00, // scope end
(byte)'a', 0x00, // local name
// entry #2
0x03, 0x00, 0x00, 0x00, // element name count
(byte)'u', 0x00, // element name 1
0x00, // element name 2
(byte)'v', 0x00, // element name 3
0xFF, 0xFF, 0xFF, 0xFF, // slot index
0x00, 0x00, 0x00, 0x00, // scope start
0x0A, 0x00, 0x00, 0x00, // scope end
(byte)'b', 0x00, 0x00 // local name
}, cdi);
}
[Fact]
public void InvalidAlignment1()
{
// CDIs that don't support alignment:
var bytes = new byte[]
{
0x04, // version
0x01, // count
0x00,
0x00,
0x04, // version
0x06, // kind
0x00,
0x03, // bad alignment
// body size
0x0a, 0x00, 0x00, 0x00,
// payload
0x01, 0x00
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.GetCustomDebugInfoRecords(bytes).ToArray());
}
[Fact]
public void InvalidAlignment2()
{
// CDIs that don't support alignment:
var bytes = new byte[]
{
0x04, // version
0x01, // count
0x00,
0x00,
0x04, // version
0x06, // kind
0x00,
0x03, // bad alignment
// body size
0x02, 0x00, 0x00, 0x00,
// payload
0x01, 0x00, 0x00, 0x06
};
Assert.Throws<InvalidOperationException>(() => CustomDebugInfoReader.GetCustomDebugInfoRecords(bytes).ToArray());
}
[Fact]
public void InvalidAlignment_KindDoesntSupportAlignment()
{
// CDIs that don't support alignment:
var bytes = new byte[]
{
0x04, // version
0x01, // count
0x00,
0x00,
0x04, // version
0x01, // kind
0x11, // invalid data
0x14, // invalid data
// body size
0x0c, 0x00, 0x00, 0x00,
// payload
0x01, 0x00, 0x00, 0x06
};
var records = CustomDebugInfoReader.GetCustomDebugInfoRecords(bytes).ToArray();
Assert.Equal(1, records.Length);
Assert.Equal(CustomDebugInfoKind.ForwardMethodInfo, records[0].Kind);
Assert.Equal(4, records[0].Version);
AssertEx.Equal(new byte[] { 0x01, 0x00, 0x00, 0x06 }, records[0].Data);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/CSharp/Highlighting/KeywordHighlighters/LoopHighlighter.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor.Implementation.Highlighting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor.CSharp.KeywordHighlighting.KeywordHighlighters
{
[ExportHighlighter(LanguageNames.CSharp)]
internal class LoopHighlighter : AbstractKeywordHighlighter
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LoopHighlighter()
{
}
protected override bool IsHighlightableNode(SyntaxNode node)
=> node.IsContinuableConstruct();
protected override void AddHighlightsForNode(
SyntaxNode node, List<TextSpan> spans, CancellationToken cancellationToken)
{
switch (node)
{
case DoStatementSyntax doStatement:
HighlightDoStatement(doStatement, spans);
break;
case ForStatementSyntax forStatement:
HighlightForStatement(forStatement, spans);
break;
case CommonForEachStatementSyntax forEachStatement:
HighlightForEachStatement(forEachStatement, spans);
break;
case WhileStatementSyntax whileStatement:
HighlightWhileStatement(whileStatement, spans);
break;
}
HighlightRelatedKeywords(node, spans, highlightBreaks: true, highlightContinues: true);
}
private static void HighlightDoStatement(DoStatementSyntax statement, List<TextSpan> spans)
{
spans.Add(statement.DoKeyword.Span);
spans.Add(statement.WhileKeyword.Span);
spans.Add(EmptySpan(statement.SemicolonToken.Span.End));
}
private static void HighlightForStatement(ForStatementSyntax statement, List<TextSpan> spans)
=> spans.Add(statement.ForKeyword.Span);
private static void HighlightForEachStatement(CommonForEachStatementSyntax statement, List<TextSpan> spans)
=> spans.Add(statement.ForEachKeyword.Span);
private static void HighlightWhileStatement(WhileStatementSyntax statement, List<TextSpan> spans)
=> spans.Add(statement.WhileKeyword.Span);
/// <summary>
/// Finds all breaks and continues that are a child of this node, and adds the appropriate spans to the spans list.
/// </summary>
private void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans,
bool highlightBreaks, bool highlightContinues)
{
Debug.Assert(highlightBreaks || highlightContinues);
if (highlightBreaks && node is BreakStatementSyntax breakStatement)
{
spans.Add(breakStatement.BreakKeyword.Span);
spans.Add(EmptySpan(breakStatement.SemicolonToken.Span.End));
}
else if (highlightContinues && node is ContinueStatementSyntax continueStatement)
{
spans.Add(continueStatement.ContinueKeyword.Span);
spans.Add(EmptySpan(continueStatement.SemicolonToken.Span.End));
}
else
{
foreach (var child in node.ChildNodes())
{
var highlightBreaksForChild = highlightBreaks && !child.IsBreakableConstruct();
var highlightContinuesForChild = highlightContinues && !child.IsContinuableConstruct();
// Only recurse if we have anything to do
if (highlightBreaksForChild || highlightContinuesForChild)
{
HighlightRelatedKeywords(child, spans, highlightBreaksForChild, highlightContinuesForChild);
}
}
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor.Implementation.Highlighting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor.CSharp.KeywordHighlighting.KeywordHighlighters
{
[ExportHighlighter(LanguageNames.CSharp)]
internal class LoopHighlighter : AbstractKeywordHighlighter
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LoopHighlighter()
{
}
protected override bool IsHighlightableNode(SyntaxNode node)
=> node.IsContinuableConstruct();
protected override void AddHighlightsForNode(
SyntaxNode node, List<TextSpan> spans, CancellationToken cancellationToken)
{
switch (node)
{
case DoStatementSyntax doStatement:
HighlightDoStatement(doStatement, spans);
break;
case ForStatementSyntax forStatement:
HighlightForStatement(forStatement, spans);
break;
case CommonForEachStatementSyntax forEachStatement:
HighlightForEachStatement(forEachStatement, spans);
break;
case WhileStatementSyntax whileStatement:
HighlightWhileStatement(whileStatement, spans);
break;
}
HighlightRelatedKeywords(node, spans, highlightBreaks: true, highlightContinues: true);
}
private static void HighlightDoStatement(DoStatementSyntax statement, List<TextSpan> spans)
{
spans.Add(statement.DoKeyword.Span);
spans.Add(statement.WhileKeyword.Span);
spans.Add(EmptySpan(statement.SemicolonToken.Span.End));
}
private static void HighlightForStatement(ForStatementSyntax statement, List<TextSpan> spans)
=> spans.Add(statement.ForKeyword.Span);
private static void HighlightForEachStatement(CommonForEachStatementSyntax statement, List<TextSpan> spans)
=> spans.Add(statement.ForEachKeyword.Span);
private static void HighlightWhileStatement(WhileStatementSyntax statement, List<TextSpan> spans)
=> spans.Add(statement.WhileKeyword.Span);
/// <summary>
/// Finds all breaks and continues that are a child of this node, and adds the appropriate spans to the spans list.
/// </summary>
private void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans,
bool highlightBreaks, bool highlightContinues)
{
Debug.Assert(highlightBreaks || highlightContinues);
if (highlightBreaks && node is BreakStatementSyntax breakStatement)
{
spans.Add(breakStatement.BreakKeyword.Span);
spans.Add(EmptySpan(breakStatement.SemicolonToken.Span.End));
}
else if (highlightContinues && node is ContinueStatementSyntax continueStatement)
{
spans.Add(continueStatement.ContinueKeyword.Span);
spans.Add(EmptySpan(continueStatement.SemicolonToken.Span.End));
}
else
{
foreach (var child in node.ChildNodes())
{
var highlightBreaksForChild = highlightBreaks && !child.IsBreakableConstruct();
var highlightContinuesForChild = highlightContinues && !child.IsContinuableConstruct();
// Only recurse if we have anything to do
if (highlightBreaksForChild || highlightContinuesForChild)
{
HighlightRelatedKeywords(child, spans, highlightBreaksForChild, highlightContinuesForChild);
}
}
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Analyzers/VisualBasic/Analyzers/FileHeaders/VisualBasicFileHeaderDiagnosticAnalyzer.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FileHeaders
Namespace Microsoft.CodeAnalysis.VisualBasic.FileHeaders
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicFileHeaderDiagnosticAnalyzer
Inherits AbstractFileHeaderDiagnosticAnalyzer
Public Sub New()
MyBase.New(LanguageNames.VisualBasic)
End Sub
Protected Overrides ReadOnly Property FileHeaderHelper As AbstractFileHeaderHelper
Get
Return VisualBasicFileHeaderHelper.Instance
End Get
End Property
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.FileHeaders
Namespace Microsoft.CodeAnalysis.VisualBasic.FileHeaders
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicFileHeaderDiagnosticAnalyzer
Inherits AbstractFileHeaderDiagnosticAnalyzer
Public Sub New()
MyBase.New(LanguageNames.VisualBasic)
End Sub
Protected Overrides ReadOnly Property FileHeaderHelper As AbstractFileHeaderHelper
Get
Return VisualBasicFileHeaderHelper.Instance
End Get
End Property
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalSolutionCrawlerPage.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis.SolutionCrawler;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
{
[Guid(Guids.RoslynOptionPageInternalSolutionCrawlerIdString)]
internal class InternalSolutionCrawlerPage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new InternalOptionsControl(nameof(InternalSolutionCrawlerOptions), optionStore);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis.SolutionCrawler;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
{
[Guid(Guids.RoslynOptionPageInternalSolutionCrawlerIdString)]
internal class InternalSolutionCrawlerPage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new InternalOptionsControl(nameof(InternalSolutionCrawlerOptions), optionStore);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/CSharp/Portable/GoToDefinition/CSharpFindDefinitionService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Composition;
using Microsoft.CodeAnalysis.GoToDefinition;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.CSharp.GoToDefinition
{
[ExportLanguageService(typeof(IFindDefinitionService), LanguageNames.CSharp), Shared]
internal class CSharpFindDefinitionService : AbstractFindDefinitionService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpFindDefinitionService()
{
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Composition;
using Microsoft.CodeAnalysis.GoToDefinition;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.CSharp.GoToDefinition
{
[ExportLanguageService(typeof(IFindDefinitionService), LanguageNames.CSharp), Shared]
internal class CSharpFindDefinitionService : AbstractFindDefinitionService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpFindDefinitionService()
{
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using Microsoft.CodeAnalysis.AddImports;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Editor.CSharp.ExtractInterface;
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.Extensions;
using Microsoft.CodeAnalysis.Editor.UnitTests.ExtractInterface;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.ExtractInterface;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
using Roslyn.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ExtractInterface
{
public class ExtractInterfaceTests : AbstractExtractInterfaceTests
{
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_CaretInMethod()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
$$
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_CaretAfterClassClosingBrace()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}
}$$";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_CaretBeforeClassKeyword()
{
var markup = @"
using System;
$$class MyClass
{
public void Goo()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromInnerClass1()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}
class AnotherClass
{
$$public void Bar()
{
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Bar");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromInnerClass2()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}
$$class AnotherClass
{
public async Task Bar()
{
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Bar");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromOuterClass()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}$$
class AnotherClass
{
public async Task Bar()
{
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromInterface()
{
var markup = @"
using System;
interface IMyInterface
{
$$void Goo();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo", expectedInterfaceName: "IMyInterface1");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromStruct()
{
var markup = @"
using System;
struct SomeStruct
{
$$public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo", expectedInterfaceName: "ISomeStruct");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromNamespace()
{
var markup = @"
using System;
namespace Ns$$
{
class MyClass
{
public async Task Goo() { }
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_DoesNotIncludeFields()
{
var markup = @"
using System;
class MyClass
{
$$public int x;
public void Goo()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicProperty_WithGetAndSet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { get; set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Prop");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterfaceAction_ExtractableMembers_IncludesPublicProperty_WithGetAndSet()
{
var markup = @"
class MyClass$$
{
public int Prop { get; set; }
}";
var expectedMarkup = @"
interface IMyClass
{
int Prop { get; set; }
}
class MyClass : IMyClass
{
public int Prop { get; set; }
}";
await TestExtractInterfaceCodeActionCSharpAsync(markup, expectedMarkup);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicProperty_WithGetAndPrivateSet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { get; private set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Prop");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicProperty_WithGet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { get; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Prop");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesPublicProperty_WithPrivateGetAndPrivateSet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { private get; private set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicIndexer()
{
var markup = @"
using System;
class MyClass
{
$$public int this[int x] { get { return 5; } set { } }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "this[]");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesInternalIndexer()
{
var markup = @"
using System;
class MyClass
{
$$internal int this[int x] { get { return 5; } set { } }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicMethod()
{
var markup = @"
using System;
class MyClass
{
$$public void M()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "M");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesInternalMethod()
{
var markup = @"
using System;
class MyClass
{
$$internal void M()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesAbstractMethod()
{
var markup = @"
using System;
abstract class MyClass
{
$$public abstract void M();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "M");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicEvent()
{
var markup = @"
using System;
class MyClass
{
$$public event Action MyEvent;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "MyEvent");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesPrivateEvent()
{
var markup = @"
using System;
class MyClass
{
$$private event Action MyEvent;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_DefaultInterfaceName_DoesNotConflictWithOtherTypeNames()
{
var markup = @"
using System;
class MyClass
{
$$public void Goo() { }
}
interface IMyClass { }
struct IMyClass1 { }
class IMyClass2 { }";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceName: "IMyClass3");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NoNamespace()
{
var markup = @"
using System;
class MyClass
{
$$public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedNamespaceName: "");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_SingleNamespace()
{
var markup = @"
using System;
namespace MyNamespace
{
class MyClass
{
$$public void Goo() { }
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedNamespaceName: "MyNamespace");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedNamespaceName: "OuterNamespace.InnerNamespace");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces_FileScopedNamespace1()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp10),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"namespace OuterNamespace.InnerNamespace;
internal interface IMyClass
{
void Goo();
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces_FileScopedNamespace2()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp9),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"namespace OuterNamespace.InnerNamespace
{
internal interface IMyClass
{
void Goo();
}
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces_FileScopedNamespace3()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp10),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"namespace OuterNamespace.InnerNamespace
{
internal interface IMyClass
{
void Goo();
}
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_ClassesImplementExtractedInterface()
{
var markup = @"using System;
class MyClass
{
$$public void Goo() { }
}";
var expectedCode = @"using System;
class MyClass : IMyClass
{
public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_StructsImplementExtractedInterface()
{
var markup = @"
using System;
struct MyStruct
{
$$public void Goo() { }
}";
var expectedCode = @"
using System;
struct MyStruct : IMyStruct
{
public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_InterfacesDoNotImplementExtractedInterface()
{
var markup = @"
using System;
interface MyInterface
{
$$void Goo();
}";
var expectedCode = @"
using System;
interface MyInterface
{
void Goo();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Methods()
{
var markup = @"
using System;
abstract class MyClass$$
{
public void ExtractableMethod_Normal() { }
public void ExtractableMethod_ParameterTypes(System.Diagnostics.CorrelationManager x, Nullable<Int32> y = 7, string z = ""42"") { }
public abstract void ExtractableMethod_Abstract();
unsafe public void NotActuallyUnsafeMethod(int p) { }
unsafe public void UnsafeMethod(int *p) { }
}";
var expectedInterfaceCode = @"using System.Diagnostics;
interface IMyClass
{
void ExtractableMethod_Abstract();
void ExtractableMethod_Normal();
void ExtractableMethod_ParameterTypes(CorrelationManager x, int? y = 7, string z = ""42"");
void NotActuallyUnsafeMethod(int p);
unsafe void UnsafeMethod(int* p);
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_MethodsInRecord()
{
var markup = @"
abstract record R$$
{
public void M() { }
}";
var expectedInterfaceCode = @"interface IR
{
bool Equals(object obj);
bool Equals(R other);
int GetHashCode();
void M();
string ToString();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Events()
{
var markup = @"
using System;
abstract internal class MyClass$$
{
public event Action ExtractableEvent1;
public event Action<Nullable<Int32>> ExtractableEvent2;
}";
var expectedInterfaceCode = @"using System;
internal interface IMyClass
{
event Action ExtractableEvent1;
event Action<int?> ExtractableEvent2;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Properties()
{
var markup = @"
using System;
abstract class MyClass$$
{
public int ExtractableProp { get; set; }
public int ExtractableProp_GetOnly { get { return 1; } }
public int ExtractableProp_SetOnly { set { } }
public int ExtractableProp_SetPrivate { get; private set; }
public int ExtractableProp_GetPrivate { private get; set; }
public int ExtractableProp_SetInternal { get; internal set; }
public int ExtractableProp_GetInternal { internal get; set; }
unsafe public int NotActuallyUnsafeProp { get; set; }
unsafe public int* UnsafeProp { get; set; }
}";
var expectedInterfaceCode = @"interface IMyClass
{
int ExtractableProp { get; set; }
int ExtractableProp_GetOnly { get; }
int ExtractableProp_SetOnly { set; }
int ExtractableProp_SetPrivate { get; }
int ExtractableProp_GetPrivate { set; }
int ExtractableProp_SetInternal { get; }
int ExtractableProp_GetInternal { set; }
int NotActuallyUnsafeProp { get; set; }
unsafe int* UnsafeProp { get; set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Indexers()
{
var markup = @"
using System;
abstract class MyClass$$
{
public int this[int x] { set { } }
public int this[string x] { get { return 1; } }
public int this[double x] { get { return 1; } set { } }
public int this[Nullable<Int32> x, string y = ""42""] { get { return 1; } set { } }
}";
var expectedInterfaceCode = @"interface IMyClass
{
int this[int x] { set; }
int this[string x] { get; }
int this[double x] { get; set; }
int this[int? x, string y = ""42""] { get; set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Imports()
{
var markup = @"
public class Class
{
$$public System.Diagnostics.BooleanSwitch M1(System.Globalization.Calendar x) { return null; }
public void M2(System.Collections.Generic.List<System.IO.BinaryWriter> x) { }
public void M3<T>() where T : System.Net.WebProxy { }
}";
var expectedInterfaceCode = @"using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
public interface IClass
{
BooleanSwitch M1(Calendar x);
void M2(List<BinaryWriter> x);
void M3<T>() where T : WebProxy;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_ImportsInsideNamespace()
{
var markup = @"
namespace N
{
public class Class
{
$$public System.Diagnostics.BooleanSwitch M1(System.Globalization.Calendar x) { return null; }
public void M2(System.Collections.Generic.List<System.IO.BinaryWriter> x) { }
public void M3<T>() where T : System.Net.WebProxy { }
}
}";
var expectedInterfaceCode = @"namespace N
{
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
public interface IClass
{
BooleanSwitch M1(Calendar x);
void M2(List<BinaryWriter> x);
void M3<T>() where T : WebProxy;
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp10),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, AddImportPlacement.InsideNamespace }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(expectedInterfaceCode, interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters1()
{
var markup = @"
public class Class<A, B, C, D, E, F, G, H, NO1> where E : F
{
$$public void Goo1(A a) { }
public B Goo2() { return default(B); }
public void Goo3(List<C> list) { }
public event Func<D> Goo4;
public List<E> Prop { set { } }
public List<G> this[List<List<H>> list] { set { } }
public void Bar1() { var x = default(NO1); }
}";
var expectedInterfaceCode = @"public interface IClass<A, B, C, D, E, F, G, H> where E : F
{
List<G> this[List<List<H>> list] { set; }
List<E> Prop { set; }
event Func<D> Goo4;
void Bar1();
void Goo1(A a);
B Goo2();
void Goo3(List<C> list);
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters2()
{
var markup = @"using System.Collections.Generic;
class Program<A, B, C, D, E> where A : List<B> where B : Dictionary<List<D>, List<E>>
{
$$public void Goo<T>(T t) where T : List<A> { }
}";
var expectedInterfaceCode = @"using System.Collections.Generic;
interface IProgram<A, B, D, E>
where A : List<B>
where B : Dictionary<List<D>, List<E>>
{
void Goo<T>(T t) where T : List<A>;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters3()
{
var markup = @"
class $$Class1<A, B>
{
public void method(A P1, Class2 P2)
{
}
public class Class2
{
}
}";
var expectedInterfaceCode = @"interface IClass1<A, B>
{
void method(A P1, Class1<A, B>.Class2 P2);
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters4()
{
var markup = @"
class C1<A>
{
public class C2<B> where B : new()
{
public class C3<C> where C : System.Collections.ICollection
{
public class C4
{$$
public A method() { return default(A); }
public B property { set { } }
public C this[int i] { get { return default(C); } }
}
}
}
}";
var expectedInterfaceCode = @"using System.Collections;
public interface IC4<A, B, C>
where B : new()
where C : ICollection
{
C this[int i] { get; }
B property { set; }
A method();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_AccessibilityModifiers()
{
var markup = @"
using System;
abstract class MyClass$$
{
public void Goo() { }
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CodeStyleOptions2.RequireAccessibilityModifiers, AccessibilityModifiersRequired.Always, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"internal interface IMyClass
{
void Goo();
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_NewBaseListNonGeneric()
{
var markup = @"
class Program
{
$$public void Goo() { }
}";
var expectedCode = @"
class Program : IProgram
{
public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_NewBaseListGeneric()
{
var markup = @"
class Program<T>
{
$$public void Goo(T t) { }
}";
var expectedCode = @"
class Program<T> : IProgram<T>
{
public void Goo(T t) { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_NewBaseListWithWhereClause()
{
var markup = @"
class Program<T, U> where T : U
{
$$public void Goo(T t, U u) { }
}";
var expectedCode = @"
class Program<T, U> : IProgram<T, U> where T : U
{
public void Goo(T t, U u) { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList1()
{
var markup = @"
class Program : ISomeInterface
{
$$public void Goo() { }
}
interface ISomeInterface {}";
var expectedCode = @"
class Program : ISomeInterface, IProgram
{
public void Goo() { }
}
interface ISomeInterface {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList2()
{
var markup = @"
class Program<T, U> : ISomeInterface<T>
{
$$public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}";
var expectedCode = @"
class Program<T, U> : ISomeInterface<T>, IProgram<T, U>
{
public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList3()
{
var markup = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U>
{
$$public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
var expectedCode = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U>, IProgram<T, U>
{
public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList4()
{
var markup = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U> where T : U
{
$$public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
var expectedCode = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U>, IProgram<T, U> where T : U
{
public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly1()
{
var markup = @"
interface ISomeInterface<T> {}
class Program<T, U> : ISomeInterface<T> where T : U
{
$$public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly2()
{
var markup = @"
interface ISomeInterface<T> {}
class Program<T, U> $$: ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly3()
{
var markup = @"
interface ISomeInterface<T> {}
class$$ Program<T, U> : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly4()
{
var markup = @"
interface ISomeInterface<T> {}
class Program<T, U>$$ : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly5()
{
var markup = @"
interface ISomeInterface<T> {}
class Program $$ <T, U> : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly6()
{
var markup = @"
interface ISomeInterface<T> {}
class $$Program <T, U> : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly7()
{
var markup = @"
interface ISomeInterface<T> {}
class $$Program : ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly8()
{
var markup = @"
interface ISomeInterface<T> {}
class Program$$ : ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly9()
{
var markup = @"
interface ISomeInterface<T> {}
class$$ Program : ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly10()
{
var markup = @"
interface ISomeInterface<T> {}
class Program $$: ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
private static async Task TestTypeDiscoveryAsync(
string markup,
TypeDiscoveryRule typeDiscoveryRule,
bool expectedExtractable)
{
using var testState = ExtractInterfaceTestState.Create(markup, LanguageNames.CSharp, compilationOptions: null);
var result = await testState.GetTypeAnalysisResultAsync(typeDiscoveryRule);
Assert.Equal(expectedExtractable, result.CanExtractInterface);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_GeneratedNameTypeParameterSuffix1()
{
var markup = @"
class $$Test<T>
{
public void M(T a) { }
}";
var expectedTypeParameterSuffix = @"<T>";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_GeneratedNameTypeParameterSuffix2()
{
var markup = @"
class $$Test<T, U>
{
public void M(T a) { }
}";
var expectedTypeParameterSuffix = @"<T>";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_GeneratedNameTypeParameterSuffix3()
{
var markup = @"
class $$Test<T, U>
{
public void M(T a, U b) { }
}";
var expectedTypeParameterSuffix = @"<T, U>";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ExtractInterface)]
[Trait(Traits.Feature, Traits.Features.Interactive)]
public void ExtractInterfaceCommandDisabledInSubmission()
{
using var workspace = TestWorkspace.Create(XElement.Parse(@"
<Workspace>
<Submission Language=""C#"" CommonReferences=""true"">
public class $$C
{
public void M() { }
}
</Submission>
</Workspace> "),
workspaceKind: WorkspaceKind.Interactive,
composition: EditorTestCompositions.EditorFeaturesWpf);
// Force initialization.
workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
var textView = workspace.Documents.Single().GetTextView();
var handler = workspace.ExportProvider.GetCommandHandler<ExtractInterfaceCommandHandler>(PredefinedCommandHandlerNames.ExtractInterface, ContentTypeNames.CSharpContentType);
var state = handler.GetCommandState(new ExtractInterfaceCommandArgs(textView, textView.TextBuffer));
Assert.True(state.IsUnspecified);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestInWithMethod_Parameters()
{
var markup = @"
using System;
class $$TestClass
{
public void Method(in int p1)
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
void Method(in int p1);
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRefReadOnlyWithMethod_ReturnType()
{
var markup = @"
using System;
class $$TestClass
{
public ref readonly int Method() => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
ref readonly int Method();
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRefReadOnlyWithProperty()
{
var markup = @"
using System;
class $$TestClass
{
public ref readonly int Property => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
ref readonly int Property { get; }
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestInWithIndexer_Parameters()
{
var markup = @"
using System;
class $$TestClass
{
public int this[in int p1] { set { } }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
int this[in int p1] { set; }
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRefReadOnlyWithIndexer_ReturnType()
{
var markup = @"
using System;
class $$TestClass
{
public ref readonly int this[int p1] => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
ref readonly int this[int p1] { get; }
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestUnmanagedConstraint_Type()
{
var markup = @"
class $$TestClass<T> where T : unmanaged
{
public void M(T arg) => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass<T> where T : unmanaged
{
void M(T arg);
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestUnmanagedConstraint_Method()
{
var markup = @"
class $$TestClass
{
public void M<T>() where T : unmanaged => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
void M<T>() where T : unmanaged;
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestNotNullConstraint_Type()
{
var markup = @"
class $$TestClass<T> where T : notnull
{
public void M(T arg) => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass<T> where T : notnull
{
void M(T arg);
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestNotNullConstraint_Method()
{
var markup = @"
class $$TestClass
{
public void M<T>() where T : notnull => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
void M<T>() where T : notnull;
}");
}
[WorkItem(23855, "https://github.com/dotnet/roslyn/issues/23855")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestExtractInterface_WithCopyright1()
{
var markup =
@"// Copyright
public class $$Goo
{
public void Test()
{
}
}";
var updatedMarkup =
@"// Copyright
public class Goo : IGoo
{
public void Test()
{
}
}";
var expectedInterfaceCode =
@"// Copyright
public interface IGoo
{
void Test();
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(23855, "https://github.com/dotnet/roslyn/issues/23855")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestExtractInterface_WithCopyright2()
{
var markup =
@"// Copyright
public class Goo
{
public class $$A
{
public void Test()
{
}
}
}";
var updatedMarkup =
@"// Copyright
public class Goo
{
public class A : IA
{
public void Test()
{
}
}
}";
var expectedInterfaceCode =
@"// Copyright
public interface IA
{
void Test();
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(49739, "https://github.com/dotnet/roslyn/issues/49739")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRecord1()
{
var markup =
@"namespace Test
{
record $$Whatever(int X, string Y);
}";
var updatedMarkup =
@"namespace Test
{
record Whatever(int X, string Y) : IWhatever;
}";
var expectedInterfaceCode =
@"namespace Test
{
interface IWhatever
{
int X { get; init; }
string Y { get; init; }
void Deconstruct(out int X, out string Y);
bool Equals(object obj);
bool Equals(Whatever other);
int GetHashCode();
string ToString();
}
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(49739, "https://github.com/dotnet/roslyn/issues/49739")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRecord2()
{
var markup =
@"namespace Test
{
record $$Whatever(int X, string Y) { }
}";
var updatedMarkup =
@"namespace Test
{
record Whatever(int X, string Y) : IWhatever { }
}";
var expectedInterfaceCode =
@"namespace Test
{
interface IWhatever
{
int X { get; init; }
string Y { get; init; }
void Deconstruct(out int X, out string Y);
bool Equals(object obj);
bool Equals(Whatever other);
int GetHashCode();
string ToString();
}
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(49739, "https://github.com/dotnet/roslyn/issues/49739")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRecord3()
{
var markup =
@"namespace Test
{
/// <summary></summary>
record $$Whatever(int X, string Y);
}";
var updatedMarkup =
@"namespace Test
{
/// <summary></summary>
record Whatever(int X, string Y) : IWhatever;
}";
var expectedInterfaceCode =
@"namespace Test
{
interface IWhatever
{
int X { get; init; }
string Y { get; init; }
void Deconstruct(out int X, out string Y);
bool Equals(object obj);
bool Equals(Whatever other);
int GetHashCode();
string ToString();
}
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using Microsoft.CodeAnalysis.AddImports;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Editor.CSharp.ExtractInterface;
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.Extensions;
using Microsoft.CodeAnalysis.Editor.UnitTests.ExtractInterface;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.ExtractInterface;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
using Roslyn.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ExtractInterface
{
public class ExtractInterfaceTests : AbstractExtractInterfaceTests
{
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_CaretInMethod()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
$$
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_CaretAfterClassClosingBrace()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}
}$$";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_CaretBeforeClassKeyword()
{
var markup = @"
using System;
$$class MyClass
{
public void Goo()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromInnerClass1()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}
class AnotherClass
{
$$public void Bar()
{
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Bar");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromInnerClass2()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}
$$class AnotherClass
{
public async Task Bar()
{
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Bar");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromOuterClass()
{
var markup = @"
using System;
class MyClass
{
public void Goo()
{
}$$
class AnotherClass
{
public async Task Bar()
{
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromInterface()
{
var markup = @"
using System;
interface IMyInterface
{
$$void Goo();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo", expectedInterfaceName: "IMyInterface1");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromStruct()
{
var markup = @"
using System;
struct SomeStruct
{
$$public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo", expectedInterfaceName: "ISomeStruct");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromNamespace()
{
var markup = @"
using System;
namespace Ns$$
{
class MyClass
{
public async Task Goo() { }
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_DoesNotIncludeFields()
{
var markup = @"
using System;
class MyClass
{
$$public int x;
public void Goo()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicProperty_WithGetAndSet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { get; set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Prop");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterfaceAction_ExtractableMembers_IncludesPublicProperty_WithGetAndSet()
{
var markup = @"
class MyClass$$
{
public int Prop { get; set; }
}";
var expectedMarkup = @"
interface IMyClass
{
int Prop { get; set; }
}
class MyClass : IMyClass
{
public int Prop { get; set; }
}";
await TestExtractInterfaceCodeActionCSharpAsync(markup, expectedMarkup);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicProperty_WithGetAndPrivateSet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { get; private set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Prop");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicProperty_WithGet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { get; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Prop");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesPublicProperty_WithPrivateGetAndPrivateSet()
{
var markup = @"
using System;
class MyClass
{
$$public int Prop { private get; private set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicIndexer()
{
var markup = @"
using System;
class MyClass
{
$$public int this[int x] { get { return 5; } set { } }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "this[]");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesInternalIndexer()
{
var markup = @"
using System;
class MyClass
{
$$internal int this[int x] { get { return 5; } set { } }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicMethod()
{
var markup = @"
using System;
class MyClass
{
$$public void M()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "M");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesInternalMethod()
{
var markup = @"
using System;
class MyClass
{
$$internal void M()
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesAbstractMethod()
{
var markup = @"
using System;
abstract class MyClass
{
$$public abstract void M();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "M");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_IncludesPublicEvent()
{
var markup = @"
using System;
class MyClass
{
$$public event Action MyEvent;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "MyEvent");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_ExtractableMembers_ExcludesPrivateEvent()
{
var markup = @"
using System;
class MyClass
{
$$private event Action MyEvent;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_DefaultInterfaceName_DoesNotConflictWithOtherTypeNames()
{
var markup = @"
using System;
class MyClass
{
$$public void Goo() { }
}
interface IMyClass { }
struct IMyClass1 { }
class IMyClass2 { }";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceName: "IMyClass3");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NoNamespace()
{
var markup = @"
using System;
class MyClass
{
$$public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedNamespaceName: "");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_SingleNamespace()
{
var markup = @"
using System;
namespace MyNamespace
{
class MyClass
{
$$public void Goo() { }
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedNamespaceName: "MyNamespace");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedNamespaceName: "OuterNamespace.InnerNamespace");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces_FileScopedNamespace1()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp10),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"namespace OuterNamespace.InnerNamespace;
internal interface IMyClass
{
void Goo();
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces_FileScopedNamespace2()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp9),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"namespace OuterNamespace.InnerNamespace
{
internal interface IMyClass
{
void Goo();
}
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_NamespaceName_NestedNamespaces_FileScopedNamespace3()
{
var markup = @"
using System;
namespace OuterNamespace
{
namespace InnerNamespace
{
class MyClass
{
$$public void Goo() { }
}
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp10),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"namespace OuterNamespace.InnerNamespace
{
internal interface IMyClass
{
void Goo();
}
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_ClassesImplementExtractedInterface()
{
var markup = @"using System;
class MyClass
{
$$public void Goo() { }
}";
var expectedCode = @"using System;
class MyClass : IMyClass
{
public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_StructsImplementExtractedInterface()
{
var markup = @"
using System;
struct MyStruct
{
$$public void Goo() { }
}";
var expectedCode = @"
using System;
struct MyStruct : IMyStruct
{
public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_InterfacesDoNotImplementExtractedInterface()
{
var markup = @"
using System;
interface MyInterface
{
$$void Goo();
}";
var expectedCode = @"
using System;
interface MyInterface
{
void Goo();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Methods()
{
var markup = @"
using System;
abstract class MyClass$$
{
public void ExtractableMethod_Normal() { }
public void ExtractableMethod_ParameterTypes(System.Diagnostics.CorrelationManager x, Nullable<Int32> y = 7, string z = ""42"") { }
public abstract void ExtractableMethod_Abstract();
unsafe public void NotActuallyUnsafeMethod(int p) { }
unsafe public void UnsafeMethod(int *p) { }
}";
var expectedInterfaceCode = @"using System.Diagnostics;
interface IMyClass
{
void ExtractableMethod_Abstract();
void ExtractableMethod_Normal();
void ExtractableMethod_ParameterTypes(CorrelationManager x, int? y = 7, string z = ""42"");
void NotActuallyUnsafeMethod(int p);
unsafe void UnsafeMethod(int* p);
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_MethodsInRecord()
{
var markup = @"
abstract record R$$
{
public void M() { }
}";
var expectedInterfaceCode = @"interface IR
{
bool Equals(object obj);
bool Equals(R other);
int GetHashCode();
void M();
string ToString();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Events()
{
var markup = @"
using System;
abstract internal class MyClass$$
{
public event Action ExtractableEvent1;
public event Action<Nullable<Int32>> ExtractableEvent2;
}";
var expectedInterfaceCode = @"using System;
internal interface IMyClass
{
event Action ExtractableEvent1;
event Action<int?> ExtractableEvent2;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Properties()
{
var markup = @"
using System;
abstract class MyClass$$
{
public int ExtractableProp { get; set; }
public int ExtractableProp_GetOnly { get { return 1; } }
public int ExtractableProp_SetOnly { set { } }
public int ExtractableProp_SetPrivate { get; private set; }
public int ExtractableProp_GetPrivate { private get; set; }
public int ExtractableProp_SetInternal { get; internal set; }
public int ExtractableProp_GetInternal { internal get; set; }
unsafe public int NotActuallyUnsafeProp { get; set; }
unsafe public int* UnsafeProp { get; set; }
}";
var expectedInterfaceCode = @"interface IMyClass
{
int ExtractableProp { get; set; }
int ExtractableProp_GetOnly { get; }
int ExtractableProp_SetOnly { set; }
int ExtractableProp_SetPrivate { get; }
int ExtractableProp_GetPrivate { set; }
int ExtractableProp_SetInternal { get; }
int ExtractableProp_GetInternal { set; }
int NotActuallyUnsafeProp { get; set; }
unsafe int* UnsafeProp { get; set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Indexers()
{
var markup = @"
using System;
abstract class MyClass$$
{
public int this[int x] { set { } }
public int this[string x] { get { return 1; } }
public int this[double x] { get { return 1; } set { } }
public int this[Nullable<Int32> x, string y = ""42""] { get { return 1; } set { } }
}";
var expectedInterfaceCode = @"interface IMyClass
{
int this[int x] { set; }
int this[string x] { get; }
int this[double x] { get; set; }
int this[int? x, string y = ""42""] { get; set; }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_Imports()
{
var markup = @"
public class Class
{
$$public System.Diagnostics.BooleanSwitch M1(System.Globalization.Calendar x) { return null; }
public void M2(System.Collections.Generic.List<System.IO.BinaryWriter> x) { }
public void M3<T>() where T : System.Net.WebProxy { }
}";
var expectedInterfaceCode = @"using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
public interface IClass
{
BooleanSwitch M1(Calendar x);
void M2(List<BinaryWriter> x);
void M3<T>() where T : WebProxy;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_ImportsInsideNamespace()
{
var markup = @"
namespace N
{
public class Class
{
$$public System.Diagnostics.BooleanSwitch M1(System.Globalization.Calendar x) { return null; }
public void M2(System.Collections.Generic.List<System.IO.BinaryWriter> x) { }
public void M3<T>() where T : System.Net.WebProxy { }
}
}";
var expectedInterfaceCode = @"namespace N
{
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
public interface IClass
{
BooleanSwitch M1(Calendar x);
void M2(List<BinaryWriter> x);
void M3<T>() where T : WebProxy;
}
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp10),
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, AddImportPlacement.InsideNamespace }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(expectedInterfaceCode, interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters1()
{
var markup = @"
public class Class<A, B, C, D, E, F, G, H, NO1> where E : F
{
$$public void Goo1(A a) { }
public B Goo2() { return default(B); }
public void Goo3(List<C> list) { }
public event Func<D> Goo4;
public List<E> Prop { set { } }
public List<G> this[List<List<H>> list] { set { } }
public void Bar1() { var x = default(NO1); }
}";
var expectedInterfaceCode = @"public interface IClass<A, B, C, D, E, F, G, H> where E : F
{
List<G> this[List<List<H>> list] { set; }
List<E> Prop { set; }
event Func<D> Goo4;
void Bar1();
void Goo1(A a);
B Goo2();
void Goo3(List<C> list);
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters2()
{
var markup = @"using System.Collections.Generic;
class Program<A, B, C, D, E> where A : List<B> where B : Dictionary<List<D>, List<E>>
{
$$public void Goo<T>(T t) where T : List<A> { }
}";
var expectedInterfaceCode = @"using System.Collections.Generic;
interface IProgram<A, B, D, E>
where A : List<B>
where B : Dictionary<List<D>, List<E>>
{
void Goo<T>(T t) where T : List<A>;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters3()
{
var markup = @"
class $$Class1<A, B>
{
public void method(A P1, Class2 P2)
{
}
public class Class2
{
}
}";
var expectedInterfaceCode = @"interface IClass1<A, B>
{
void method(A P1, Class1<A, B>.Class2 P2);
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_TypeParameters4()
{
var markup = @"
class C1<A>
{
public class C2<B> where B : new()
{
public class C3<C> where C : System.Collections.ICollection
{
public class C4
{$$
public A method() { return default(A); }
public B property { set { } }
public C this[int i] { get { return default(C); } }
}
}
}
}";
var expectedInterfaceCode = @"using System.Collections;
public interface IC4<A, B, C>
where B : new()
where C : ICollection
{
C this[int i] { get; }
B property { set; }
A method();
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode: expectedInterfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_AccessibilityModifiers()
{
var markup = @"
using System;
abstract class MyClass$$
{
public void Goo() { }
}";
using var testState = ExtractInterfaceTestState.Create(
markup, LanguageNames.CSharp,
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CodeStyleOptions2.RequireAccessibilityModifiers, AccessibilityModifiersRequired.Always, NotificationOption2.Silent }
});
var result = await testState.ExtractViaCommandAsync();
var interfaceDocument = result.UpdatedSolution.GetRequiredDocument(result.NavigationDocumentId);
var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Assert.Equal(@"internal interface IMyClass
{
void Goo();
}", interfaceCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_NewBaseListNonGeneric()
{
var markup = @"
class Program
{
$$public void Goo() { }
}";
var expectedCode = @"
class Program : IProgram
{
public void Goo() { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_NewBaseListGeneric()
{
var markup = @"
class Program<T>
{
$$public void Goo(T t) { }
}";
var expectedCode = @"
class Program<T> : IProgram<T>
{
public void Goo(T t) { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_NewBaseListWithWhereClause()
{
var markup = @"
class Program<T, U> where T : U
{
$$public void Goo(T t, U u) { }
}";
var expectedCode = @"
class Program<T, U> : IProgram<T, U> where T : U
{
public void Goo(T t, U u) { }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList1()
{
var markup = @"
class Program : ISomeInterface
{
$$public void Goo() { }
}
interface ISomeInterface {}";
var expectedCode = @"
class Program : ISomeInterface, IProgram
{
public void Goo() { }
}
interface ISomeInterface {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList2()
{
var markup = @"
class Program<T, U> : ISomeInterface<T>
{
$$public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}";
var expectedCode = @"
class Program<T, U> : ISomeInterface<T>, IProgram<T, U>
{
public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList3()
{
var markup = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U>
{
$$public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
var expectedCode = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U>, IProgram<T, U>
{
public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_CodeGen_BaseList_LargerBaseList4()
{
var markup = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U> where T : U
{
$$public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
var expectedCode = @"
class Program<T, U> : ISomeInterface<T>, ISomeInterface2<T, U>, IProgram<T, U> where T : U
{
public void Goo(T t, U u) { }
}
interface ISomeInterface<T> {}
interface ISomeInterface2<T, U> {}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedUpdatedOriginalDocumentCode: expectedCode);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly1()
{
var markup = @"
interface ISomeInterface<T> {}
class Program<T, U> : ISomeInterface<T> where T : U
{
$$public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly2()
{
var markup = @"
interface ISomeInterface<T> {}
class Program<T, U> $$: ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly3()
{
var markup = @"
interface ISomeInterface<T> {}
class$$ Program<T, U> : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly4()
{
var markup = @"
interface ISomeInterface<T> {}
class Program<T, U>$$ : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly5()
{
var markup = @"
interface ISomeInterface<T> {}
class Program $$ <T, U> : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly6()
{
var markup = @"
interface ISomeInterface<T> {}
class $$Program <T, U> : ISomeInterface<T> where T : U
{
public void Goo(T t, U u) { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly7()
{
var markup = @"
interface ISomeInterface<T> {}
class $$Program : ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly8()
{
var markup = @"
interface ISomeInterface<T> {}
class Program$$ : ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly9()
{
var markup = @"
interface ISomeInterface<T> {}
class$$ Program : ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_TypeDiscovery_NameOnly10()
{
var markup = @"
interface ISomeInterface<T> {}
class Program $$: ISomeInterface<object>
{
public void Goo() { }
}";
await TestTypeDiscoveryAsync(markup, TypeDiscoveryRule.TypeNameOnly, expectedExtractable: false);
}
private static async Task TestTypeDiscoveryAsync(
string markup,
TypeDiscoveryRule typeDiscoveryRule,
bool expectedExtractable)
{
using var testState = ExtractInterfaceTestState.Create(markup, LanguageNames.CSharp, compilationOptions: null);
var result = await testState.GetTypeAnalysisResultAsync(typeDiscoveryRule);
Assert.Equal(expectedExtractable, result.CanExtractInterface);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_GeneratedNameTypeParameterSuffix1()
{
var markup = @"
class $$Test<T>
{
public void M(T a) { }
}";
var expectedTypeParameterSuffix = @"<T>";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_GeneratedNameTypeParameterSuffix2()
{
var markup = @"
class $$Test<T, U>
{
public void M(T a) { }
}";
var expectedTypeParameterSuffix = @"<T>";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_GeneratedNameTypeParameterSuffix3()
{
var markup = @"
class $$Test<T, U>
{
public void M(T a, U b) { }
}";
var expectedTypeParameterSuffix = @"<T, U>";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ExtractInterface)]
[Trait(Traits.Feature, Traits.Features.Interactive)]
public void ExtractInterfaceCommandDisabledInSubmission()
{
using var workspace = TestWorkspace.Create(XElement.Parse(@"
<Workspace>
<Submission Language=""C#"" CommonReferences=""true"">
public class $$C
{
public void M() { }
}
</Submission>
</Workspace> "),
workspaceKind: WorkspaceKind.Interactive,
composition: EditorTestCompositions.EditorFeaturesWpf);
// Force initialization.
workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
var textView = workspace.Documents.Single().GetTextView();
var handler = workspace.ExportProvider.GetCommandHandler<ExtractInterfaceCommandHandler>(PredefinedCommandHandlerNames.ExtractInterface, ContentTypeNames.CSharpContentType);
var state = handler.GetCommandState(new ExtractInterfaceCommandArgs(textView, textView.TextBuffer));
Assert.True(state.IsUnspecified);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestInWithMethod_Parameters()
{
var markup = @"
using System;
class $$TestClass
{
public void Method(in int p1)
{
}
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
void Method(in int p1);
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRefReadOnlyWithMethod_ReturnType()
{
var markup = @"
using System;
class $$TestClass
{
public ref readonly int Method() => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
ref readonly int Method();
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRefReadOnlyWithProperty()
{
var markup = @"
using System;
class $$TestClass
{
public ref readonly int Property => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
ref readonly int Property { get; }
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestInWithIndexer_Parameters()
{
var markup = @"
using System;
class $$TestClass
{
public int this[in int p1] { set { } }
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
int this[in int p1] { set; }
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRefReadOnlyWithIndexer_ReturnType()
{
var markup = @"
using System;
class $$TestClass
{
public ref readonly int this[int p1] => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
ref readonly int this[int p1] { get; }
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestUnmanagedConstraint_Type()
{
var markup = @"
class $$TestClass<T> where T : unmanaged
{
public void M(T arg) => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass<T> where T : unmanaged
{
void M(T arg);
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestUnmanagedConstraint_Method()
{
var markup = @"
class $$TestClass
{
public void M<T>() where T : unmanaged => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
void M<T>() where T : unmanaged;
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestNotNullConstraint_Type()
{
var markup = @"
class $$TestClass<T> where T : notnull
{
public void M(T arg) => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass<T> where T : notnull
{
void M(T arg);
}");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestNotNullConstraint_Method()
{
var markup = @"
class $$TestClass
{
public void M<T>() where T : notnull => throw null;
}";
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedInterfaceCode:
@"interface ITestClass
{
void M<T>() where T : notnull;
}");
}
[WorkItem(23855, "https://github.com/dotnet/roslyn/issues/23855")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestExtractInterface_WithCopyright1()
{
var markup =
@"// Copyright
public class $$Goo
{
public void Test()
{
}
}";
var updatedMarkup =
@"// Copyright
public class Goo : IGoo
{
public void Test()
{
}
}";
var expectedInterfaceCode =
@"// Copyright
public interface IGoo
{
void Test();
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(23855, "https://github.com/dotnet/roslyn/issues/23855")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestExtractInterface_WithCopyright2()
{
var markup =
@"// Copyright
public class Goo
{
public class $$A
{
public void Test()
{
}
}
}";
var updatedMarkup =
@"// Copyright
public class Goo
{
public class A : IA
{
public void Test()
{
}
}
}";
var expectedInterfaceCode =
@"// Copyright
public interface IA
{
void Test();
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(49739, "https://github.com/dotnet/roslyn/issues/49739")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRecord1()
{
var markup =
@"namespace Test
{
record $$Whatever(int X, string Y);
}";
var updatedMarkup =
@"namespace Test
{
record Whatever(int X, string Y) : IWhatever;
}";
var expectedInterfaceCode =
@"namespace Test
{
interface IWhatever
{
int X { get; init; }
string Y { get; init; }
void Deconstruct(out int X, out string Y);
bool Equals(object obj);
bool Equals(Whatever other);
int GetHashCode();
string ToString();
}
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(49739, "https://github.com/dotnet/roslyn/issues/49739")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRecord2()
{
var markup =
@"namespace Test
{
record $$Whatever(int X, string Y) { }
}";
var updatedMarkup =
@"namespace Test
{
record Whatever(int X, string Y) : IWhatever { }
}";
var expectedInterfaceCode =
@"namespace Test
{
interface IWhatever
{
int X { get; init; }
string Y { get; init; }
void Deconstruct(out int X, out string Y);
bool Equals(object obj);
bool Equals(Whatever other);
int GetHashCode();
string ToString();
}
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
[WorkItem(49739, "https://github.com/dotnet/roslyn/issues/49739")]
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task TestRecord3()
{
var markup =
@"namespace Test
{
/// <summary></summary>
record $$Whatever(int X, string Y);
}";
var updatedMarkup =
@"namespace Test
{
/// <summary></summary>
record Whatever(int X, string Y) : IWhatever;
}";
var expectedInterfaceCode =
@"namespace Test
{
interface IWhatever
{
int X { get; init; }
string Y { get; init; }
void Deconstruct(out int X, out string Y);
bool Equals(object obj);
bool Equals(Whatever other);
int GetHashCode();
string ToString();
}
}";
await TestExtractInterfaceCommandCSharpAsync(
markup,
expectedSuccess: true,
expectedUpdatedOriginalDocumentCode: updatedMarkup,
expectedInterfaceCode: expectedInterfaceCode);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeFixes.AddExplicitCast
{
internal abstract partial class AbstractAddExplicitCastCodeFixProvider<TExpressionSyntax> : SyntaxEditorBasedCodeFixProvider
where TExpressionSyntax : SyntaxNode
{
/// <summary>
/// Give a set of least specific types with a limit, and the part exceeding the limit doesn't show any code fix,
/// but logs telemetry
/// </summary>
private const int MaximumConversionOptions = 3;
protected AbstractAddExplicitCastCodeFixProvider(ISyntaxFacts syntaxFacts)
=> SyntaxFacts = syntaxFacts;
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile;
protected ISyntaxFacts SyntaxFacts { get; }
protected abstract SyntaxNode ApplyFix(SyntaxNode currentRoot, TExpressionSyntax targetNode, ITypeSymbol conversionType);
protected abstract CommonConversion ClassifyConversion(SemanticModel semanticModel, TExpressionSyntax expression, ITypeSymbol type);
/// <summary>
/// Output the current type information of the target node and the conversion type(s) that the target node is
/// going to be cast by.
/// Implicit downcast can appear on Variable Declaration, Return Statement, Function Invocation, Attribute
/// <para/>
/// For example:
/// Base b; Derived d = [||]b;
/// "b" is the current node with type "Base", and the potential conversion types list which "b" can be cast by
/// is {Derived}
/// </summary>
/// <param name="diagnosticId">The Id of diagonostic</param>
/// <param name="spanNode">the innermost node that contains the span</param>
/// <param name="potentialConversionTypes"> Output (target expression, potential conversion type) pairs</param>
/// <returns>
/// True, if there is at least one potential conversion pair, and they are assigned to "potentialConversionTypes"
/// False, if there is no potential conversion pair.
/// </returns>
protected abstract bool TryGetTargetTypeInfo(
Document document, SemanticModel semanticModel, SyntaxNode root,
string diagnosticId, TExpressionSyntax spanNode, CancellationToken cancellationToken,
out ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> potentialConversionTypes);
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var cancellationToken = context.CancellationToken;
var diagnostic = context.Diagnostics.First();
var root = await document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true)
.GetAncestorsOrThis<TExpressionSyntax>().FirstOrDefault();
if (spanNode == null)
return;
var hasSolution = TryGetTargetTypeInfo(document,
semanticModel, root, diagnostic.Id, spanNode, cancellationToken,
out var potentialConversionTypes);
if (!hasSolution)
return;
if (potentialConversionTypes.Length == 1)
{
context.RegisterCodeFix(new MyCodeAction(
FeaturesResources.Add_explicit_cast,
c => FixAsync(context.Document, context.Diagnostics.First(), c)),
context.Diagnostics);
return;
}
using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions);
// MaximumConversionOptions: we show at most [MaximumConversionOptions] options for this code fixer
for (var i = 0; i < Math.Min(MaximumConversionOptions, potentialConversionTypes.Length); i++)
{
var targetNode = potentialConversionTypes[i].node;
var conversionType = potentialConversionTypes[i].type;
actions.Add(new MyCodeAction(
GetSubItemName(semanticModel, targetNode.SpanStart, conversionType),
_ => Task.FromResult(document.WithSyntaxRoot(ApplyFix(root, targetNode, conversionType)))));
}
ReportTelemetryIfNecessary(potentialConversionTypes);
context.RegisterCodeFix(new CodeAction.CodeActionWithNestedActions(
FeaturesResources.Add_explicit_cast,
actions.ToImmutable(), isInlinable: false),
context.Diagnostics);
}
private static string GetSubItemName(SemanticModel semanticModel, int position, ITypeSymbol conversionType)
{
return string.Format(
FeaturesResources.Convert_type_to_0,
conversionType.ToMinimalDisplayString(semanticModel, position));
}
private static void ReportTelemetryIfNecessary(ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> potentialConversionTypes)
{
if (potentialConversionTypes.Length > MaximumConversionOptions)
{
// If the number of potential conversion types is larger than options we could show, report telemetry
Logger.Log(FunctionId.CodeFixes_AddExplicitCast,
KeyValueLogMessage.Create(m =>
{
m["NumberOfCandidates"] = potentialConversionTypes.Length;
}));
}
}
protected ImmutableArray<(TExpressionSyntax, ITypeSymbol)> FilterValidPotentialConversionTypes(
SemanticModel semanticModel,
ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> mutablePotentialConversionTypes)
{
using var _ = ArrayBuilder<(TExpressionSyntax, ITypeSymbol)>.GetInstance(out var validPotentialConversionTypes);
foreach (var conversionTuple in mutablePotentialConversionTypes)
{
var targetNode = conversionTuple.node;
var targetNodeConversionType = conversionTuple.type;
// For cases like object creation expression. for example:
// Derived d = [||]new Base();
// It is always invalid except the target node has explicit conversion operator or is numeric.
if (SyntaxFacts.IsObjectCreationExpression(targetNode)
&& !ClassifyConversion(semanticModel, targetNode, targetNodeConversionType).IsUserDefined)
{
continue;
}
validPotentialConversionTypes.Add(conversionTuple);
}
return validPotentialConversionTypes.Distinct().ToImmutableArray();
}
protected static bool FindCorrespondingParameterByName(
string argumentName, ImmutableArray<IParameterSymbol> parameters, ref int parameterIndex)
{
for (var j = 0; j < parameters.Length; j++)
{
if (argumentName.Equals(parameters[j].Name))
{
parameterIndex = j;
return true;
}
}
return false;
}
protected override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var spanNodes = diagnostics.SelectAsArray(
d => root.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true)
.GetAncestorsOrThis<TExpressionSyntax>().First());
await editor.ApplyExpressionLevelSemanticEditsAsync(
document, spanNodes,
(semanticModel, spanNode) => true,
(semanticModel, currentRoot, spanNode) =>
{
// All diagnostics have the same error code
if (TryGetTargetTypeInfo(document, semanticModel, currentRoot, diagnostics[0].Id, spanNode,
cancellationToken, out var potentialConversionTypes)
&& potentialConversionTypes.Length == 1)
{
return ApplyFix(currentRoot, potentialConversionTypes[0].node, potentialConversionTypes[0].type);
}
return currentRoot;
},
cancellationToken).ConfigureAwait(false);
}
private class MyCodeAction : CodeAction.DocumentChangeAction
{
public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument)
: base(title, createChangedDocument, equivalenceKey: title)
{
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeFixes.AddExplicitCast
{
internal abstract partial class AbstractAddExplicitCastCodeFixProvider<TExpressionSyntax> : SyntaxEditorBasedCodeFixProvider
where TExpressionSyntax : SyntaxNode
{
/// <summary>
/// Give a set of least specific types with a limit, and the part exceeding the limit doesn't show any code fix,
/// but logs telemetry
/// </summary>
private const int MaximumConversionOptions = 3;
protected AbstractAddExplicitCastCodeFixProvider(ISyntaxFacts syntaxFacts)
=> SyntaxFacts = syntaxFacts;
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile;
protected ISyntaxFacts SyntaxFacts { get; }
protected abstract SyntaxNode ApplyFix(SyntaxNode currentRoot, TExpressionSyntax targetNode, ITypeSymbol conversionType);
protected abstract CommonConversion ClassifyConversion(SemanticModel semanticModel, TExpressionSyntax expression, ITypeSymbol type);
/// <summary>
/// Output the current type information of the target node and the conversion type(s) that the target node is
/// going to be cast by.
/// Implicit downcast can appear on Variable Declaration, Return Statement, Function Invocation, Attribute
/// <para/>
/// For example:
/// Base b; Derived d = [||]b;
/// "b" is the current node with type "Base", and the potential conversion types list which "b" can be cast by
/// is {Derived}
/// </summary>
/// <param name="diagnosticId">The Id of diagonostic</param>
/// <param name="spanNode">the innermost node that contains the span</param>
/// <param name="potentialConversionTypes"> Output (target expression, potential conversion type) pairs</param>
/// <returns>
/// True, if there is at least one potential conversion pair, and they are assigned to "potentialConversionTypes"
/// False, if there is no potential conversion pair.
/// </returns>
protected abstract bool TryGetTargetTypeInfo(
Document document, SemanticModel semanticModel, SyntaxNode root,
string diagnosticId, TExpressionSyntax spanNode, CancellationToken cancellationToken,
out ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> potentialConversionTypes);
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var cancellationToken = context.CancellationToken;
var diagnostic = context.Diagnostics.First();
var root = await document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true)
.GetAncestorsOrThis<TExpressionSyntax>().FirstOrDefault();
if (spanNode == null)
return;
var hasSolution = TryGetTargetTypeInfo(document,
semanticModel, root, diagnostic.Id, spanNode, cancellationToken,
out var potentialConversionTypes);
if (!hasSolution)
return;
if (potentialConversionTypes.Length == 1)
{
context.RegisterCodeFix(new MyCodeAction(
FeaturesResources.Add_explicit_cast,
c => FixAsync(context.Document, context.Diagnostics.First(), c)),
context.Diagnostics);
return;
}
using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions);
// MaximumConversionOptions: we show at most [MaximumConversionOptions] options for this code fixer
for (var i = 0; i < Math.Min(MaximumConversionOptions, potentialConversionTypes.Length); i++)
{
var targetNode = potentialConversionTypes[i].node;
var conversionType = potentialConversionTypes[i].type;
actions.Add(new MyCodeAction(
GetSubItemName(semanticModel, targetNode.SpanStart, conversionType),
_ => Task.FromResult(document.WithSyntaxRoot(ApplyFix(root, targetNode, conversionType)))));
}
ReportTelemetryIfNecessary(potentialConversionTypes);
context.RegisterCodeFix(new CodeAction.CodeActionWithNestedActions(
FeaturesResources.Add_explicit_cast,
actions.ToImmutable(), isInlinable: false),
context.Diagnostics);
}
private static string GetSubItemName(SemanticModel semanticModel, int position, ITypeSymbol conversionType)
{
return string.Format(
FeaturesResources.Convert_type_to_0,
conversionType.ToMinimalDisplayString(semanticModel, position));
}
private static void ReportTelemetryIfNecessary(ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> potentialConversionTypes)
{
if (potentialConversionTypes.Length > MaximumConversionOptions)
{
// If the number of potential conversion types is larger than options we could show, report telemetry
Logger.Log(FunctionId.CodeFixes_AddExplicitCast,
KeyValueLogMessage.Create(m =>
{
m["NumberOfCandidates"] = potentialConversionTypes.Length;
}));
}
}
protected ImmutableArray<(TExpressionSyntax, ITypeSymbol)> FilterValidPotentialConversionTypes(
SemanticModel semanticModel,
ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> mutablePotentialConversionTypes)
{
using var _ = ArrayBuilder<(TExpressionSyntax, ITypeSymbol)>.GetInstance(out var validPotentialConversionTypes);
foreach (var conversionTuple in mutablePotentialConversionTypes)
{
var targetNode = conversionTuple.node;
var targetNodeConversionType = conversionTuple.type;
// For cases like object creation expression. for example:
// Derived d = [||]new Base();
// It is always invalid except the target node has explicit conversion operator or is numeric.
if (SyntaxFacts.IsObjectCreationExpression(targetNode)
&& !ClassifyConversion(semanticModel, targetNode, targetNodeConversionType).IsUserDefined)
{
continue;
}
validPotentialConversionTypes.Add(conversionTuple);
}
return validPotentialConversionTypes.Distinct().ToImmutableArray();
}
protected static bool FindCorrespondingParameterByName(
string argumentName, ImmutableArray<IParameterSymbol> parameters, ref int parameterIndex)
{
for (var j = 0; j < parameters.Length; j++)
{
if (argumentName.Equals(parameters[j].Name))
{
parameterIndex = j;
return true;
}
}
return false;
}
protected override async Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var spanNodes = diagnostics.SelectAsArray(
d => root.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true)
.GetAncestorsOrThis<TExpressionSyntax>().First());
await editor.ApplyExpressionLevelSemanticEditsAsync(
document, spanNodes,
(semanticModel, spanNode) => true,
(semanticModel, currentRoot, spanNode) =>
{
// All diagnostics have the same error code
if (TryGetTargetTypeInfo(document, semanticModel, currentRoot, diagnostics[0].Id, spanNode,
cancellationToken, out var potentialConversionTypes)
&& potentialConversionTypes.Length == 1)
{
return ApplyFix(currentRoot, potentialConversionTypes[0].node, potentialConversionTypes[0].type);
}
return currentRoot;
},
cancellationToken).ConfigureAwait(false);
}
private class MyCodeAction : CodeAction.DocumentChangeAction
{
public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument)
: base(title, createChangedDocument, equivalenceKey: title)
{
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/CoreTest/TestCompositionTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests.Persistence;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
public class TestCompositionTests
{
[Fact]
public void FactoryReuse()
{
var composition1 = FeaturesTestCompositions.Features.AddParts(typeof(TestPersistenceService), typeof(TestOptionsServiceFactory));
var composition2 = FeaturesTestCompositions.Features.AddParts(typeof(TestOptionsServiceFactory), typeof(TestPersistenceService));
Assert.Same(composition1.ExportProviderFactory, composition2.ExportProviderFactory);
}
[Fact]
public void Assemblies()
{
var assembly1 = typeof(Workspace).Assembly;
var assembly2 = typeof(object).Assembly;
var composition1 = TestComposition.Empty;
var composition2 = composition1.AddAssemblies(assembly1);
AssertEx.SetEqual(new[] { assembly1 }, composition2.Assemblies);
Assert.Empty(composition2.RemoveAssemblies(assembly1).Assemblies);
var composition3 = composition2.WithAssemblies(ImmutableHashSet.Create(assembly2));
AssertEx.SetEqual(new[] { assembly2 }, composition3.Assemblies);
}
[Fact]
public void Parts()
{
var type1 = typeof(int);
var type2 = typeof(bool);
var composition1 = TestComposition.Empty;
var composition2 = composition1.AddParts(type1);
var composition3 = composition2.RemoveParts(type1);
AssertEx.SetEqual(new[] { type1 }, composition2.Parts);
Assert.Empty(composition3.Parts);
Assert.Empty(composition3.ExcludedPartTypes);
var composition4 = composition2.WithParts(ImmutableHashSet.Create(type2));
AssertEx.SetEqual(new[] { type2 }, composition4.Parts);
Assert.Empty(composition3.ExcludedPartTypes);
}
[Fact]
public void ExcludedPartTypes()
{
var type1 = typeof(int);
var type2 = typeof(bool);
var composition1 = TestComposition.Empty;
var composition2 = composition1.AddExcludedPartTypes(type1);
var composition3 = composition2.RemoveExcludedPartTypes(type1);
AssertEx.SetEqual(new[] { type1 }, composition2.ExcludedPartTypes);
Assert.Empty(composition3.Parts);
Assert.Empty(composition3.ExcludedPartTypes);
Assert.Empty(composition3.Parts);
var composition4 = composition2.WithExcludedPartTypes(ImmutableHashSet.Create(type2));
AssertEx.SetEqual(new[] { type2 }, composition4.ExcludedPartTypes);
Assert.Empty(composition4.Parts);
}
[Fact]
public void Composition()
{
var assembly1 = typeof(Workspace).Assembly;
var assembly2 = typeof(object).Assembly;
var type1 = typeof(int);
var type2 = typeof(long);
var excluded1 = typeof(bool);
var excluded2 = typeof(byte);
var composition1 = TestComposition.Empty.AddAssemblies(assembly1).AddParts(type1).AddExcludedPartTypes(excluded1);
var composition2 = TestComposition.Empty.AddAssemblies(assembly2).AddParts(type1, type2).AddExcludedPartTypes(excluded2);
var composition3 = composition1.Add(composition2);
AssertEx.SetEqual(new[] { assembly1, assembly2 }, composition3.Assemblies);
AssertEx.SetEqual(new[] { type1, type2 }, composition3.Parts);
AssertEx.SetEqual(new[] { excluded1, excluded2 }, composition3.ExcludedPartTypes);
var composition4 = composition3.Remove(composition1);
AssertEx.SetEqual(new[] { assembly2 }, composition4.Assemblies);
AssertEx.SetEqual(new[] { type2 }, composition4.Parts);
AssertEx.SetEqual(new[] { excluded2 }, composition4.ExcludedPartTypes);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests.Persistence;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
public class TestCompositionTests
{
[Fact]
public void FactoryReuse()
{
var composition1 = FeaturesTestCompositions.Features.AddParts(typeof(TestPersistenceService), typeof(TestOptionsServiceFactory));
var composition2 = FeaturesTestCompositions.Features.AddParts(typeof(TestOptionsServiceFactory), typeof(TestPersistenceService));
Assert.Same(composition1.ExportProviderFactory, composition2.ExportProviderFactory);
}
[Fact]
public void Assemblies()
{
var assembly1 = typeof(Workspace).Assembly;
var assembly2 = typeof(object).Assembly;
var composition1 = TestComposition.Empty;
var composition2 = composition1.AddAssemblies(assembly1);
AssertEx.SetEqual(new[] { assembly1 }, composition2.Assemblies);
Assert.Empty(composition2.RemoveAssemblies(assembly1).Assemblies);
var composition3 = composition2.WithAssemblies(ImmutableHashSet.Create(assembly2));
AssertEx.SetEqual(new[] { assembly2 }, composition3.Assemblies);
}
[Fact]
public void Parts()
{
var type1 = typeof(int);
var type2 = typeof(bool);
var composition1 = TestComposition.Empty;
var composition2 = composition1.AddParts(type1);
var composition3 = composition2.RemoveParts(type1);
AssertEx.SetEqual(new[] { type1 }, composition2.Parts);
Assert.Empty(composition3.Parts);
Assert.Empty(composition3.ExcludedPartTypes);
var composition4 = composition2.WithParts(ImmutableHashSet.Create(type2));
AssertEx.SetEqual(new[] { type2 }, composition4.Parts);
Assert.Empty(composition3.ExcludedPartTypes);
}
[Fact]
public void ExcludedPartTypes()
{
var type1 = typeof(int);
var type2 = typeof(bool);
var composition1 = TestComposition.Empty;
var composition2 = composition1.AddExcludedPartTypes(type1);
var composition3 = composition2.RemoveExcludedPartTypes(type1);
AssertEx.SetEqual(new[] { type1 }, composition2.ExcludedPartTypes);
Assert.Empty(composition3.Parts);
Assert.Empty(composition3.ExcludedPartTypes);
Assert.Empty(composition3.Parts);
var composition4 = composition2.WithExcludedPartTypes(ImmutableHashSet.Create(type2));
AssertEx.SetEqual(new[] { type2 }, composition4.ExcludedPartTypes);
Assert.Empty(composition4.Parts);
}
[Fact]
public void Composition()
{
var assembly1 = typeof(Workspace).Assembly;
var assembly2 = typeof(object).Assembly;
var type1 = typeof(int);
var type2 = typeof(long);
var excluded1 = typeof(bool);
var excluded2 = typeof(byte);
var composition1 = TestComposition.Empty.AddAssemblies(assembly1).AddParts(type1).AddExcludedPartTypes(excluded1);
var composition2 = TestComposition.Empty.AddAssemblies(assembly2).AddParts(type1, type2).AddExcludedPartTypes(excluded2);
var composition3 = composition1.Add(composition2);
AssertEx.SetEqual(new[] { assembly1, assembly2 }, composition3.Assemblies);
AssertEx.SetEqual(new[] { type1, type2 }, composition3.Parts);
AssertEx.SetEqual(new[] { excluded1, excluded2 }, composition3.ExcludedPartTypes);
var composition4 = composition3.Remove(composition1);
AssertEx.SetEqual(new[] { assembly2 }, composition4.Assemblies);
AssertEx.SetEqual(new[] { type2 }, composition4.Parts);
AssertEx.SetEqual(new[] { excluded2 }, composition4.ExcludedPartTypes);
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Analyzers/CSharp/Tests/RemoveUnnecessaryImports/RemoveUnnecessaryImportsTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Testing;
using Roslyn.Test.Utilities;
using Xunit;
using VerifyCS = Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions.CSharpCodeFixVerifier<
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsCodeFixProvider>;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryImports
{
public class RemoveUnnecessaryImportsTests
{
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNoReferences()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}",
@"class Program
{
static void Main(string[] args)
{
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNoReferencesWithCopyright()
{
await VerifyCS.VerifyCodeFixAsync(
@"// Copyright (c) Somebody.
[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}",
@"// Copyright (c) Somebody.
class Program
{
static void Main(string[] args)
{
}
}");
}
[WorkItem(27006, "https://github.com/dotnet/roslyn/issues/27006")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestReferencesWithCopyrightAndPreservableTrivia()
{
await VerifyCS.VerifyCodeFixAsync(
@"// Copyright (c) Somebody.
[|using System;
{|IDE0005:using System.Collections.Generic;
// This is important
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
Action a;
}
}",
@"// Copyright (c) Somebody.
using System;
// This is important
class Program
{
static void Main(string[] args)
{
Action a;
}
}");
}
[WorkItem(27006, "https://github.com/dotnet/roslyn/issues/27006")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestReferencesWithCopyrightAndGroupings()
{
await VerifyCS.VerifyCodeFixAsync(
@"// Copyright (c) Somebody.
[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
Action a;
}
}",
@"// Copyright (c) Somebody.
using System;
class Program
{
static void Main(string[] args)
{
Action a;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestIdentifierReferenceInTypeContext()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}",
@"using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestGeneratedCode()
{
var source = @"// <auto-generated/>
[|{|IDE0005_gen:using System;|}
using System.Collections.Generic;
{|IDE0005_gen:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
List<int> d;
}
}";
var fixedSource = @"// <auto-generated/>
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List<int> d;
}
}";
// Fix All operations in generated code do not apply changes
var batchFixedSource = source;
await new VerifyCS.Test
{
TestCode = source,
FixedCode = fixedSource,
BatchFixedState =
{
Sources = { batchFixedSource },
MarkupHandling = MarkupMode.Allow,
},
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestGenericReferenceInTypeContext()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;|}
using System.Collections.Generic;
{|IDE0005:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}",
@"using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMultipleReferences()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
using System.Collections.Generic;
{|IDE0005:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
List<int> list;
DateTime d;
}
}",
@"using System;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List<int> list;
DateTime d;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestExtensionMethodReference()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;|}
using System.Linq;|]
class Program
{
static void Main(string[] args)
{
args.Where(a => a.Length > 10);
}
}",
@"using System.Linq;
class Program
{
static void Main(string[] args)
{
args.Where(a => a.Length > 10);
}
}");
}
[WorkItem(541827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541827")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestExtensionMethodLinq()
{
// NOTE: Intentionally not running this test with Script options, because in Script,
// NOTE: class "Goo" is placed inside the script class, and can't be seen by the extension
// NOTE: method Select, which is not inside the script class.
var code = @"using System;
using System.Collections;
using SomeNS;
class Program
{
static void Main()
{
Goo qq = new Goo();
IEnumerable x = from q in qq
select q;
}
}
public class Goo
{
public Goo()
{
}
}
namespace SomeNS
{
public static class SomeClass
{
public static IEnumerable Select(this Goo o, Func<object, object> f)
{
return null;
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAliasQualifiedAliasReference()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;|}
using G = System.Collections.Generic;
{|IDE0005:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
G::List<int> list;
}
}",
@"using G = System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
G::List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestQualifiedAliasReference()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;|}
using G = System.Collections.Generic;|]
class Program
{
static void Main(string[] args)
{
G.List<int> list;
}
}",
@"using G = System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
G.List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUnusedUsings()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}",
@"namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUnusedUsings_FileScopedNamespace()
{
await new VerifyCS.Test
{
TestCode =
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
namespace N;
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
",
FixedCode =
@"namespace N;
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
",
LanguageVersion = LanguageVersion.CSharp10,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUsedUsings()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}",
@"using System;
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}");
}
[WorkItem(712656, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/712656")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUsedUsings2()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
namespace N
{
[|using System;
{|IDE0005:using System.Collections.Generic;|}|]
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}",
@"using System;
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}");
}
[WorkItem(712656, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/712656")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUsedUsings2_FileScopedNamespace()
{
await new VerifyCS.Test
{
TestCode =
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
namespace N;
[|using System;
{|IDE0005:using System.Collections.Generic;|}|]
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
class F
{
DateTime d;
}",
FixedCode =
@"namespace N;
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
class F
{
DateTime d;
}",
LanguageVersion = LanguageVersion.CSharp10,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAttribute()
{
var code = @"using SomeNamespace;
[SomeAttr]
class Goo
{
}
namespace SomeNamespace
{
public class SomeAttrAttribute : System.Attribute
{
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAttributeArgument()
{
var code = @"using goo;
[SomeAttribute(typeof(SomeClass))]
class Program
{
static void Main()
{
}
}
public class SomeAttribute : System.Attribute
{
public SomeAttribute(object f)
{
}
}
namespace goo
{
public class SomeClass
{
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveAllWithSurroundingPreprocessor()
{
await VerifyCS.VerifyCodeFixAsync(
@"#if true
[|{|IDE0005:using System;
using System.Collections.Generic;|}|]
#endif
class Program
{
static void Main(string[] args)
{
}
}",
@"#if true
#endif
class Program
{
static void Main(string[] args)
{
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveFirstWithSurroundingPreprocessor()
{
await VerifyCS.VerifyCodeFixAsync(
@"#if true
[|{|IDE0005:using System;|}
using System.Collections.Generic;|]
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}",
@"#if true
using System.Collections.Generic;
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveAllWithSurroundingPreprocessor2()
{
await VerifyCS.VerifyCodeFixAsync(
@"namespace N
{
#if true
[|{|IDE0005:using System;
using System.Collections.Generic;|}|]
#endif
class Program
{
static void Main(string[] args)
{
}
}
}",
@"namespace N
{
#if true
#endif
class Program
{
static void Main(string[] args)
{
}
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveOneWithSurroundingPreprocessor2()
{
await VerifyCS.VerifyCodeFixAsync(
@"namespace N
{
#if true
[|{|IDE0005:using System;|}
using System.Collections.Generic;|]
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}
}",
@"namespace N
{
#if true
using System.Collections.Generic;
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}
}");
}
[WorkItem(541817, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541817")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestComments8718()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using Goo; {|IDE0005:using System.Collections.Generic;|} /*comment*/ using Goo2;|]
class Program
{
static void Main(string[] args)
{
Bar q;
Bar2 qq;
}
}
namespace Goo
{
public class Bar
{
}
}
namespace Goo2
{
public class Bar2
{
}
}",
@"using Goo;
using Goo2;
class Program
{
static void Main(string[] args)
{
Bar q;
Bar2 qq;
}
}
namespace Goo
{
public class Bar
{
}
}
namespace Goo2
{
public class Bar2
{
}
}");
}
[WorkItem(528609, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528609")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestComments()
{
await VerifyCS.VerifyCodeFixAsync(
@"//c1
/*c2*/
[|{|IDE0005:using/*c3*/ System/*c4*/;|}|] //c5
//c6
class Program
{
}
",
@"//c1
/*c2*/
//c6
class Program
{
}
");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedUsing()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System.Collections.Generic;|}|]
class Program
{
static void Main()
{
}
}",
@"class Program
{
static void Main()
{
}
}");
}
[WorkItem(541827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541827")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestSimpleQuery()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;|}
using System.Linq;|]
class Program
{
static void Main(string[] args)
{
var q = from a in args
where a.Length > 21
select a;
}
}",
@"using System.Linq;
class Program
{
static void Main(string[] args)
{
var q = from a in args
where a.Length > 21
select a;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessField1()
{
// Test intentionally uses 'using' instead of 'using static'
var testCode = @"[|{|IDE0005:using {|CS0138:SomeNS.Goo|};|}|]
class Program
{
static void Main()
{
var q = {|CS0103:x|};
}
}
namespace SomeNS
{
static class Goo
{
public static int x;
}
}";
var fixedCode = @"class Program
{
static void Main()
{
var q = {|CS0103:x|};
}
}
namespace SomeNS
{
static class Goo
{
public static int x;
}
}";
await new VerifyCS.Test
{
TestCode = testCode,
FixedCode = fixedCode,
LanguageVersion = LanguageVersion.CSharp5,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessField2()
{
var code = @"using static SomeNS.Goo;
class Program
{
static void Main()
{
var q = x;
}
}
namespace SomeNS
{
static class Goo
{
public static int x;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessMethod1()
{
// Test intentionally uses 'using' instead of 'using static'
var testCode = @"[|{|IDE0005:using {|CS0138:SomeNS.Goo|};|}|]
class Program
{
static void Main()
{
var q = {|CS0103:X|}();
}
}
namespace SomeNS
{
static class Goo
{
public static int X()
{
return 42;
}
}
}";
var fixedCode = @"[|class Program
{
static void Main()
{
var q = {|CS0103:X|}();
}
}
namespace SomeNS
{
static class Goo
{
public static int X()
{
return 42;
}
}
}|]";
await new VerifyCS.Test
{
TestCode = testCode,
FixedCode = fixedCode,
LanguageVersion = LanguageVersion.CSharp5,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessMethod2()
{
var code = @"using static SomeNS.Goo;
class Program
{
static void Main()
{
var q = X();
}
}
namespace SomeNS
{
static class Goo
{
public static int X()
{
return 42;
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(8846, "DevDiv_Projects/Roslyn")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedTypeImportIsRemoved1()
{
// Test intentionally uses 'using' instead of 'using static'
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using {|CS0138:SomeNS.Goo|};|}|]
class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}",
@"class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedTypeImportIsRemoved2()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using static SomeNS.Goo;|}|]
class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}",
@"class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}");
}
[WorkItem(541817, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541817")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveTrailingComment()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System.Collections.Generic;|}|] // comment
class Program
{
static void Main(string[] args)
{
}
}
",
@"class Program
{
static void Main(string[] args)
{
}
}
");
}
[WorkItem(541914, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541914")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemovingUnbindableUsing()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using {|CS0246:gibberish|};|}|]
public static class Program
{
}",
@"public static class Program
{
}");
}
[WorkItem(541937, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541937")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAliasInUse()
{
var code = @"using GIBBERISH = Goo.Bar;
class Program
{
static void Main(string[] args)
{
GIBBERISH x;
}
}
namespace Goo
{
public class Bar
{
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(541914, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541914")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveUnboundUsing()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using {|CS0246:gibberish|};|}|]
public static class Program
{
}",
@"public static class Program
{
}");
}
[WorkItem(542016, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542016")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestLeadingNewlines1()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}",
@"class Program
{
static void Main(string[] args)
{
}
}");
}
[WorkItem(542016, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542016")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveLeadingNewLines2()
{
await VerifyCS.VerifyCodeFixAsync(
@"namespace N
{
[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}
}",
@"namespace N
{
class Program
{
static void Main(string[] args)
{
}
}
}");
}
[WorkItem(542134, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542134")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestImportedTypeUsedAsGenericTypeArgument()
{
var code = @"using GenericThingie;
public class GenericType<T>
{
}
namespace GenericThingie
{
public class Something
{
}
}
public class Program
{
void goo()
{
GenericType<Something> type;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(542723, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542723")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveCorrectUsing1()
{
var source = @"using System.Collections.Generic;
namespace Goo
{
[|{|IDE0005:using Bar = Dictionary<string, string>;|}|]
}";
var fixedSource = @"namespace Goo
{
}";
await new VerifyCS.Test
{
TestCode = source,
FixedCode = fixedSource,
// Fixing the first diagnostic introduces a second diagnostic to fix.
NumberOfIncrementalIterations = 2,
NumberOfFixAllIterations = 2,
}.RunAsync();
}
[WorkItem(542723, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542723")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveCorrectUsing2()
{
var code = @"using System.Collections.Generic;
namespace Goo
{
using Bar = Dictionary<string, string>;
class C
{
Bar b;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestSpan()
{
var code = @"namespace N
{
[|{|IDE0005:using System;|}|]
}";
var fixedCode = @"namespace N
{
}";
await VerifyCS.VerifyCodeFixAsync(code, fixedCode);
}
[WorkItem(543000, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543000")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMissingWhenErrorsWouldBeGenerated()
{
var code = @"using System;
using X;
using Y;
class B
{
static void Main()
{
Bar(x => x.Goo());
}
static void Bar(Action<int> x)
{
}
static void Bar(Action<string> x)
{
}
}
namespace X
{
public static class A
{
public static void Goo(this int x)
{
}
public static void Goo(this string x)
{
}
}
}
namespace Y
{
public static class B
{
public static void Goo(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(544976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544976")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMissingWhenMeaningWouldChangeInLambda()
{
var code = @"using System;
using X;
using Y;
class B
{
static void Main()
{
Bar(x => x.Goo(), null); // Prints 1
}
static void Bar(Action<string> x, object y)
{
Console.WriteLine(1);
}
static void Bar(Action<int> x, string y)
{
Console.WriteLine(2);
}
}
namespace X
{
public static class A
{
public static void Goo(this int x)
{
}
public static void Goo(this string x)
{
}
}
}
namespace Y
{
public static class B
{
public static void Goo(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(544976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544976")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestCasesWithLambdas1()
{
// NOTE: Y is used when speculatively binding "x => x.Goo()". As such, it is marked as
// used even though it isn't in the final bind, and could be removed. However, as we do
// not know if it was necessary to eliminate a speculative lambda bind, we must leave
// it.
var code = @"using System;
using X;
using Y;
class B
{
static void Main()
{
Bar(x => x.Goo(), null); // Prints 1
}
static void Bar(Action<string> x, object y)
{
}
}
namespace X
{
public static class A
{
public static void Goo(this string x)
{
}
}
}
namespace Y
{
public static class B
{
public static void Goo(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(545646, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545646")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestCasesWithLambdas2()
{
var code = @"using System;
using N; // Falsely claimed as unnecessary
static class C
{
static void Ex(this string x)
{
}
static void Inner(Action<string> x, string y)
{
}
static void Inner(Action<string> x, int y)
{
}
static void Inner(Action<int> x, int y)
{
}
static void Outer(Action<string> x, object y)
{
Console.WriteLine(1);
}
static void Outer(Action<int> x, string y)
{
Console.WriteLine(2);
}
static void Main()
{
Outer(y => Inner(x => x.Ex(), y), null);
}
}
namespace N
{
static class E
{
public static void Ex(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(545741, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545741")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMissingOnAliasedVar()
{
var code = @"using var = var;
class var
{
}
class B
{
static void Main()
{
var a = 1;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(546115, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546115")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestBrokenCode()
{
var code = @"using System.Linq;
public class QueryExpressionTest
{
public static void Main()
{
var expr1 = new[] { };
var expr2 = new[] { };
var query8 = from int i in expr1
join int fixed in expr2 on i equals fixed select new { i, fixed };
var query9 = from object i in expr1
join object fixed in expr2 on i equals fixed select new { i, fixed };
}
}";
await new VerifyCS.Test
{
TestCode = code,
ExpectedDiagnostics =
{
// Test0.cs(7,21): error CS0826: No best type found for implicitly-typed array
DiagnosticResult.CompilerError("CS0826").WithSpan(7, 21, 7, 30),
// Test0.cs(8,21): error CS0826: No best type found for implicitly-typed array
DiagnosticResult.CompilerError("CS0826").WithSpan(8, 21, 8, 30),
// Test0.cs(10,31): error CS0742: A query body must end with a select clause or a group clause
DiagnosticResult.CompilerError("CS0742").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS0743: Expected contextual keyword 'on'
DiagnosticResult.CompilerError("CS0743").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS0744: Expected contextual keyword 'equals'
DiagnosticResult.CompilerError("CS0744").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS1003: Syntax error, 'in' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 31, 10, 36).WithArguments("in", "fixed"),
// Test0.cs(10,31): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 31, 10, 36).WithArguments("fixed"),
// Test0.cs(10,31): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 31, 10, 36).WithArguments("fixed"),
// Test0.cs(10,31): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 31, 10, 36).WithArguments("fixed"),
// Test0.cs(10,31): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(10, 31, 10, 49),
// Test0.cs(10,37): error CS0209: The type of a local declared in a fixed statement must be a pointer type
DiagnosticResult.CompilerError("CS0209").WithSpan(10, 37, 10, 37),
// Test0.cs(10,37): error CS0210: You must provide an initializer in a fixed or using statement declaration
DiagnosticResult.CompilerError("CS0210").WithSpan(10, 37, 10, 37),
// Test0.cs(10,37): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 37, 10, 39),
// Test0.cs(10,37): error CS1003: Syntax error, '(' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 37, 10, 39).WithArguments("(", "in"),
// Test0.cs(10,37): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 37, 10, 39).WithArguments(",", "in"),
// Test0.cs(10,37): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(10, 37, 10, 39),
// Test0.cs(10,40): error CS0118: 'expr2' is a variable but is used like a type
DiagnosticResult.CompilerError("CS0118").WithSpan(10, 40, 10, 45).WithMessage(null),
// Test0.cs(10,40): error CS1026: ) expected
DiagnosticResult.CompilerError("CS1026").WithSpan(10, 40, 10, 45),
// Test0.cs(10,40): error CS1023: Embedded statement cannot be a declaration or labeled statement
DiagnosticResult.CompilerError("CS1023").WithSpan(10, 40, 10, 49),
// Test0.cs(10,49): error CS0246: The type or namespace name 'i' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(10, 49, 10, 50).WithArguments("i"),
// Test0.cs(10,49): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 49, 10, 50),
// Test0.cs(10,58): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 58, 10, 63),
// Test0.cs(10,58): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(10, 58, 10, 80),
// Test0.cs(10,64): error CS0246: The type or namespace name 'select' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(10, 64, 10, 70).WithArguments("select"),
// Test0.cs(10,64): error CS1003: Syntax error, '(' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 64, 10, 70).WithArguments("(", ""),
// Test0.cs(10,71): error CS0209: The type of a local declared in a fixed statement must be a pointer type
DiagnosticResult.CompilerError("CS0209").WithSpan(10, 71, 10, 71),
// Test0.cs(10,71): error CS0210: You must provide an initializer in a fixed or using statement declaration
DiagnosticResult.CompilerError("CS0210").WithSpan(10, 71, 10, 71),
// Test0.cs(10,71): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 71, 10, 74),
// Test0.cs(10,71): error CS1026: ) expected
DiagnosticResult.CompilerError("CS1026").WithSpan(10, 71, 10, 74),
// Test0.cs(10,77): error CS0103: The name 'i' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(10, 77, 10, 78).WithArguments("i"),
// Test0.cs(10,80): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 80, 10, 85),
// Test0.cs(10,80): error CS1513: } expected
DiagnosticResult.CompilerError("CS1513").WithSpan(10, 80, 10, 85),
// Test0.cs(10,80): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(10, 80, 10, 86),
// Test0.cs(10,86): error CS0209: The type of a local declared in a fixed statement must be a pointer type
DiagnosticResult.CompilerError("CS0209").WithSpan(10, 86, 10, 86),
// Test0.cs(10,86): error CS0210: You must provide an initializer in a fixed or using statement declaration
DiagnosticResult.CompilerError("CS0210").WithSpan(10, 86, 10, 86),
// Test0.cs(10,86): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1003: Syntax error, '(' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 86, 10, 87).WithArguments("(", "}"),
// Test0.cs(10,86): error CS1026: ) expected
DiagnosticResult.CompilerError("CS1026").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1525: Invalid expression term '}'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 86, 10, 87).WithArguments("}"),
// Test0.cs(10,87): error CS1597: Semicolon after method or accessor block is not valid
DiagnosticResult.CompilerError("CS1597").WithSpan(10, 87, 10, 88),
// Test0.cs(12,5): error CS0825: The contextual keyword 'var' may only appear within a local variable declaration or in script code
DiagnosticResult.CompilerError("CS0825").WithSpan(12, 5, 12, 8),
// Test0.cs(12,35): error CS0103: The name 'expr1' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(12, 35, 12, 40).WithArguments("expr1"),
// Test0.cs(13,30): error CS0742: A query body must end with a select clause or a group clause
DiagnosticResult.CompilerError("CS0742").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS0743: Expected contextual keyword 'on'
DiagnosticResult.CompilerError("CS0743").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS0744: Expected contextual keyword 'equals'
DiagnosticResult.CompilerError("CS0744").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS1003: Syntax error, 'in' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 30, 13, 35).WithArguments("in", "fixed"),
// Test0.cs(13,30): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(13, 30, 13, 35).WithArguments("fixed"),
// Test0.cs(13,30): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(13, 30, 13, 35).WithArguments("fixed"),
// Test0.cs(13,30): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(13, 30, 13, 35).WithArguments("fixed"),
// Test0.cs(13,36): error CS1642: Fixed size buffer fields may only be members of structs
DiagnosticResult.CompilerError("CS1642").WithSpan(13, 36, 13, 36),
// Test0.cs(13,36): error CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double
DiagnosticResult.CompilerError("CS1663").WithSpan(13, 36, 13, 36),
// Test0.cs(13,36): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 36, 13, 38),
// Test0.cs(13,36): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 36, 13, 38).WithArguments(",", "in"),
// Test0.cs(13,36): error CS1003: Syntax error, '[' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 36, 13, 38).WithArguments("[", "in"),
// Test0.cs(13,36): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(13, 36, 13, 38),
// Test0.cs(13,36): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(13, 36, 13, 57),
// Test0.cs(13,36): error CS7092: A fixed buffer may only have one dimension.
DiagnosticResult.CompilerError("CS7092").WithSpan(13, 36, 13, 57),
// Test0.cs(13,39): error CS0103: The name 'expr2' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(13, 39, 13, 44).WithArguments("expr2"),
// Test0.cs(13,45): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 45, 13, 47).WithArguments(",", ""),
// Test0.cs(13,48): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 48, 13, 49).WithArguments(",", ""),
// Test0.cs(13,50): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 50, 13, 56).WithArguments(",", ""),
// Test0.cs(13,57): error CS0443: Syntax error; value expected
DiagnosticResult.CompilerError("CS0443").WithSpan(13, 57, 13, 57),
// Test0.cs(13,57): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 57, 13, 62),
// Test0.cs(13,57): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 57, 13, 62).WithArguments(",", "fixed"),
// Test0.cs(13,57): error CS1003: Syntax error, ']' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 57, 13, 62).WithArguments("]", "fixed"),
// Test0.cs(13,63): error CS0246: The type or namespace name 'select' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(13, 63, 13, 69).WithArguments("select"),
// Test0.cs(13,63): error CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double
DiagnosticResult.CompilerError("CS1663").WithSpan(13, 63, 13, 69),
// Test0.cs(13,70): error CS0102: The type 'QueryExpressionTest' already contains a definition for ''
DiagnosticResult.CompilerError("CS0102").WithSpan(13, 70, 13, 70).WithArguments("QueryExpressionTest", ""),
// Test0.cs(13,70): error CS1642: Fixed size buffer fields may only be members of structs
DiagnosticResult.CompilerError("CS1642").WithSpan(13, 70, 13, 70),
// Test0.cs(13,70): error CS0836: Cannot use anonymous type in a constant expression
DiagnosticResult.CompilerError("CS0836").WithSpan(13, 70, 13, 73),
// Test0.cs(13,70): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 70, 13, 73),
// Test0.cs(13,70): error CS1003: Syntax error, '[' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 70, 13, 73).WithArguments("[", "new"),
// Test0.cs(13,70): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(13, 70, 13, 79),
// Test0.cs(13,70): error CS7092: A fixed buffer may only have one dimension.
DiagnosticResult.CompilerError("CS7092").WithSpan(13, 70, 13, 79),
// Test0.cs(13,76): error CS0103: The name 'i' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(13, 76, 13, 77).WithArguments("i"),
// Test0.cs(13,79): error CS0443: Syntax error; value expected
DiagnosticResult.CompilerError("CS0443").WithSpan(13, 79, 13, 79),
// Test0.cs(13,79): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 79, 13, 84),
// Test0.cs(13,79): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 79, 13, 84).WithArguments(",", "fixed"),
// Test0.cs(13,79): error CS1003: Syntax error, ']' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 79, 13, 84).WithArguments("]", "fixed"),
// Test0.cs(13,79): error CS1513: } expected
DiagnosticResult.CompilerError("CS1513").WithSpan(13, 79, 13, 84),
// Test0.cs(13,85): error CS0102: The type 'QueryExpressionTest' already contains a definition for ''
DiagnosticResult.CompilerError("CS0102").WithSpan(13, 85, 13, 85).WithArguments("QueryExpressionTest", ""),
// Test0.cs(13,85): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(13, 85, 13, 85),
// Test0.cs(13,85): error CS1642: Fixed size buffer fields may only be members of structs
DiagnosticResult.CompilerError("CS1642").WithSpan(13, 85, 13, 85),
// Test0.cs(13,85): error CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double
DiagnosticResult.CompilerError("CS1663").WithSpan(13, 85, 13, 85),
// Test0.cs(13,85): error CS0443: Syntax error; value expected
DiagnosticResult.CompilerError("CS0443").WithSpan(13, 85, 13, 86),
// Test0.cs(13,85): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 85, 13, 86),
// Test0.cs(13,85): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 85, 13, 86),
// Test0.cs(13,85): error CS1003: Syntax error, '[' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 85, 13, 86).WithArguments("[", "}"),
// Test0.cs(13,85): error CS1003: Syntax error, ']' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 85, 13, 86).WithArguments("]", "}"),
// Test0.cs(13,85): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(13, 85, 13, 86),
// Test0.cs(14,3): error CS1022: Type or namespace definition, or end-of-file expected
DiagnosticResult.CompilerError("CS1022").WithSpan(14, 3, 14, 4),
// Test0.cs(15,1): error CS1022: Type or namespace definition, or end-of-file expected
DiagnosticResult.CompilerError("CS1022").WithSpan(15, 1, 15, 2),
},
FixedCode = code,
}.RunAsync();
}
[WorkItem(530980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530980")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestReferenceInCref()
{
// Parsing doc comments as simple trivia; we don't know System is unnecessary, but CS8019 is disabled so
// no diagnostics are reported.
var code = @"using System;
/// <summary><see cref=""String"" /></summary>
class C
{
}";
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
DocumentationMode = DocumentationMode.None,
},
}.RunAsync();
// fully parsing doc comments; System is necessary
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
DocumentationMode = DocumentationMode.Parse,
},
}.RunAsync();
// fully parsing and diagnosing doc comments; System is necessary
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
DocumentationMode = DocumentationMode.Diagnose,
},
}.RunAsync();
}
[WorkItem(751283, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751283")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedUsingOverLinq()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Linq;
using System.Threading.Tasks;|}|]
class Program
{
static void Main(string[] args)
{
Console.WriteLine();
}
}",
@"using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine();
}
}");
}
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
[InlineData(4)]
[InlineData(5)]
[Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
[WorkItem(20377, "https://github.com/dotnet/roslyn/issues/20377")]
public async Task TestWarningLevel(int warningLevel)
{
var code = @"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}";
var fixedCode = warningLevel switch
{
0 => code,
_ => @"class Program
{
static void Main(string[] args)
{
}
}",
};
var markupMode = warningLevel switch
{
// Hidden diagnostics are not reported for warning level 0
0 => MarkupMode.Ignore,
// But are reported for all other warning levels
_ => MarkupMode.Allow,
};
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
MarkupHandling = markupMode,
},
FixedCode = fixedCode,
SolutionTransforms =
{
(solution, projectId) =>
{
var compilationOptions = (CSharpCompilationOptions)solution.GetProject(projectId).CompilationOptions;
return solution.WithProjectCompilationOptions(projectId, compilationOptions.WithWarningLevel(warningLevel));
},
},
}.RunAsync();
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Testing;
using Roslyn.Test.Utilities;
using Xunit;
using VerifyCS = Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions.CSharpCodeFixVerifier<
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsCodeFixProvider>;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessaryImports
{
public class RemoveUnnecessaryImportsTests
{
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNoReferences()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}",
@"class Program
{
static void Main(string[] args)
{
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNoReferencesWithCopyright()
{
await VerifyCS.VerifyCodeFixAsync(
@"// Copyright (c) Somebody.
[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}",
@"// Copyright (c) Somebody.
class Program
{
static void Main(string[] args)
{
}
}");
}
[WorkItem(27006, "https://github.com/dotnet/roslyn/issues/27006")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestReferencesWithCopyrightAndPreservableTrivia()
{
await VerifyCS.VerifyCodeFixAsync(
@"// Copyright (c) Somebody.
[|using System;
{|IDE0005:using System.Collections.Generic;
// This is important
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
Action a;
}
}",
@"// Copyright (c) Somebody.
using System;
// This is important
class Program
{
static void Main(string[] args)
{
Action a;
}
}");
}
[WorkItem(27006, "https://github.com/dotnet/roslyn/issues/27006")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestReferencesWithCopyrightAndGroupings()
{
await VerifyCS.VerifyCodeFixAsync(
@"// Copyright (c) Somebody.
[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
Action a;
}
}",
@"// Copyright (c) Somebody.
using System;
class Program
{
static void Main(string[] args)
{
Action a;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestIdentifierReferenceInTypeContext()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}",
@"using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestGeneratedCode()
{
var source = @"// <auto-generated/>
[|{|IDE0005_gen:using System;|}
using System.Collections.Generic;
{|IDE0005_gen:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
List<int> d;
}
}";
var fixedSource = @"// <auto-generated/>
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List<int> d;
}
}";
// Fix All operations in generated code do not apply changes
var batchFixedSource = source;
await new VerifyCS.Test
{
TestCode = source,
FixedCode = fixedSource,
BatchFixedState =
{
Sources = { batchFixedSource },
MarkupHandling = MarkupMode.Allow,
},
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestGenericReferenceInTypeContext()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;|}
using System.Collections.Generic;
{|IDE0005:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}",
@"using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMultipleReferences()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
using System.Collections.Generic;
{|IDE0005:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
List<int> list;
DateTime d;
}
}",
@"using System;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List<int> list;
DateTime d;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestExtensionMethodReference()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;|}
using System.Linq;|]
class Program
{
static void Main(string[] args)
{
args.Where(a => a.Length > 10);
}
}",
@"using System.Linq;
class Program
{
static void Main(string[] args)
{
args.Where(a => a.Length > 10);
}
}");
}
[WorkItem(541827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541827")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestExtensionMethodLinq()
{
// NOTE: Intentionally not running this test with Script options, because in Script,
// NOTE: class "Goo" is placed inside the script class, and can't be seen by the extension
// NOTE: method Select, which is not inside the script class.
var code = @"using System;
using System.Collections;
using SomeNS;
class Program
{
static void Main()
{
Goo qq = new Goo();
IEnumerable x = from q in qq
select q;
}
}
public class Goo
{
public Goo()
{
}
}
namespace SomeNS
{
public static class SomeClass
{
public static IEnumerable Select(this Goo o, Func<object, object> f)
{
return null;
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAliasQualifiedAliasReference()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;|}
using G = System.Collections.Generic;
{|IDE0005:using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
G::List<int> list;
}
}",
@"using G = System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
G::List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestQualifiedAliasReference()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;|}
using G = System.Collections.Generic;|]
class Program
{
static void Main(string[] args)
{
G.List<int> list;
}
}",
@"using G = System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
G.List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUnusedUsings()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}",
@"namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUnusedUsings_FileScopedNamespace()
{
await new VerifyCS.Test
{
TestCode =
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
namespace N;
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
",
FixedCode =
@"namespace N;
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
",
LanguageVersion = LanguageVersion.CSharp10,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUsedUsings()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}",
@"using System;
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}");
}
[WorkItem(712656, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/712656")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUsedUsings2()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Collections.Generic;
using System.Linq;|}|]
namespace N
{
[|using System;
{|IDE0005:using System.Collections.Generic;|}|]
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}",
@"using System;
namespace N
{
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
}
class F
{
DateTime d;
}");
}
[WorkItem(712656, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/712656")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestNestedUsedUsings2_FileScopedNamespace()
{
await new VerifyCS.Test
{
TestCode =
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
namespace N;
[|using System;
{|IDE0005:using System.Collections.Generic;|}|]
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
class F
{
DateTime d;
}",
FixedCode =
@"namespace N;
using System;
class Program
{
static void Main(string[] args)
{
DateTime d;
}
}
class F
{
DateTime d;
}",
LanguageVersion = LanguageVersion.CSharp10,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAttribute()
{
var code = @"using SomeNamespace;
[SomeAttr]
class Goo
{
}
namespace SomeNamespace
{
public class SomeAttrAttribute : System.Attribute
{
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAttributeArgument()
{
var code = @"using goo;
[SomeAttribute(typeof(SomeClass))]
class Program
{
static void Main()
{
}
}
public class SomeAttribute : System.Attribute
{
public SomeAttribute(object f)
{
}
}
namespace goo
{
public class SomeClass
{
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveAllWithSurroundingPreprocessor()
{
await VerifyCS.VerifyCodeFixAsync(
@"#if true
[|{|IDE0005:using System;
using System.Collections.Generic;|}|]
#endif
class Program
{
static void Main(string[] args)
{
}
}",
@"#if true
#endif
class Program
{
static void Main(string[] args)
{
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveFirstWithSurroundingPreprocessor()
{
await VerifyCS.VerifyCodeFixAsync(
@"#if true
[|{|IDE0005:using System;|}
using System.Collections.Generic;|]
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}",
@"#if true
using System.Collections.Generic;
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveAllWithSurroundingPreprocessor2()
{
await VerifyCS.VerifyCodeFixAsync(
@"namespace N
{
#if true
[|{|IDE0005:using System;
using System.Collections.Generic;|}|]
#endif
class Program
{
static void Main(string[] args)
{
}
}
}",
@"namespace N
{
#if true
#endif
class Program
{
static void Main(string[] args)
{
}
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveOneWithSurroundingPreprocessor2()
{
await VerifyCS.VerifyCodeFixAsync(
@"namespace N
{
#if true
[|{|IDE0005:using System;|}
using System.Collections.Generic;|]
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}
}",
@"namespace N
{
#if true
using System.Collections.Generic;
#endif
class Program
{
static void Main(string[] args)
{
List<int> list;
}
}
}");
}
[WorkItem(541817, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541817")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestComments8718()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using Goo; {|IDE0005:using System.Collections.Generic;|} /*comment*/ using Goo2;|]
class Program
{
static void Main(string[] args)
{
Bar q;
Bar2 qq;
}
}
namespace Goo
{
public class Bar
{
}
}
namespace Goo2
{
public class Bar2
{
}
}",
@"using Goo;
using Goo2;
class Program
{
static void Main(string[] args)
{
Bar q;
Bar2 qq;
}
}
namespace Goo
{
public class Bar
{
}
}
namespace Goo2
{
public class Bar2
{
}
}");
}
[WorkItem(528609, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528609")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestComments()
{
await VerifyCS.VerifyCodeFixAsync(
@"//c1
/*c2*/
[|{|IDE0005:using/*c3*/ System/*c4*/;|}|] //c5
//c6
class Program
{
}
",
@"//c1
/*c2*/
//c6
class Program
{
}
");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedUsing()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System.Collections.Generic;|}|]
class Program
{
static void Main()
{
}
}",
@"class Program
{
static void Main()
{
}
}");
}
[WorkItem(541827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541827")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestSimpleQuery()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;|}
using System.Linq;|]
class Program
{
static void Main(string[] args)
{
var q = from a in args
where a.Length > 21
select a;
}
}",
@"using System.Linq;
class Program
{
static void Main(string[] args)
{
var q = from a in args
where a.Length > 21
select a;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessField1()
{
// Test intentionally uses 'using' instead of 'using static'
var testCode = @"[|{|IDE0005:using {|CS0138:SomeNS.Goo|};|}|]
class Program
{
static void Main()
{
var q = {|CS0103:x|};
}
}
namespace SomeNS
{
static class Goo
{
public static int x;
}
}";
var fixedCode = @"class Program
{
static void Main()
{
var q = {|CS0103:x|};
}
}
namespace SomeNS
{
static class Goo
{
public static int x;
}
}";
await new VerifyCS.Test
{
TestCode = testCode,
FixedCode = fixedCode,
LanguageVersion = LanguageVersion.CSharp5,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessField2()
{
var code = @"using static SomeNS.Goo;
class Program
{
static void Main()
{
var q = x;
}
}
namespace SomeNS
{
static class Goo
{
public static int x;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessMethod1()
{
// Test intentionally uses 'using' instead of 'using static'
var testCode = @"[|{|IDE0005:using {|CS0138:SomeNS.Goo|};|}|]
class Program
{
static void Main()
{
var q = {|CS0103:X|}();
}
}
namespace SomeNS
{
static class Goo
{
public static int X()
{
return 42;
}
}
}";
var fixedCode = @"[|class Program
{
static void Main()
{
var q = {|CS0103:X|}();
}
}
namespace SomeNS
{
static class Goo
{
public static int X()
{
return 42;
}
}
}|]";
await new VerifyCS.Test
{
TestCode = testCode,
FixedCode = fixedCode,
LanguageVersion = LanguageVersion.CSharp5,
}.RunAsync();
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUsingStaticClassAccessMethod2()
{
var code = @"using static SomeNS.Goo;
class Program
{
static void Main()
{
var q = X();
}
}
namespace SomeNS
{
static class Goo
{
public static int X()
{
return 42;
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(8846, "DevDiv_Projects/Roslyn")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedTypeImportIsRemoved1()
{
// Test intentionally uses 'using' instead of 'using static'
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using {|CS0138:SomeNS.Goo|};|}|]
class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}",
@"class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedTypeImportIsRemoved2()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using static SomeNS.Goo;|}|]
class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}",
@"class Program
{
static void Main()
{
}
}
namespace SomeNS
{
static class Goo
{
}
}");
}
[WorkItem(541817, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541817")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveTrailingComment()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System.Collections.Generic;|}|] // comment
class Program
{
static void Main(string[] args)
{
}
}
",
@"class Program
{
static void Main(string[] args)
{
}
}
");
}
[WorkItem(541914, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541914")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemovingUnbindableUsing()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using {|CS0246:gibberish|};|}|]
public static class Program
{
}",
@"public static class Program
{
}");
}
[WorkItem(541937, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541937")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestAliasInUse()
{
var code = @"using GIBBERISH = Goo.Bar;
class Program
{
static void Main(string[] args)
{
GIBBERISH x;
}
}
namespace Goo
{
public class Bar
{
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(541914, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541914")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveUnboundUsing()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using {|CS0246:gibberish|};|}|]
public static class Program
{
}",
@"public static class Program
{
}");
}
[WorkItem(542016, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542016")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestLeadingNewlines1()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}",
@"class Program
{
static void Main(string[] args)
{
}
}");
}
[WorkItem(542016, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542016")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveLeadingNewLines2()
{
await VerifyCS.VerifyCodeFixAsync(
@"namespace N
{
[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}
}",
@"namespace N
{
class Program
{
static void Main(string[] args)
{
}
}
}");
}
[WorkItem(542134, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542134")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestImportedTypeUsedAsGenericTypeArgument()
{
var code = @"using GenericThingie;
public class GenericType<T>
{
}
namespace GenericThingie
{
public class Something
{
}
}
public class Program
{
void goo()
{
GenericType<Something> type;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(542723, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542723")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveCorrectUsing1()
{
var source = @"using System.Collections.Generic;
namespace Goo
{
[|{|IDE0005:using Bar = Dictionary<string, string>;|}|]
}";
var fixedSource = @"namespace Goo
{
}";
await new VerifyCS.Test
{
TestCode = source,
FixedCode = fixedSource,
// Fixing the first diagnostic introduces a second diagnostic to fix.
NumberOfIncrementalIterations = 2,
NumberOfFixAllIterations = 2,
}.RunAsync();
}
[WorkItem(542723, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542723")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestRemoveCorrectUsing2()
{
var code = @"using System.Collections.Generic;
namespace Goo
{
using Bar = Dictionary<string, string>;
class C
{
Bar b;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestSpan()
{
var code = @"namespace N
{
[|{|IDE0005:using System;|}|]
}";
var fixedCode = @"namespace N
{
}";
await VerifyCS.VerifyCodeFixAsync(code, fixedCode);
}
[WorkItem(543000, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543000")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMissingWhenErrorsWouldBeGenerated()
{
var code = @"using System;
using X;
using Y;
class B
{
static void Main()
{
Bar(x => x.Goo());
}
static void Bar(Action<int> x)
{
}
static void Bar(Action<string> x)
{
}
}
namespace X
{
public static class A
{
public static void Goo(this int x)
{
}
public static void Goo(this string x)
{
}
}
}
namespace Y
{
public static class B
{
public static void Goo(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(544976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544976")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMissingWhenMeaningWouldChangeInLambda()
{
var code = @"using System;
using X;
using Y;
class B
{
static void Main()
{
Bar(x => x.Goo(), null); // Prints 1
}
static void Bar(Action<string> x, object y)
{
Console.WriteLine(1);
}
static void Bar(Action<int> x, string y)
{
Console.WriteLine(2);
}
}
namespace X
{
public static class A
{
public static void Goo(this int x)
{
}
public static void Goo(this string x)
{
}
}
}
namespace Y
{
public static class B
{
public static void Goo(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(544976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544976")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestCasesWithLambdas1()
{
// NOTE: Y is used when speculatively binding "x => x.Goo()". As such, it is marked as
// used even though it isn't in the final bind, and could be removed. However, as we do
// not know if it was necessary to eliminate a speculative lambda bind, we must leave
// it.
var code = @"using System;
using X;
using Y;
class B
{
static void Main()
{
Bar(x => x.Goo(), null); // Prints 1
}
static void Bar(Action<string> x, object y)
{
}
}
namespace X
{
public static class A
{
public static void Goo(this string x)
{
}
}
}
namespace Y
{
public static class B
{
public static void Goo(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(545646, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545646")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestCasesWithLambdas2()
{
var code = @"using System;
using N; // Falsely claimed as unnecessary
static class C
{
static void Ex(this string x)
{
}
static void Inner(Action<string> x, string y)
{
}
static void Inner(Action<string> x, int y)
{
}
static void Inner(Action<int> x, int y)
{
}
static void Outer(Action<string> x, object y)
{
Console.WriteLine(1);
}
static void Outer(Action<int> x, string y)
{
Console.WriteLine(2);
}
static void Main()
{
Outer(y => Inner(x => x.Ex(), y), null);
}
}
namespace N
{
static class E
{
public static void Ex(this int x)
{
}
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(545741, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545741")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestMissingOnAliasedVar()
{
var code = @"using var = var;
class var
{
}
class B
{
static void Main()
{
var a = 1;
}
}";
await VerifyCS.VerifyCodeFixAsync(code, code);
}
[WorkItem(546115, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546115")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestBrokenCode()
{
var code = @"using System.Linq;
public class QueryExpressionTest
{
public static void Main()
{
var expr1 = new[] { };
var expr2 = new[] { };
var query8 = from int i in expr1
join int fixed in expr2 on i equals fixed select new { i, fixed };
var query9 = from object i in expr1
join object fixed in expr2 on i equals fixed select new { i, fixed };
}
}";
await new VerifyCS.Test
{
TestCode = code,
ExpectedDiagnostics =
{
// Test0.cs(7,21): error CS0826: No best type found for implicitly-typed array
DiagnosticResult.CompilerError("CS0826").WithSpan(7, 21, 7, 30),
// Test0.cs(8,21): error CS0826: No best type found for implicitly-typed array
DiagnosticResult.CompilerError("CS0826").WithSpan(8, 21, 8, 30),
// Test0.cs(10,31): error CS0742: A query body must end with a select clause or a group clause
DiagnosticResult.CompilerError("CS0742").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS0743: Expected contextual keyword 'on'
DiagnosticResult.CompilerError("CS0743").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS0744: Expected contextual keyword 'equals'
DiagnosticResult.CompilerError("CS0744").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 31, 10, 36),
// Test0.cs(10,31): error CS1003: Syntax error, 'in' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 31, 10, 36).WithArguments("in", "fixed"),
// Test0.cs(10,31): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 31, 10, 36).WithArguments("fixed"),
// Test0.cs(10,31): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 31, 10, 36).WithArguments("fixed"),
// Test0.cs(10,31): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 31, 10, 36).WithArguments("fixed"),
// Test0.cs(10,31): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(10, 31, 10, 49),
// Test0.cs(10,37): error CS0209: The type of a local declared in a fixed statement must be a pointer type
DiagnosticResult.CompilerError("CS0209").WithSpan(10, 37, 10, 37),
// Test0.cs(10,37): error CS0210: You must provide an initializer in a fixed or using statement declaration
DiagnosticResult.CompilerError("CS0210").WithSpan(10, 37, 10, 37),
// Test0.cs(10,37): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 37, 10, 39),
// Test0.cs(10,37): error CS1003: Syntax error, '(' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 37, 10, 39).WithArguments("(", "in"),
// Test0.cs(10,37): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 37, 10, 39).WithArguments(",", "in"),
// Test0.cs(10,37): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(10, 37, 10, 39),
// Test0.cs(10,40): error CS0118: 'expr2' is a variable but is used like a type
DiagnosticResult.CompilerError("CS0118").WithSpan(10, 40, 10, 45).WithMessage(null),
// Test0.cs(10,40): error CS1026: ) expected
DiagnosticResult.CompilerError("CS1026").WithSpan(10, 40, 10, 45),
// Test0.cs(10,40): error CS1023: Embedded statement cannot be a declaration or labeled statement
DiagnosticResult.CompilerError("CS1023").WithSpan(10, 40, 10, 49),
// Test0.cs(10,49): error CS0246: The type or namespace name 'i' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(10, 49, 10, 50).WithArguments("i"),
// Test0.cs(10,49): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 49, 10, 50),
// Test0.cs(10,58): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 58, 10, 63),
// Test0.cs(10,58): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(10, 58, 10, 80),
// Test0.cs(10,64): error CS0246: The type or namespace name 'select' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(10, 64, 10, 70).WithArguments("select"),
// Test0.cs(10,64): error CS1003: Syntax error, '(' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 64, 10, 70).WithArguments("(", ""),
// Test0.cs(10,71): error CS0209: The type of a local declared in a fixed statement must be a pointer type
DiagnosticResult.CompilerError("CS0209").WithSpan(10, 71, 10, 71),
// Test0.cs(10,71): error CS0210: You must provide an initializer in a fixed or using statement declaration
DiagnosticResult.CompilerError("CS0210").WithSpan(10, 71, 10, 71),
// Test0.cs(10,71): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 71, 10, 74),
// Test0.cs(10,71): error CS1026: ) expected
DiagnosticResult.CompilerError("CS1026").WithSpan(10, 71, 10, 74),
// Test0.cs(10,77): error CS0103: The name 'i' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(10, 77, 10, 78).WithArguments("i"),
// Test0.cs(10,80): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 80, 10, 85),
// Test0.cs(10,80): error CS1513: } expected
DiagnosticResult.CompilerError("CS1513").WithSpan(10, 80, 10, 85),
// Test0.cs(10,80): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(10, 80, 10, 86),
// Test0.cs(10,86): error CS0209: The type of a local declared in a fixed statement must be a pointer type
DiagnosticResult.CompilerError("CS0209").WithSpan(10, 86, 10, 86),
// Test0.cs(10,86): error CS0210: You must provide an initializer in a fixed or using statement declaration
DiagnosticResult.CompilerError("CS0210").WithSpan(10, 86, 10, 86),
// Test0.cs(10,86): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1003: Syntax error, '(' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(10, 86, 10, 87).WithArguments("(", "}"),
// Test0.cs(10,86): error CS1026: ) expected
DiagnosticResult.CompilerError("CS1026").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(10, 86, 10, 87),
// Test0.cs(10,86): error CS1525: Invalid expression term '}'
DiagnosticResult.CompilerError("CS1525").WithSpan(10, 86, 10, 87).WithArguments("}"),
// Test0.cs(10,87): error CS1597: Semicolon after method or accessor block is not valid
DiagnosticResult.CompilerError("CS1597").WithSpan(10, 87, 10, 88),
// Test0.cs(12,5): error CS0825: The contextual keyword 'var' may only appear within a local variable declaration or in script code
DiagnosticResult.CompilerError("CS0825").WithSpan(12, 5, 12, 8),
// Test0.cs(12,35): error CS0103: The name 'expr1' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(12, 35, 12, 40).WithArguments("expr1"),
// Test0.cs(13,30): error CS0742: A query body must end with a select clause or a group clause
DiagnosticResult.CompilerError("CS0742").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS0743: Expected contextual keyword 'on'
DiagnosticResult.CompilerError("CS0743").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS0744: Expected contextual keyword 'equals'
DiagnosticResult.CompilerError("CS0744").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 30, 13, 35),
// Test0.cs(13,30): error CS1003: Syntax error, 'in' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 30, 13, 35).WithArguments("in", "fixed"),
// Test0.cs(13,30): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(13, 30, 13, 35).WithArguments("fixed"),
// Test0.cs(13,30): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(13, 30, 13, 35).WithArguments("fixed"),
// Test0.cs(13,30): error CS1525: Invalid expression term 'fixed'
DiagnosticResult.CompilerError("CS1525").WithSpan(13, 30, 13, 35).WithArguments("fixed"),
// Test0.cs(13,36): error CS1642: Fixed size buffer fields may only be members of structs
DiagnosticResult.CompilerError("CS1642").WithSpan(13, 36, 13, 36),
// Test0.cs(13,36): error CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double
DiagnosticResult.CompilerError("CS1663").WithSpan(13, 36, 13, 36),
// Test0.cs(13,36): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 36, 13, 38),
// Test0.cs(13,36): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 36, 13, 38).WithArguments(",", "in"),
// Test0.cs(13,36): error CS1003: Syntax error, '[' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 36, 13, 38).WithArguments("[", "in"),
// Test0.cs(13,36): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(13, 36, 13, 38),
// Test0.cs(13,36): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(13, 36, 13, 57),
// Test0.cs(13,36): error CS7092: A fixed buffer may only have one dimension.
DiagnosticResult.CompilerError("CS7092").WithSpan(13, 36, 13, 57),
// Test0.cs(13,39): error CS0103: The name 'expr2' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(13, 39, 13, 44).WithArguments("expr2"),
// Test0.cs(13,45): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 45, 13, 47).WithArguments(",", ""),
// Test0.cs(13,48): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 48, 13, 49).WithArguments(",", ""),
// Test0.cs(13,50): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 50, 13, 56).WithArguments(",", ""),
// Test0.cs(13,57): error CS0443: Syntax error; value expected
DiagnosticResult.CompilerError("CS0443").WithSpan(13, 57, 13, 57),
// Test0.cs(13,57): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 57, 13, 62),
// Test0.cs(13,57): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 57, 13, 62).WithArguments(",", "fixed"),
// Test0.cs(13,57): error CS1003: Syntax error, ']' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 57, 13, 62).WithArguments("]", "fixed"),
// Test0.cs(13,63): error CS0246: The type or namespace name 'select' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(13, 63, 13, 69).WithArguments("select"),
// Test0.cs(13,63): error CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double
DiagnosticResult.CompilerError("CS1663").WithSpan(13, 63, 13, 69),
// Test0.cs(13,70): error CS0102: The type 'QueryExpressionTest' already contains a definition for ''
DiagnosticResult.CompilerError("CS0102").WithSpan(13, 70, 13, 70).WithArguments("QueryExpressionTest", ""),
// Test0.cs(13,70): error CS1642: Fixed size buffer fields may only be members of structs
DiagnosticResult.CompilerError("CS1642").WithSpan(13, 70, 13, 70),
// Test0.cs(13,70): error CS0836: Cannot use anonymous type in a constant expression
DiagnosticResult.CompilerError("CS0836").WithSpan(13, 70, 13, 73),
// Test0.cs(13,70): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 70, 13, 73),
// Test0.cs(13,70): error CS1003: Syntax error, '[' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 70, 13, 73).WithArguments("[", "new"),
// Test0.cs(13,70): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(13, 70, 13, 79),
// Test0.cs(13,70): error CS7092: A fixed buffer may only have one dimension.
DiagnosticResult.CompilerError("CS7092").WithSpan(13, 70, 13, 79),
// Test0.cs(13,76): error CS0103: The name 'i' does not exist in the current context
DiagnosticResult.CompilerError("CS0103").WithSpan(13, 76, 13, 77).WithArguments("i"),
// Test0.cs(13,79): error CS0443: Syntax error; value expected
DiagnosticResult.CompilerError("CS0443").WithSpan(13, 79, 13, 79),
// Test0.cs(13,79): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 79, 13, 84),
// Test0.cs(13,79): error CS1003: Syntax error, ',' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 79, 13, 84).WithArguments(",", "fixed"),
// Test0.cs(13,79): error CS1003: Syntax error, ']' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 79, 13, 84).WithArguments("]", "fixed"),
// Test0.cs(13,79): error CS1513: } expected
DiagnosticResult.CompilerError("CS1513").WithSpan(13, 79, 13, 84),
// Test0.cs(13,85): error CS0102: The type 'QueryExpressionTest' already contains a definition for ''
DiagnosticResult.CompilerError("CS0102").WithSpan(13, 85, 13, 85).WithArguments("QueryExpressionTest", ""),
// Test0.cs(13,85): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
DiagnosticResult.CompilerError("CS0214").WithSpan(13, 85, 13, 85),
// Test0.cs(13,85): error CS1642: Fixed size buffer fields may only be members of structs
DiagnosticResult.CompilerError("CS1642").WithSpan(13, 85, 13, 85),
// Test0.cs(13,85): error CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double
DiagnosticResult.CompilerError("CS1663").WithSpan(13, 85, 13, 85),
// Test0.cs(13,85): error CS0443: Syntax error; value expected
DiagnosticResult.CompilerError("CS0443").WithSpan(13, 85, 13, 86),
// Test0.cs(13,85): error CS1001: Identifier expected
DiagnosticResult.CompilerError("CS1001").WithSpan(13, 85, 13, 86),
// Test0.cs(13,85): error CS1002: ; expected
DiagnosticResult.CompilerError("CS1002").WithSpan(13, 85, 13, 86),
// Test0.cs(13,85): error CS1003: Syntax error, '[' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 85, 13, 86).WithArguments("[", "}"),
// Test0.cs(13,85): error CS1003: Syntax error, ']' expected
DiagnosticResult.CompilerError("CS1003").WithSpan(13, 85, 13, 86).WithArguments("]", "}"),
// Test0.cs(13,85): error CS1031: Type expected
DiagnosticResult.CompilerError("CS1031").WithSpan(13, 85, 13, 86),
// Test0.cs(14,3): error CS1022: Type or namespace definition, or end-of-file expected
DiagnosticResult.CompilerError("CS1022").WithSpan(14, 3, 14, 4),
// Test0.cs(15,1): error CS1022: Type or namespace definition, or end-of-file expected
DiagnosticResult.CompilerError("CS1022").WithSpan(15, 1, 15, 2),
},
FixedCode = code,
}.RunAsync();
}
[WorkItem(530980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530980")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestReferenceInCref()
{
// Parsing doc comments as simple trivia; we don't know System is unnecessary, but CS8019 is disabled so
// no diagnostics are reported.
var code = @"using System;
/// <summary><see cref=""String"" /></summary>
class C
{
}";
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
DocumentationMode = DocumentationMode.None,
},
}.RunAsync();
// fully parsing doc comments; System is necessary
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
DocumentationMode = DocumentationMode.Parse,
},
}.RunAsync();
// fully parsing and diagnosing doc comments; System is necessary
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
DocumentationMode = DocumentationMode.Diagnose,
},
}.RunAsync();
}
[WorkItem(751283, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751283")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
public async Task TestUnusedUsingOverLinq()
{
await VerifyCS.VerifyCodeFixAsync(
@"[|using System;
{|IDE0005:using System.Linq;
using System.Threading.Tasks;|}|]
class Program
{
static void Main(string[] args)
{
Console.WriteLine();
}
}",
@"using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine();
}
}");
}
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
[InlineData(4)]
[InlineData(5)]
[Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryImports)]
[WorkItem(20377, "https://github.com/dotnet/roslyn/issues/20377")]
public async Task TestWarningLevel(int warningLevel)
{
var code = @"[|{|IDE0005:using System;
using System.Collections.Generic;
using System.Linq;|}|]
class Program
{
static void Main(string[] args)
{
}
}";
var fixedCode = warningLevel switch
{
0 => code,
_ => @"class Program
{
static void Main(string[] args)
{
}
}",
};
var markupMode = warningLevel switch
{
// Hidden diagnostics are not reported for warning level 0
0 => MarkupMode.Ignore,
// But are reported for all other warning levels
_ => MarkupMode.Allow,
};
await new VerifyCS.Test
{
TestState =
{
Sources = { code },
MarkupHandling = markupMode,
},
FixedCode = fixedCode,
SolutionTransforms =
{
(solution, projectId) =>
{
var compilationOptions = (CSharpCompilationOptions)solution.GetProject(projectId).CompilationOptions;
return solution.WithProjectCompilationOptions(projectId, compilationOptions.WithWarningLevel(warningLevel));
},
},
}.RunAsync();
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/VisualStudio/Core/Impl/CodeModel/InternalElements/CodeVariable.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.LanguageServices.Implementation.Interop;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.InternalElements
{
[ComVisible(true)]
[ComDefaultInterface(typeof(EnvDTE80.CodeVariable2))]
public sealed class CodeVariable : AbstractCodeMember, EnvDTE.CodeVariable, EnvDTE80.CodeVariable2
{
internal static EnvDTE.CodeVariable Create(
CodeModelState state,
FileCodeModel fileCodeModel,
SyntaxNodeKey nodeKey,
int? nodeKind)
{
var element = new CodeVariable(state, fileCodeModel, nodeKey, nodeKind);
var result = (EnvDTE.CodeVariable)ComAggregate.CreateAggregatedObject(element);
fileCodeModel.OnCodeElementCreated(nodeKey, (EnvDTE.CodeElement)result);
return result;
}
internal static EnvDTE.CodeVariable CreateUnknown(
CodeModelState state,
FileCodeModel fileCodeModel,
int nodeKind,
string name)
{
var element = new CodeVariable(state, fileCodeModel, nodeKind, name);
return (EnvDTE.CodeVariable)ComAggregate.CreateAggregatedObject(element);
}
private CodeVariable(
CodeModelState state,
FileCodeModel fileCodeModel,
SyntaxNodeKey nodeKey,
int? nodeKind)
: base(state, fileCodeModel, nodeKey, nodeKind)
{
}
private CodeVariable(
CodeModelState state,
FileCodeModel fileCodeModel,
int nodeKind,
string name)
: base(state, fileCodeModel, nodeKind, name)
{
}
private ITypeSymbol GetSymbolType()
{
var symbol = LookupSymbol();
if (symbol != null)
{
switch (symbol.Kind)
{
case SymbolKind.Field:
return ((IFieldSymbol)symbol).Type;
case SymbolKind.Property:
// Note: VB WithEvents fields are represented as properties
return ((IPropertySymbol)symbol).Type;
}
}
return null;
}
public override EnvDTE.vsCMElement Kind
{
get { return EnvDTE.vsCMElement.vsCMElementVariable; }
}
public EnvDTE80.vsCMConstKind ConstKind
{
get
{
return CodeModelService.GetConstKind(LookupNode());
}
set
{
UpdateNode(FileCodeModel.UpdateConstKind, value);
}
}
public override EnvDTE.CodeElements Children
{
get { return Attributes; }
}
public object InitExpression
{
get
{
return CodeModelService.GetInitExpression(LookupNode());
}
set
{
if (value == null || value is string)
{
UpdateNode(FileCodeModel.UpdateInitExpression, (string)value);
return;
}
// TODO(DustinCa): Legacy VB throws E_INVALIDARG if value is not a string.
throw Exceptions.ThrowEFail();
}
}
public bool IsConstant
{
get
{
return CodeModelService.GetIsConstant(LookupNode());
}
set
{
UpdateNode(FileCodeModel.UpdateIsConstant, value);
}
}
public EnvDTE.CodeTypeRef Type
{
get
{
var type = GetSymbolType();
if (type == null)
{
throw Exceptions.ThrowEFail();
}
return CodeTypeRef.Create(this.State, this, GetProjectId(), type);
}
set
{
// The type is sometimes part of the node key, so we should be sure to reacquire
// it after updating it. Note that we pass trackKinds: false because it's possible
// that UpdateType might change the kind of a node (e.g. change a VB Sub to a Function).
UpdateNodeAndReacquireNodeKey(FileCodeModel.UpdateType, value, trackKinds: false);
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.LanguageServices.Implementation.Interop;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.InternalElements
{
[ComVisible(true)]
[ComDefaultInterface(typeof(EnvDTE80.CodeVariable2))]
public sealed class CodeVariable : AbstractCodeMember, EnvDTE.CodeVariable, EnvDTE80.CodeVariable2
{
internal static EnvDTE.CodeVariable Create(
CodeModelState state,
FileCodeModel fileCodeModel,
SyntaxNodeKey nodeKey,
int? nodeKind)
{
var element = new CodeVariable(state, fileCodeModel, nodeKey, nodeKind);
var result = (EnvDTE.CodeVariable)ComAggregate.CreateAggregatedObject(element);
fileCodeModel.OnCodeElementCreated(nodeKey, (EnvDTE.CodeElement)result);
return result;
}
internal static EnvDTE.CodeVariable CreateUnknown(
CodeModelState state,
FileCodeModel fileCodeModel,
int nodeKind,
string name)
{
var element = new CodeVariable(state, fileCodeModel, nodeKind, name);
return (EnvDTE.CodeVariable)ComAggregate.CreateAggregatedObject(element);
}
private CodeVariable(
CodeModelState state,
FileCodeModel fileCodeModel,
SyntaxNodeKey nodeKey,
int? nodeKind)
: base(state, fileCodeModel, nodeKey, nodeKind)
{
}
private CodeVariable(
CodeModelState state,
FileCodeModel fileCodeModel,
int nodeKind,
string name)
: base(state, fileCodeModel, nodeKind, name)
{
}
private ITypeSymbol GetSymbolType()
{
var symbol = LookupSymbol();
if (symbol != null)
{
switch (symbol.Kind)
{
case SymbolKind.Field:
return ((IFieldSymbol)symbol).Type;
case SymbolKind.Property:
// Note: VB WithEvents fields are represented as properties
return ((IPropertySymbol)symbol).Type;
}
}
return null;
}
public override EnvDTE.vsCMElement Kind
{
get { return EnvDTE.vsCMElement.vsCMElementVariable; }
}
public EnvDTE80.vsCMConstKind ConstKind
{
get
{
return CodeModelService.GetConstKind(LookupNode());
}
set
{
UpdateNode(FileCodeModel.UpdateConstKind, value);
}
}
public override EnvDTE.CodeElements Children
{
get { return Attributes; }
}
public object InitExpression
{
get
{
return CodeModelService.GetInitExpression(LookupNode());
}
set
{
if (value == null || value is string)
{
UpdateNode(FileCodeModel.UpdateInitExpression, (string)value);
return;
}
// TODO(DustinCa): Legacy VB throws E_INVALIDARG if value is not a string.
throw Exceptions.ThrowEFail();
}
}
public bool IsConstant
{
get
{
return CodeModelService.GetIsConstant(LookupNode());
}
set
{
UpdateNode(FileCodeModel.UpdateIsConstant, value);
}
}
public EnvDTE.CodeTypeRef Type
{
get
{
var type = GetSymbolType();
if (type == null)
{
throw Exceptions.ThrowEFail();
}
return CodeTypeRef.Create(this.State, this, GetProjectId(), type);
}
set
{
// The type is sometimes part of the node key, so we should be sure to reacquire
// it after updating it. Note that we pass trackKinds: false because it's possible
// that UpdateType might change the kind of a node (e.g. change a VB Sub to a Function).
UpdateNodeAndReacquireNodeKey(FileCodeModel.UpdateType, value, trackKinds: false);
}
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Server/VBCSCompiler/AnalyzerConsistencyChecker.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis.CommandLine;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.VisualBasic;
namespace Microsoft.CodeAnalysis.CompilerServer
{
internal static class AnalyzerConsistencyChecker
{
public static bool Check(
string baseDirectory,
IEnumerable<CommandLineAnalyzerReference> analyzerReferences,
IAnalyzerAssemblyLoader loader,
ICompilerServerLogger? logger = null) => Check(baseDirectory, analyzerReferences, loader, logger, out var _);
public static bool Check(
string baseDirectory,
IEnumerable<CommandLineAnalyzerReference> analyzerReferences,
IAnalyzerAssemblyLoader loader,
ICompilerServerLogger? logger,
[NotNullWhen(false)]
out List<string>? errorMessages)
{
try
{
logger?.Log("Begin Analyzer Consistency Check");
return CheckCore(baseDirectory, analyzerReferences, loader, logger, out errorMessages);
}
catch (Exception e)
{
logger?.LogException(e, "Analyzer Consistency Check");
errorMessages = new List<string>();
errorMessages.Add(e.Message);
return false;
}
finally
{
logger?.Log("End Analyzer Consistency Check");
}
}
private static bool CheckCore(
string baseDirectory,
IEnumerable<CommandLineAnalyzerReference> analyzerReferences,
IAnalyzerAssemblyLoader loader,
ICompilerServerLogger? logger,
[NotNullWhen(false)]
out List<string>? errorMessages)
{
errorMessages = null;
var resolvedPaths = new List<string>();
foreach (var analyzerReference in analyzerReferences)
{
string? resolvedPath = FileUtilities.ResolveRelativePath(analyzerReference.FilePath, basePath: null, baseDirectory: baseDirectory, searchPaths: SpecializedCollections.EmptyEnumerable<string>(), fileExists: File.Exists);
if (resolvedPath != null)
{
resolvedPath = FileUtilities.TryNormalizeAbsolutePath(resolvedPath);
if (resolvedPath != null)
{
resolvedPaths.Add(resolvedPath);
}
}
// Don't worry about paths we can't resolve. The compiler will report an error for that later.
}
// Register analyzers and their dependencies upfront,
// so that assembly references can be resolved:
foreach (var resolvedPath in resolvedPaths)
{
loader.AddDependencyLocation(resolvedPath);
}
// Load all analyzer assemblies:
var loadedAssemblies = new List<Assembly>();
foreach (var resolvedPath in resolvedPaths)
{
loadedAssemblies.Add(loader.LoadFromPath(resolvedPath));
}
// Third, check that the MVIDs of the files on disk match the MVIDs of the loaded assemblies.
for (int i = 0; i < resolvedPaths.Count; i++)
{
var resolvedPath = resolvedPaths[i];
var loadedAssembly = loadedAssemblies[i];
var resolvedPathMvid = AssemblyUtilities.ReadMvid(resolvedPath);
var loadedAssemblyMvid = loadedAssembly.ManifestModule.ModuleVersionId;
if (resolvedPathMvid != loadedAssemblyMvid)
{
var message = $"analyzer assembly '{resolvedPath}' has MVID '{resolvedPathMvid}' but loaded assembly '{loadedAssembly.FullName}' has MVID '{loadedAssemblyMvid}'";
errorMessages ??= new List<string>();
errorMessages.Add(message);
}
}
return errorMessages == null;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis.CommandLine;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.VisualBasic;
namespace Microsoft.CodeAnalysis.CompilerServer
{
internal static class AnalyzerConsistencyChecker
{
public static bool Check(
string baseDirectory,
IEnumerable<CommandLineAnalyzerReference> analyzerReferences,
IAnalyzerAssemblyLoader loader,
ICompilerServerLogger? logger = null) => Check(baseDirectory, analyzerReferences, loader, logger, out var _);
public static bool Check(
string baseDirectory,
IEnumerable<CommandLineAnalyzerReference> analyzerReferences,
IAnalyzerAssemblyLoader loader,
ICompilerServerLogger? logger,
[NotNullWhen(false)]
out List<string>? errorMessages)
{
try
{
logger?.Log("Begin Analyzer Consistency Check");
return CheckCore(baseDirectory, analyzerReferences, loader, logger, out errorMessages);
}
catch (Exception e)
{
logger?.LogException(e, "Analyzer Consistency Check");
errorMessages = new List<string>();
errorMessages.Add(e.Message);
return false;
}
finally
{
logger?.Log("End Analyzer Consistency Check");
}
}
private static bool CheckCore(
string baseDirectory,
IEnumerable<CommandLineAnalyzerReference> analyzerReferences,
IAnalyzerAssemblyLoader loader,
ICompilerServerLogger? logger,
[NotNullWhen(false)]
out List<string>? errorMessages)
{
errorMessages = null;
var resolvedPaths = new List<string>();
foreach (var analyzerReference in analyzerReferences)
{
string? resolvedPath = FileUtilities.ResolveRelativePath(analyzerReference.FilePath, basePath: null, baseDirectory: baseDirectory, searchPaths: SpecializedCollections.EmptyEnumerable<string>(), fileExists: File.Exists);
if (resolvedPath != null)
{
resolvedPath = FileUtilities.TryNormalizeAbsolutePath(resolvedPath);
if (resolvedPath != null)
{
resolvedPaths.Add(resolvedPath);
}
}
// Don't worry about paths we can't resolve. The compiler will report an error for that later.
}
// Register analyzers and their dependencies upfront,
// so that assembly references can be resolved:
foreach (var resolvedPath in resolvedPaths)
{
loader.AddDependencyLocation(resolvedPath);
}
// Load all analyzer assemblies:
var loadedAssemblies = new List<Assembly>();
foreach (var resolvedPath in resolvedPaths)
{
loadedAssemblies.Add(loader.LoadFromPath(resolvedPath));
}
// Third, check that the MVIDs of the files on disk match the MVIDs of the loaded assemblies.
for (int i = 0; i < resolvedPaths.Count; i++)
{
var resolvedPath = resolvedPaths[i];
var loadedAssembly = loadedAssemblies[i];
var resolvedPathMvid = AssemblyUtilities.ReadMvid(resolvedPath);
var loadedAssemblyMvid = loadedAssembly.ManifestModule.ModuleVersionId;
if (resolvedPathMvid != loadedAssemblyMvid)
{
var message = $"analyzer assembly '{resolvedPath}' has MVID '{resolvedPathMvid}' but loaded assembly '{loadedAssembly.FullName}' has MVID '{loadedAssemblyMvid}'";
errorMessages ??= new List<string>();
errorMessages.Add(message);
}
}
return errorMessages == null;
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/CoreTestUtilities/TestExportJoinableTaskContext+DenyExecutionSynchronizationContext.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Threading;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Test.Utilities
{
internal partial class TestExportJoinableTaskContext
{
/// <summary>
/// Defines a <see cref="SynchronizationContext"/> for use in cases where the synchronization context should not
/// be used for execution of code. Attempting to execute code through this synchronization context will record
/// an exception (with stack trace) for the first occurrence, which can be re-thrown by calling
/// <see cref="ThrowIfSwitchOccurred"/> at an appropriate time.
/// </summary>
/// <remarks>
/// <para>This synchronization context is used in cases where code expects a synchronization context with
/// specific properties (e.g. code is executed on a "main thread"), but no synchronization context with those
/// properties is available. Due to the positioning of synchronization contexts within asynchronous code
/// patterns, detection of misused synchronization contexts without crashes is often challenging. Test cases can
/// use this synchronization context in place of a mock to capture </para>
///
/// <note type="important">
/// <para>This synchronization context will not directly block the execution of scheduled tasks, and will fall
/// back to execution on an underlying synchronization context (typically the thread pool). Tests using this
/// synchronization context should verify the synchronization context was not used by calling
/// <see cref="ThrowIfSwitchOccurred"/> at the end of the test.</para>
/// </note>
/// </remarks>
internal sealed class DenyExecutionSynchronizationContext : SynchronizationContext
{
/// <summary>
/// Records the first case where the synchronization context was used for scheduling an operation.
/// </summary>
/// <remarks>
/// <para>The <see cref="StrongBox{T}"/> wrapper allows copies of the synchronization context (created by
/// <see cref="CreateCopy"/>) to record information about incorrect synchronization context in the original
/// synchronization context from which it was created.</para>
/// </remarks>
private readonly StrongBox<ExceptionDispatchInfo> _failedTransfer;
/// <summary>
/// Initializes a new instance of the <see cref="DenyExecutionSynchronizationContext"/> class.
/// </summary>
/// <param name="underlyingContext">The fallback synchronization context to use for scheduling operations
/// posted to this synchronization context.</param>
public DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext)
: this(underlyingContext, mainThread: null, failedTransfer: null)
{
}
private DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext, Thread? mainThread, StrongBox<ExceptionDispatchInfo>? failedTransfer)
{
UnderlyingContext = underlyingContext ?? new SynchronizationContext();
MainThread = mainThread ?? new Thread(MainThreadStart);
_failedTransfer = failedTransfer ?? new StrongBox<ExceptionDispatchInfo>();
}
internal event EventHandler? InvalidSwitch;
private SynchronizationContext UnderlyingContext
{
get;
}
/// <summary>
/// Gets the <see cref="Thread"/> to treat as the main thread.
/// </summary>
/// <remarks>
/// <para>This thread will never be started, and will never have work scheduled for execution. The value is
/// used for checking if <see cref="Thread.CurrentThread"/> matches a known "main thread", and ensures that
/// the comparison will always result in a failure (not currently on the main thread).</para>
/// </remarks>
internal Thread MainThread
{
get;
}
private void MainThreadStart() => throw ExceptionUtilities.Unreachable;
/// <summary>
/// Verifies that the current synchronization context has not been used for scheduling work. If the
/// synchronization was used, an exception is thrown with information about the first such case.
/// </summary>
internal void ThrowIfSwitchOccurred()
{
if (_failedTransfer.Value == null)
{
return;
}
_failedTransfer.Value.Throw();
}
public override void Post(SendOrPostCallback d, object? state)
{
try
{
if (_failedTransfer.Value == null)
{
ThrowFailedTransferExceptionForCapture();
}
}
catch (InvalidOperationException e)
{
_failedTransfer.Value = ExceptionDispatchInfo.Capture(e);
InvalidSwitch?.Invoke(this, EventArgs.Empty);
}
#pragma warning disable VSTHRD001 // Avoid legacy thread switching APIs
UnderlyingContext.Post(d, state);
#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs
}
public override void Send(SendOrPostCallback d, object? state)
{
try
{
if (_failedTransfer.Value == null)
{
ThrowFailedTransferExceptionForCapture();
}
}
catch (InvalidOperationException e)
{
_failedTransfer.Value = ExceptionDispatchInfo.Capture(e);
InvalidSwitch?.Invoke(this, EventArgs.Empty);
}
#pragma warning disable VSTHRD001 // Avoid legacy thread switching APIs
UnderlyingContext.Send(d, state);
#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs
}
public override SynchronizationContext CreateCopy()
=> new DenyExecutionSynchronizationContext(UnderlyingContext.CreateCopy(), MainThread, _failedTransfer);
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowFailedTransferExceptionForCapture()
=> throw new InvalidOperationException($"Code cannot switch to the main thread without configuring the {nameof(IThreadingContext)}.");
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Threading;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Test.Utilities
{
internal partial class TestExportJoinableTaskContext
{
/// <summary>
/// Defines a <see cref="SynchronizationContext"/> for use in cases where the synchronization context should not
/// be used for execution of code. Attempting to execute code through this synchronization context will record
/// an exception (with stack trace) for the first occurrence, which can be re-thrown by calling
/// <see cref="ThrowIfSwitchOccurred"/> at an appropriate time.
/// </summary>
/// <remarks>
/// <para>This synchronization context is used in cases where code expects a synchronization context with
/// specific properties (e.g. code is executed on a "main thread"), but no synchronization context with those
/// properties is available. Due to the positioning of synchronization contexts within asynchronous code
/// patterns, detection of misused synchronization contexts without crashes is often challenging. Test cases can
/// use this synchronization context in place of a mock to capture </para>
///
/// <note type="important">
/// <para>This synchronization context will not directly block the execution of scheduled tasks, and will fall
/// back to execution on an underlying synchronization context (typically the thread pool). Tests using this
/// synchronization context should verify the synchronization context was not used by calling
/// <see cref="ThrowIfSwitchOccurred"/> at the end of the test.</para>
/// </note>
/// </remarks>
internal sealed class DenyExecutionSynchronizationContext : SynchronizationContext
{
/// <summary>
/// Records the first case where the synchronization context was used for scheduling an operation.
/// </summary>
/// <remarks>
/// <para>The <see cref="StrongBox{T}"/> wrapper allows copies of the synchronization context (created by
/// <see cref="CreateCopy"/>) to record information about incorrect synchronization context in the original
/// synchronization context from which it was created.</para>
/// </remarks>
private readonly StrongBox<ExceptionDispatchInfo> _failedTransfer;
/// <summary>
/// Initializes a new instance of the <see cref="DenyExecutionSynchronizationContext"/> class.
/// </summary>
/// <param name="underlyingContext">The fallback synchronization context to use for scheduling operations
/// posted to this synchronization context.</param>
public DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext)
: this(underlyingContext, mainThread: null, failedTransfer: null)
{
}
private DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext, Thread? mainThread, StrongBox<ExceptionDispatchInfo>? failedTransfer)
{
UnderlyingContext = underlyingContext ?? new SynchronizationContext();
MainThread = mainThread ?? new Thread(MainThreadStart);
_failedTransfer = failedTransfer ?? new StrongBox<ExceptionDispatchInfo>();
}
internal event EventHandler? InvalidSwitch;
private SynchronizationContext UnderlyingContext
{
get;
}
/// <summary>
/// Gets the <see cref="Thread"/> to treat as the main thread.
/// </summary>
/// <remarks>
/// <para>This thread will never be started, and will never have work scheduled for execution. The value is
/// used for checking if <see cref="Thread.CurrentThread"/> matches a known "main thread", and ensures that
/// the comparison will always result in a failure (not currently on the main thread).</para>
/// </remarks>
internal Thread MainThread
{
get;
}
private void MainThreadStart() => throw ExceptionUtilities.Unreachable;
/// <summary>
/// Verifies that the current synchronization context has not been used for scheduling work. If the
/// synchronization was used, an exception is thrown with information about the first such case.
/// </summary>
internal void ThrowIfSwitchOccurred()
{
if (_failedTransfer.Value == null)
{
return;
}
_failedTransfer.Value.Throw();
}
public override void Post(SendOrPostCallback d, object? state)
{
try
{
if (_failedTransfer.Value == null)
{
ThrowFailedTransferExceptionForCapture();
}
}
catch (InvalidOperationException e)
{
_failedTransfer.Value = ExceptionDispatchInfo.Capture(e);
InvalidSwitch?.Invoke(this, EventArgs.Empty);
}
#pragma warning disable VSTHRD001 // Avoid legacy thread switching APIs
UnderlyingContext.Post(d, state);
#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs
}
public override void Send(SendOrPostCallback d, object? state)
{
try
{
if (_failedTransfer.Value == null)
{
ThrowFailedTransferExceptionForCapture();
}
}
catch (InvalidOperationException e)
{
_failedTransfer.Value = ExceptionDispatchInfo.Capture(e);
InvalidSwitch?.Invoke(this, EventArgs.Empty);
}
#pragma warning disable VSTHRD001 // Avoid legacy thread switching APIs
UnderlyingContext.Send(d, state);
#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs
}
public override SynchronizationContext CreateCopy()
=> new DenyExecutionSynchronizationContext(UnderlyingContext.CreateCopy(), MainThread, _failedTransfer);
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowFailedTransferExceptionForCapture()
=> throw new InvalidOperationException($"Code cannot switch to the main thread without configuring the {nameof(IThreadingContext)}.");
}
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Core/Rebuild/xlf/RebuildResources.zh-Hans.xlf | <?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-Hans" original="../RebuildResources.resx">
<body>
<trans-unit id="0_exists_1_times_in_compilation_options">
<source>'{0}' exists '{1}' times in compilation options.</source>
<target state="new">'{0}' exists '{1}' times in compilation options.</target>
<note />
</trans-unit>
<trans-unit id="A_non_null_PDB_stream_must_be_provided_because_the_compilation_does_not_have_an_embedded_PDB">
<source>A non-null PDB stream must be provided because the compilation does not have an embedded PDB.</source>
<target state="new">A non-null PDB stream must be provided because the compilation does not have an embedded PDB.</target>
<note />
</trans-unit>
<trans-unit id="Cannot_create_compilation_options_0">
<source>Cannot create compilation options: {0}</source>
<target state="new">Cannot create compilation options: {0}</target>
<note />
</trans-unit>
<trans-unit id="Could_not_get_PDB_file_path">
<source>Could not get PDB file path.</source>
<target state="new">Could not get PDB file path.</target>
<note />
</trans-unit>
<trans-unit id="Does_not_contain_metadata_compilation_options">
<source>Does not contain metadata compilation options.</source>
<target state="new">Does not contain metadata compilation options.</target>
<note />
</trans-unit>
<trans-unit id="Encountered_null_or_empty_key_for_compilation_options_pairs">
<source>Encountered null or empty key for compilation options pairs.</source>
<target state="new">Encountered null or empty key for compilation options pairs.</target>
<note />
</trans-unit>
<trans-unit id="Encountered_unexpected_byte_0_when_expecting_a_null_terminator">
<source>Encountered unexpected byte '{0}' when expecting a null terminator.</source>
<target state="new">Encountered unexpected byte '{0}' when expecting a null terminator.</target>
<note />
</trans-unit>
<trans-unit id="Invalid_language_name">
<source>Invalid language name.</source>
<target state="new">Invalid language name.</target>
<note />
</trans-unit>
<trans-unit id="PDB_stream_must_be_null_because_the_compilation_has_an_embedded_PDB">
<source>PDB stream must be null because the compilation has an embedded PDB.</source>
<target state="new">PDB stream must be null because the compilation has an embedded PDB.</target>
<note />
</trans-unit>
<trans-unit id="Unexpected_value_for_EmbedInteropTypes_MetadataImageKind_0">
<source>Unexpected value for EmbedInteropTypes/MetadataImageKind '{0}'.</source>
<target state="new">Unexpected value for EmbedInteropTypes/MetadataImageKind '{0}'.</target>
<note />
</trans-unit>
</body>
</file>
</xliff> | <?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-Hans" original="../RebuildResources.resx">
<body>
<trans-unit id="0_exists_1_times_in_compilation_options">
<source>'{0}' exists '{1}' times in compilation options.</source>
<target state="new">'{0}' exists '{1}' times in compilation options.</target>
<note />
</trans-unit>
<trans-unit id="A_non_null_PDB_stream_must_be_provided_because_the_compilation_does_not_have_an_embedded_PDB">
<source>A non-null PDB stream must be provided because the compilation does not have an embedded PDB.</source>
<target state="new">A non-null PDB stream must be provided because the compilation does not have an embedded PDB.</target>
<note />
</trans-unit>
<trans-unit id="Cannot_create_compilation_options_0">
<source>Cannot create compilation options: {0}</source>
<target state="new">Cannot create compilation options: {0}</target>
<note />
</trans-unit>
<trans-unit id="Could_not_get_PDB_file_path">
<source>Could not get PDB file path.</source>
<target state="new">Could not get PDB file path.</target>
<note />
</trans-unit>
<trans-unit id="Does_not_contain_metadata_compilation_options">
<source>Does not contain metadata compilation options.</source>
<target state="new">Does not contain metadata compilation options.</target>
<note />
</trans-unit>
<trans-unit id="Encountered_null_or_empty_key_for_compilation_options_pairs">
<source>Encountered null or empty key for compilation options pairs.</source>
<target state="new">Encountered null or empty key for compilation options pairs.</target>
<note />
</trans-unit>
<trans-unit id="Encountered_unexpected_byte_0_when_expecting_a_null_terminator">
<source>Encountered unexpected byte '{0}' when expecting a null terminator.</source>
<target state="new">Encountered unexpected byte '{0}' when expecting a null terminator.</target>
<note />
</trans-unit>
<trans-unit id="Invalid_language_name">
<source>Invalid language name.</source>
<target state="new">Invalid language name.</target>
<note />
</trans-unit>
<trans-unit id="PDB_stream_must_be_null_because_the_compilation_has_an_embedded_PDB">
<source>PDB stream must be null because the compilation has an embedded PDB.</source>
<target state="new">PDB stream must be null because the compilation has an embedded PDB.</target>
<note />
</trans-unit>
<trans-unit id="Unexpected_value_for_EmbedInteropTypes_MetadataImageKind_0">
<source>Unexpected value for EmbedInteropTypes/MetadataImageKind '{0}'.</source>
<target state="new">Unexpected value for EmbedInteropTypes/MetadataImageKind '{0}'.</target>
<note />
</trans-unit>
</body>
</file>
</xliff> | -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Features/VisualBasic/Portable/Structure/Providers/WhileBlockStructureProvider.vb | ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.[Shared].Collections
Imports Microsoft.CodeAnalysis.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Friend Class WhileBlockStructureProvider
Inherits AbstractSyntaxNodeStructureProvider(Of WhileBlockSyntax)
Protected Overrides Sub CollectBlockSpans(previousToken As SyntaxToken,
node As WhileBlockSyntax,
ByRef spans As TemporaryArray(Of BlockSpan),
optionProvider As BlockStructureOptionProvider,
cancellationToken As CancellationToken)
spans.AddIfNotNull(CreateBlockSpanFromBlock(
node, node.WhileStatement, autoCollapse:=False,
type:=BlockTypes.Loop, isCollapsible:=True))
End Sub
End Class
End Namespace
| ' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.[Shared].Collections
Imports Microsoft.CodeAnalysis.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Friend Class WhileBlockStructureProvider
Inherits AbstractSyntaxNodeStructureProvider(Of WhileBlockSyntax)
Protected Overrides Sub CollectBlockSpans(previousToken As SyntaxToken,
node As WhileBlockSyntax,
ByRef spans As TemporaryArray(Of BlockSpan),
optionProvider As BlockStructureOptionProvider,
cancellationToken As CancellationToken)
spans.AddIfNotNull(CreateBlockSpanFromBlock(
node, node.WhileStatement, autoCollapse:=False,
type:=BlockTypes.Loop, isCollapsible:=True))
End Sub
End Class
End Namespace
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Workspaces/Remote/ServiceHub/Host/Storage/RemotePersistentStorageLocationService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Composition;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.Remote.Storage
{
// Have to re-export this in remote layer for it to be picked up.
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), layer: WorkspaceKind.RemoteWorkspace), Shared]
internal class RemoteWorkspacePersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteWorkspacePersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace) => true;
}
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), layer: WorkspaceKind.RemoteTemporaryWorkspace), Shared]
internal class RemoteTemporaryWorkspacePersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteTemporaryWorkspacePersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace) => true;
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Composition;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.Remote.Storage
{
// Have to re-export this in remote layer for it to be picked up.
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), layer: WorkspaceKind.RemoteWorkspace), Shared]
internal class RemoteWorkspacePersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteWorkspacePersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace) => true;
}
[ExportWorkspaceService(typeof(IPersistentStorageLocationService), layer: WorkspaceKind.RemoteTemporaryWorkspace), Shared]
internal class RemoteTemporaryWorkspacePersistentStorageLocationService : DefaultPersistentStorageLocationService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteTemporaryWorkspacePersistentStorageLocationService()
{
}
public override bool IsSupported(Workspace workspace) => true;
}
}
| -1 |
dotnet/roslyn | 56,154 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider | The option is never turned off in product and has default value true. | tmat | "2021-09-03T01:36:45Z" | "2021-09-03T21:35:50Z" | 34a521565b359ab3b396577b1535211fdc8733b7 | 28d4d9d9869cf2b37e3e700e1057adf367fe9cd0 | Remove unused ServiceComponentOnOffOptions.DiagnosticProvider. The option is never turned off in product and has default value true. | ./src/Compilers/Test/Resources/Core/MetadataTests/NativeApp.exe | MZ @ !L!This program cannot be run in DOS mode.
$ -23i\`i\`i\`d`j\`d`z\`d`o\`3`k\`i]`_\``h\`d`h\``h\`Richi\` PE L \r3S : > @ @ X < |