197 references to OperatorDeclarationSyntax
Microsoft.CodeAnalysis.CSharp (32)
Binder\BinderFactory.BinderFactoryVisitor.cs (3)
363public override Binder VisitOperatorDeclaration(OperatorDeclarationSyntax parent) 468var operatorDeclaration = (OperatorDeclarationSyntax)baseMethodDeclarationSyntax;
Binder\LocalBinderFactory.cs (1)
207public override void VisitOperatorDeclaration(OperatorDeclarationSyntax node)
Binder\Semantics\Operators\OperatorFacts.cs (1)
118public static string OperatorNameFromDeclaration(OperatorDeclarationSyntax declaration)
Compilation\SyntaxTreeSemanticModel.cs (2)
1682var operatorDecl = (OperatorDeclarationSyntax)declaration;
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
616OperatorDeclarationSyntax operatorSyntax = (OperatorDeclarationSyntax)syntax;
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
392arrowExpr = ((OperatorDeclarationSyntax)node).ExpressionBody;
Symbols\Source\SourceMemberContainerSymbol.cs (2)
5172var operatorSyntax = (OperatorDeclarationSyntax)m;
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (5)
20OperatorDeclarationSyntax syntax, 64OperatorDeclarationSyntax syntax, 93internal OperatorDeclarationSyntax GetSyntax() 96return (OperatorDeclarationSyntax)syntaxReferenceOpt.GetSyntax(); 129OperatorDeclarationSyntax declarationSyntax = GetSyntax();
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (5)
57!(syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken))) 142if (syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken)) 191else if ((result & DeclarationModifiers.Static) != 0 && syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken)) 305case OperatorDeclarationSyntax operatorDeclaration: 796case OperatorDeclarationSyntax operatorDeclaration:
Syntax\OperatorDeclarationSyntax.cs (2)
9public OperatorDeclarationSyntax Update( 33public OperatorDeclarationSyntax Update(
Syntax\SyntaxExtensions.cs (2)
288public static OperatorDeclarationSyntax Update( 289this OperatorDeclarationSyntax syntax,
Syntax\SyntaxFactory.cs (5)
2562public static OperatorDeclarationSyntax OperatorDeclaration( 2585public static OperatorDeclarationSyntax OperatorDeclaration( 2610public static OperatorDeclarationSyntax OperatorDeclaration( 2630/// <summary>Creates a new <see cref="OperatorDeclarationSyntax"/> instance.</summary> 2631public static OperatorDeclarationSyntax OperatorDeclaration(
Syntax\SyntaxFacts.cs (1)
173return ((OperatorDeclarationSyntax)parent).ReturnType == node;
Microsoft.CodeAnalysis.CSharp.CodeStyle (19)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForOperatorsHelper.cs (11)
17UseExpressionBodyHelper<OperatorDeclarationSyntax> 34protected override BlockSyntax GetBody(OperatorDeclarationSyntax declaration) 37protected override ArrowExpressionClauseSyntax GetExpressionBody(OperatorDeclarationSyntax declaration) 40protected override SyntaxToken GetSemicolonToken(OperatorDeclarationSyntax declaration) 43protected override OperatorDeclarationSyntax WithSemicolonToken(OperatorDeclarationSyntax declaration, SyntaxToken token) 46protected override OperatorDeclarationSyntax WithExpressionBody(OperatorDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 49protected override OperatorDeclarationSyntax WithBody(OperatorDeclarationSyntax declaration, BlockSyntax body) 52protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, OperatorDeclarationSyntax declaration)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
108OperatorDeclarationSyntax op => op.ReturnType,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (3)
60return ((OperatorDeclarationSyntax)member).OperatorToken; 129return ((OperatorDeclarationSyntax)member).WithParameterList((ParameterListSyntax)parameterList); 149return ((OperatorDeclarationSyntax)member).ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
64return ((OperatorDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
102(token.Parent is PrefixUnaryExpressionSyntax || token.Parent is PostfixUnaryExpressionSyntax || token.Parent is OperatorDeclarationSyntax)) || 103(SyntaxFacts.IsBinaryExpression(kind) && (token.Parent is BinaryExpressionSyntax or OperatorDeclarationSyntax or RelationalPatternSyntax)) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
128OperatorDeclarationSyntax or
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (25)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (6)
200var equalsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 201=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.EqualsEqualsToken }); 202var notEqualsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 203=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.ExclamationEqualsToken });
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
81var newOperator = (node as OperatorDeclarationSyntax)?.WithReturnType(newReturnType);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
167=> members.LastOrDefault(m => m is OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
780var operatorDeclarationSyntax = (OperatorDeclarationSyntax)syntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
121return Compare((OperatorDeclarationSyntax)x, (OperatorDeclarationSyntax)y); 225private static int Compare(OperatorDeclarationSyntax x, OperatorDeclarationSyntax y)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (9)
30var methodDeclaration = GenerateOperatorDeclaration(method, GetDestination(destination), info, cancellationToken); 36internal static OperatorDeclarationSyntax GenerateOperatorDeclaration( 42var reusableSyntax = GetReuseableSyntaxNodeForSymbol<OperatorDeclarationSyntax>(method, info); 48var declaration = GenerateOperatorDeclarationWorker(method, destination, info, cancellationToken); 55private static OperatorDeclarationSyntax UseExpressionBodyIfDesired( 56CSharpCodeGenerationContextInfo info, OperatorDeclarationSyntax declaration, CancellationToken cancellationToken) 73private static OperatorDeclarationSyntax GenerateOperatorDeclarationWorker( 92var operatorDecl = OperatorDeclaration(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1131OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax when includeOperators => true,
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Structure\MetadataAsSource\OperatorDeclarationStructureTests.cs (1)
14public class OperatorDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<OperatorDeclarationSyntax>
Structure\OperatorDeclarationStructureTests.cs (1)
15public class OperatorDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<OperatorDeclarationSyntax>
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Diagnostics\GetDiagnosticsTests.cs (1)
1029OperatorDeclarationSyntax operatorDecl => operatorDecl.OperatorToken.GetLocation(),
Microsoft.CodeAnalysis.CSharp.Features (33)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
1690var operatorDeclaration = (OperatorDeclarationSyntax)node;
EditAndContinue\SyntaxComparer.cs (1)
1453return ((OperatorDeclarationSyntax)node).OperatorToken;
EditAndContinue\SyntaxUtilities.cs (1)
26OperatorDeclarationSyntax operatorDeclaration => CreateSimpleBody(BlockOrExpression(operatorDeclaration.Body, operatorDeclaration.ExpressionBody)),
InheritanceMargin\CSharpInheritanceMarginService.cs (1)
74OperatorDeclarationSyntax operatorDeclarationNode => operatorDeclarationNode.OperatorToken,
LineSeparators\CSharpLineSeparatorService.cs (1)
192if (node is OperatorDeclarationSyntax operatorDecl)
Organizing\Organizers\OperatorDeclarationOrganizer.cs (3)
17internal class OperatorDeclarationOrganizer : AbstractSyntaxNodeOrganizer<OperatorDeclarationSyntax> 25protected override OperatorDeclarationSyntax Organize( 26OperatorDeclarationSyntax syntax,
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForOperatorsHelper.cs (11)
17UseExpressionBodyHelper<OperatorDeclarationSyntax> 34protected override BlockSyntax GetBody(OperatorDeclarationSyntax declaration) 37protected override ArrowExpressionClauseSyntax GetExpressionBody(OperatorDeclarationSyntax declaration) 40protected override SyntaxToken GetSemicolonToken(OperatorDeclarationSyntax declaration) 43protected override OperatorDeclarationSyntax WithSemicolonToken(OperatorDeclarationSyntax declaration, SyntaxToken token) 46protected override OperatorDeclarationSyntax WithExpressionBody(OperatorDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 49protected override OperatorDeclarationSyntax WithBody(OperatorDeclarationSyntax declaration, BlockSyntax body) 52protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, OperatorDeclarationSyntax declaration)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
108OperatorDeclarationSyntax op => op.ReturnType,
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (6)
200var equalsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 201=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.EqualsEqualsToken }); 202var notEqualsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 203=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.ExclamationEqualsToken });
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
81var newOperator = (node as OperatorDeclarationSyntax)?.WithReturnType(newReturnType);
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
392arrowExpr = ((OperatorDeclarationSyntax)node).ExpressionBody;
Structure\CSharpBlockStructureProvider.cs (1)
43builder.Add<OperatorDeclarationSyntax, OperatorDeclarationStructureProvider>();
Structure\CSharpStructureHelpers.cs (1)
281OperatorDeclarationSyntax operatorDeclaration => operatorDeclaration.Modifiers.FirstOrNull() ?? operatorDeclaration.ReturnType.GetFirstToken(),
Structure\Providers\OperatorDeclarationStructureProvider.cs (2)
12internal class OperatorDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<OperatorDeclarationSyntax> 16OperatorDeclarationSyntax operatorDeclaration,
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (6)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
4502var operatorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OperatorDeclarationSyntax>().Single();
Symbols\StaticAbstractMembersInInterfacesTests.cs (4)
19565var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 19648var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 19740var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>()); 19829var declaredSymbol = model.GetDeclaredSymbol(node.FirstAncestorOrSelf<OperatorDeclarationSyntax>());
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (14)
Generated\Syntax.Test.xml.Generated.cs (5)
10781private static OperatorDeclarationSyntax GenerateOperatorDeclaration() 13281var node = GenerateOperatorDeclaration(); 13294var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithReturnType(node.ReturnType).WithExplicitInterfaceSpecifier(node.ExplicitInterfaceSpecifier).WithOperatorKeyword(node.OperatorKeyword).WithCheckedKeyword(node.CheckedKeyword).WithOperatorToken(node.OperatorToken).WithParameterList(node.ParameterList).WithBody(node.Body).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken); 18883var oldNode = GenerateOperatorDeclaration(); 18899var oldNode = GenerateOperatorDeclaration();
Parsing\DeclarationParsingTests.cs (6)
5296var ps = (OperatorDeclarationSyntax)cs.Members[0]; 5376var ps = (OperatorDeclarationSyntax)cs.Members[0]; 5490var ps = (OperatorDeclarationSyntax)cs.Members[0];
Parsing\ParserErrorMessageTests.cs (3)
3785var operatorDeclaration = (OperatorDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is OperatorDeclarationSyntax);
Microsoft.CodeAnalysis.CSharp.Workspaces (30)
CodeGeneration\CSharpSyntaxGenerator.cs (6)
630SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 824var operatorDeclaration = (OperatorDeclarationSyntax)member; 2235return ((OperatorDeclarationSyntax)declaration).WithParameterList(list); 2483SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).Body?.Statements, 2511return ((OperatorDeclarationSyntax)declaration).WithBody(somebody).WithSemicolonToken(semicolon).WithExpressionBody(null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (3)
60return ((OperatorDeclarationSyntax)member).OperatorToken; 129return ((OperatorDeclarationSyntax)member).WithParameterList((ParameterListSyntax)parameterList); 149return ((OperatorDeclarationSyntax)member).ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
64return ((OperatorDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
102(token.Parent is PrefixUnaryExpressionSyntax || token.Parent is PostfixUnaryExpressionSyntax || token.Parent is OperatorDeclarationSyntax)) || 103(SyntaxFacts.IsBinaryExpression(kind) && (token.Parent is BinaryExpressionSyntax or OperatorDeclarationSyntax or RelationalPatternSyntax)) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
128OperatorDeclarationSyntax or
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
167=> members.LastOrDefault(m => m is OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
780var operatorDeclarationSyntax = (OperatorDeclarationSyntax)syntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
121return Compare((OperatorDeclarationSyntax)x, (OperatorDeclarationSyntax)y); 225private static int Compare(OperatorDeclarationSyntax x, OperatorDeclarationSyntax y)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (9)
30var methodDeclaration = GenerateOperatorDeclaration(method, GetDestination(destination), info, cancellationToken); 36internal static OperatorDeclarationSyntax GenerateOperatorDeclaration( 42var reusableSyntax = GetReuseableSyntaxNodeForSymbol<OperatorDeclarationSyntax>(method, info); 48var declaration = GenerateOperatorDeclarationWorker(method, destination, info, cancellationToken); 55private static OperatorDeclarationSyntax UseExpressionBodyIfDesired( 56CSharpCodeGenerationContextInfo info, OperatorDeclarationSyntax declaration, CancellationToken cancellationToken) 73private static OperatorDeclarationSyntax GenerateOperatorDeclarationWorker( 92var operatorDecl = OperatorDeclaration(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1131OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax when includeOperators => true,
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (27)
CodeGeneration\SyntaxGeneratorTests.cs (27)
860VerifySyntax<OperatorDeclarationSyntax>( 864VerifySyntax<OperatorDeclarationSyntax>( 868VerifySyntax<OperatorDeclarationSyntax>( 872VerifySyntax<OperatorDeclarationSyntax>( 876VerifySyntax<OperatorDeclarationSyntax>( 880VerifySyntax<OperatorDeclarationSyntax>( 884VerifySyntax<OperatorDeclarationSyntax>( 888VerifySyntax<OperatorDeclarationSyntax>( 892VerifySyntax<OperatorDeclarationSyntax>( 896VerifySyntax<OperatorDeclarationSyntax>( 900VerifySyntax<OperatorDeclarationSyntax>( 904VerifySyntax<OperatorDeclarationSyntax>( 908VerifySyntax<OperatorDeclarationSyntax>( 912VerifySyntax<OperatorDeclarationSyntax>( 916VerifySyntax<OperatorDeclarationSyntax>( 920VerifySyntax<OperatorDeclarationSyntax>( 924VerifySyntax<OperatorDeclarationSyntax>( 928VerifySyntax<OperatorDeclarationSyntax>( 932VerifySyntax<OperatorDeclarationSyntax>( 936VerifySyntax<OperatorDeclarationSyntax>( 940VerifySyntax<OperatorDeclarationSyntax>( 944VerifySyntax<OperatorDeclarationSyntax>( 948VerifySyntax<OperatorDeclarationSyntax>( 952VerifySyntax<OperatorDeclarationSyntax>( 956VerifySyntax<OperatorDeclarationSyntax>( 982VerifySyntax<OperatorDeclarationSyntax>(Generator.OperatorDeclaration(operatorSymbol), "public static global::C operator checked ++(global::C x)\r\n{\r\n}"); 1236VerifySyntax<OperatorDeclarationSyntax>(
Microsoft.DotNet.GenFacades (1)
NotSupportedAssemblyGenerator.cs (1)
180public override SyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node)
Microsoft.VisualStudio.LanguageServices.CSharp (7)
CodeModel\CSharpCodeModelService.CodeModelEventCollector.cs (1)
834else if (method is OperatorDeclarationSyntax operatorDecl)
CodeModel\CSharpCodeModelService.cs (2)
832return "operator " + ((OperatorDeclarationSyntax)node).OperatorToken.ToString(); 3389else if (container is OperatorDeclarationSyntax operationDeclaration)
CodeModel\CSharpCodeModelService.NodeLocator.cs (2)
407startPosition = ((OperatorDeclarationSyntax)node).OperatorToken.SpanStart; 970endPosition = ((OperatorDeclarationSyntax)node).OperatorToken.Span.End;
CodeModel\CSharpCodeModelService.NodeNameGenerator.cs (2)
210var operatorDeclaration = (OperatorDeclarationSyntax)node;