-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature RequestFeature-UserDefinedCompoundAssignmentOperatorsapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implemented
Description
Background and Motivation
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/user-defined-compound-assignment.md
Proposed APIs
namespace Microsoft.CodeAnalysis
{
public static class WellKnownMemberNames
{
+ /// <summary>
+ /// The name assigned to the '+=' operator.
+ /// </summary>
+ public const string AdditionAssignmentOperatorName = "op_AdditionAssignment";
+
+ /// <summary>
+ /// The name assigned to the '-=' operator.
+ /// </summary>
+ public const string SubtractionAssignmentOperatorName = "op_SubtractionAssignment";
+
+ /// <summary>
+ /// The name assigned to the '*=' operator.
+ /// </summary>
+ public const string MultiplicationAssignmentOperatorName = "op_MultiplicationAssignment";
+
+ /// <summary>
+ /// The name assigned to the '/=' operator.
+ /// </summary>
+ public const string DivisionAssignmentOperatorName = "op_DivisionAssignment";
+
+ /// <summary>
+ /// The name assigned to the '%=' operator.
+ /// </summary>
+ public const string ModulusAssignmentOperatorName = "op_ModulusAssignment";
+
+ /// <summary>
+ /// The name assigned to the '&=' operator.
+ /// </summary>
+ public const string BitwiseAndAssignmentOperatorName = "op_BitwiseAndAssignment";
+
+ /// <summary>
+ /// The name assigned to the '|=' operator.
+ /// </summary>
+ public const string BitwiseOrAssignmentOperatorName = "op_BitwiseOrAssignment";
+
+ /// <summary>
+ /// The name assigned to the '^=' operator.
+ /// </summary>
+ public const string ExclusiveOrAssignmentOperatorName = "op_ExclusiveOrAssignment";
+
+ /// <summary>
+ /// The name assigned to the '<<=' operator.
+ /// </summary>
+ public const string LeftShiftAssignmentOperatorName = "op_LeftShiftAssignment";
+
+ /// <summary>
+ /// The name assigned to the '>>=' operator.
+ /// </summary>
+ public const string RightShiftAssignmentOperatorName = "op_RightShiftAssignment";
+
+ /// <summary>
+ /// The name assigned to the '>>>=' operator.
+ /// </summary>
+ public const string UnsignedRightShiftAssignmentOperatorName = "op_UnsignedRightShiftAssignment";
+
+ /// <summary>
+ /// The name assigned to the checked '+=' operator.
+ /// </summary>
+ public const string CheckedAdditionAssignmentOperatorName = "op_CheckedAdditionAssignment";
+
+ /// <summary>
+ /// The name assigned to the checked '-=' operator.
+ /// </summary>
+ public const string CheckedSubtractionAssignmentOperatorName = "op_CheckedSubtractionAssignment";
+
+ /// <summary>
+ /// The name assigned to the checked '*=' operator.
+ /// </summary>
+ public const string CheckedMultiplicationAssignmentOperatorName = "op_CheckedMultiplicationAssignment";
+
+ /// <summary>
+ /// The name assigned to the checked '/=' operator.
+ /// </summary>
+ public const string CheckedDivisionAssignmentOperatorName = "op_CheckedDivisionAssignment";
}
}
namespace Microsoft.CodeAnalysis.CSharp
{
public static partial class SyntaxFacts
{
+ public static bool IsOverloadableCompoundAssignmentOperator(SyntaxKind kind)
}
}
namespace Microsoft.CodeAnalysis.Editing;
{
public enum OperatorKind
{
+ /// <summary>
+ /// The name assigned to the AdditionAssignment operator.
+ /// </summary>
+ AdditionAssignment,
+
+ /// <summary>
+ /// The name assigned to the SubtractionAssignment operator.
+ /// </summary>
+ SubtractionAssignment,
+
+ /// <summary>
+ /// The name assigned to the MultiplicationAssignment operator.
+ /// </summary>
+ MultiplicationAssignment,
+
+ /// <summary>
+ /// The name assigned to the DivisionAssignment operator.
+ /// </summary>
+ DivisionAssignment,
+
+ /// <summary>
+ /// The name assigned to the ModulusAssignment operator.
+ /// </summary>
+ ModulusAssignment,
+
+ /// <summary>
+ /// The name assigned to the ExclusiveOrAssignment operator.
+ /// </summary>
+ ExclusiveOrAssignment,
+
+ /// <summary>
+ /// The name assigned to the BitwiseAndAssignment operator.
+ /// </summary>
+ BitwiseAndAssignment,
+
+ /// <summary>
+ /// The name assigned to the BitwiseOrAssignment operator.
+ /// </summary>
+ BitwiseOrAssignment,
+
+ /// <summary>
+ /// The name assigned to the LeftShiftAssignment operator.
+ /// </summary>
+ LeftShiftAssignment,
+
+ /// <summary>
+ /// The name assigned to the RightShiftAssignment operator.
+ /// </summary>
+ RightShiftAssignment,
+
+ /// <summary>
+ /// The name assigned to the UnsignedRightShiftAssignment operator.
+ /// </summary>
+ UnsignedRightShiftAssignment,
}
}
Metadata
Metadata
Assignees
Labels
Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature RequestFeature-UserDefinedCompoundAssignmentOperatorsapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implemented